| 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 23 matching lines...) Expand all Loading... |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 class MockByteStreamReader : public ByteStreamReader { | 36 class MockByteStreamReader : public ByteStreamReader { |
| 37 public: | 37 public: |
| 38 MockByteStreamReader() {} | 38 MockByteStreamReader() {} |
| 39 ~MockByteStreamReader() {} | 39 ~MockByteStreamReader() {} |
| 40 | 40 |
| 41 // ByteStream functions | 41 // ByteStream functions |
| 42 MOCK_METHOD2(Read, ByteStreamReader::StreamState( | 42 MOCK_METHOD2(Read, ByteStreamReader::StreamState( |
| 43 scoped_refptr<net::IOBuffer>*, size_t*)); | 43 scoped_refptr<net::IOBuffer>*, size_t*)); |
| 44 MOCK_CONST_METHOD0(GetStatus, DownloadInterruptReason()); | 44 MOCK_CONST_METHOD0(GetStatus, int()); |
| 45 MOCK_METHOD1(RegisterCallback, void(const base::Closure&)); | 45 MOCK_METHOD1(RegisterCallback, void(const base::Closure&)); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class MockDownloadDestinationObserver : public DownloadDestinationObserver { | 48 class MockDownloadDestinationObserver : public DownloadDestinationObserver { |
| 49 public: | 49 public: |
| 50 MOCK_METHOD3(DestinationUpdate, void(int64, int64, const std::string&)); | 50 MOCK_METHOD3(DestinationUpdate, void(int64, int64, const std::string&)); |
| 51 MOCK_METHOD1(DestinationError, void(DownloadInterruptReason)); | 51 MOCK_METHOD1(DestinationError, void(DownloadInterruptReason)); |
| 52 MOCK_METHOD1(DestinationCompleted, void(const std::string&)); | 52 MOCK_METHOD1(DestinationCompleted, void(const std::string&)); |
| 53 | 53 |
| 54 // Doesn't override any methods in the base class. Used to make sure | 54 // Doesn't override any methods in the base class. Used to make sure |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 594 |
| 595 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), | 595 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), |
| 596 bytes_); | 596 bytes_); |
| 597 EXPECT_EQ(download_file_->GetHashState(), hash_state_); | 597 EXPECT_EQ(download_file_->GetHashState(), hash_state_); |
| 598 | 598 |
| 599 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 599 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
| 600 DestroyDownloadFile(0); | 600 DestroyDownloadFile(0); |
| 601 } | 601 } |
| 602 | 602 |
| 603 } // namespace content | 603 } // namespace content |
| OLD | NEW |