| 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "content/browser/download/byte_stream.h" | 8 #include "content/browser/download/byte_stream.h" |
| 9 #include "content/browser/download/download_create_info.h" | 9 #include "content/browser/download/download_create_info.h" |
| 10 #include "content/browser/download/download_file_manager.h" | 10 #include "content/browser/download/download_file_manager.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 class MockRequestHandle : public DownloadRequestHandleInterface { | 60 class MockRequestHandle : public DownloadRequestHandleInterface { |
| 61 public: | 61 public: |
| 62 MOCK_CONST_METHOD0(GetWebContents, WebContents*()); | 62 MOCK_CONST_METHOD0(GetWebContents, WebContents*()); |
| 63 MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*()); | 63 MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*()); |
| 64 MOCK_CONST_METHOD0(PauseRequest, void()); | 64 MOCK_CONST_METHOD0(PauseRequest, void()); |
| 65 MOCK_CONST_METHOD0(ResumeRequest, void()); | 65 MOCK_CONST_METHOD0(ResumeRequest, void()); |
| 66 MOCK_CONST_METHOD0(CancelRequest, void()); | 66 MOCK_CONST_METHOD0(CancelRequest, void()); |
| 67 MOCK_CONST_METHOD0(DebugString, std::string()); | 67 MOCK_CONST_METHOD0(DebugString, std::string()); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class MockDownloadFileFactory | 70 class MockDownloadFileFactory : public content::DownloadFileFactory { |
| 71 : public DownloadFileManager::DownloadFileFactory { | |
| 72 public: | 71 public: |
| 73 content::DownloadFile* CreateFile( | 72 content::DownloadFile* CreateFile( |
| 74 DownloadCreateInfo* info, | 73 DownloadCreateInfo* info, |
| 75 scoped_ptr<content::ByteStreamReader> stream_reader, | 74 scoped_ptr<content::ByteStreamReader> stream_reader, |
| 76 DownloadManager* mgr, | 75 DownloadManager* mgr, |
| 77 bool calculate_hash, | 76 bool calculate_hash, |
| 78 const net::BoundNetLog& bound_net_log) { | 77 const net::BoundNetLog& bound_net_log) { |
| 79 return MockCreateFile( | 78 return MockCreateFile( |
| 80 info, stream_reader.get(), info->request_handle, mgr, calculate_hash, | 79 info, stream_reader.get(), info->request_handle, mgr, calculate_hash, |
| 81 bound_net_log); | 80 bound_net_log); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); | 532 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); |
| 534 | 533 |
| 535 EXPECT_FALSE(item->GetFileExternallyRemoved()); | 534 EXPECT_FALSE(item->GetFileExternallyRemoved()); |
| 536 item->OnDownloadedFileRemoved(); | 535 item->OnDownloadedFileRemoved(); |
| 537 EXPECT_TRUE(item->GetFileExternallyRemoved()); | 536 EXPECT_TRUE(item->GetFileExternallyRemoved()); |
| 538 } | 537 } |
| 539 | 538 |
| 540 TEST(MockDownloadItem, Compiles) { | 539 TEST(MockDownloadItem, Compiles) { |
| 541 MockDownloadItem mock_item; | 540 MockDownloadItem mock_item; |
| 542 } | 541 } |
| OLD | NEW |