OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/download/byte_stream.h" | 10 #include "content/browser/download/byte_stream.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 DownloadFileTest() : | 78 DownloadFileTest() : |
79 observer_(new StrictMock<MockDownloadDestinationObserver>), | 79 observer_(new StrictMock<MockDownloadDestinationObserver>), |
80 observer_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(observer_.get())), | 80 observer_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(observer_.get())), |
81 bytes_(-1), | 81 bytes_(-1), |
82 bytes_per_sec_(-1), | 82 bytes_per_sec_(-1), |
83 hash_state_("xyzzy"), | 83 hash_state_("xyzzy"), |
84 ui_thread_(BrowserThread::UI, &loop_), | 84 ui_thread_(BrowserThread::UI, &loop_), |
85 file_thread_(BrowserThread::FILE, &loop_) { | 85 file_thread_(BrowserThread::FILE, &loop_) { |
86 } | 86 } |
87 | 87 |
88 ~DownloadFileTest() { | 88 virtual ~DownloadFileTest() { |
89 } | 89 } |
90 | 90 |
91 void SetUpdateDownloadInfo(int64 bytes, int64 bytes_per_sec, | 91 void SetUpdateDownloadInfo(int64 bytes, int64 bytes_per_sec, |
92 const std::string& hash_state) { | 92 const std::string& hash_state) { |
93 bytes_ = bytes; | 93 bytes_ = bytes; |
94 bytes_per_sec_ = bytes_per_sec; | 94 bytes_per_sec_ = bytes_per_sec; |
95 hash_state_ = hash_state; | 95 hash_state_ = hash_state; |
96 } | 96 } |
97 | 97 |
98 void ConfirmUpdateDownloadInfo() { | 98 void ConfirmUpdateDownloadInfo() { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 598 |
599 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), | 599 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), |
600 bytes_); | 600 bytes_); |
601 EXPECT_EQ(download_file_->GetHashState(), hash_state_); | 601 EXPECT_EQ(download_file_->GetHashState(), hash_state_); |
602 | 602 |
603 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 603 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
604 DestroyDownloadFile(0); | 604 DestroyDownloadFile(0); |
605 } | 605 } |
606 | 606 |
607 } // namespace content | 607 } // namespace content |
OLD | NEW |