| 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/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/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/byte_stream.h" | 10 #include "content/browser/byte_stream.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 download_file_.reset( | 131 download_file_.reset( |
| 132 new DownloadFileImpl(save_info.Pass(), | 132 new DownloadFileImpl(save_info.Pass(), |
| 133 base::FilePath(), | 133 base::FilePath(), |
| 134 GURL(), // Source | 134 GURL(), // Source |
| 135 GURL(), // Referrer | 135 GURL(), // Referrer |
| 136 calculate_hash, | 136 calculate_hash, |
| 137 scoped_ptr<ByteStreamReader>(input_stream_), | 137 scoped_ptr<ByteStreamReader>(input_stream_), |
| 138 net::BoundNetLog(), | 138 net::BoundNetLog(), |
| 139 scoped_ptr<PowerSaveBlocker>().Pass(), | 139 scoped_ptr<PowerSaveBlocker>().Pass(), |
| 140 observer_factory_.GetWeakPtr())); | 140 observer_factory_.GetWeakPtr())); |
| 141 download_file_->SetClientGuid( |
| 142 "12345678-ABCD-1234-DCBA-123456789ABC"); |
| 141 | 143 |
| 142 EXPECT_CALL(*input_stream_, Read(_, _)) | 144 EXPECT_CALL(*input_stream_, Read(_, _)) |
| 143 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) | 145 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) |
| 144 .RetiresOnSaturation(); | 146 .RetiresOnSaturation(); |
| 145 | 147 |
| 146 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this); | 148 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this); |
| 147 bool called = false; | 149 bool called = false; |
| 148 DownloadInterruptReason result; | 150 DownloadInterruptReason result; |
| 149 download_file_->Initialize(base::Bind( | 151 download_file_->Initialize(base::Bind( |
| 150 &DownloadFileTest::SetInterruptReasonCallback, | 152 &DownloadFileTest::SetInterruptReasonCallback, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 596 |
| 595 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), | 597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), |
| 596 bytes_); | 598 bytes_); |
| 597 EXPECT_EQ(download_file_->GetHashState(), hash_state_); | 599 EXPECT_EQ(download_file_->GetHashState(), hash_state_); |
| 598 | 600 |
| 599 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
| 600 DestroyDownloadFile(0); | 602 DestroyDownloadFile(0); |
| 601 } | 603 } |
| 602 | 604 |
| 603 } // namespace content | 605 } // namespace content |
| OLD | NEW |