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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : public content::DownloadFileFactory { | 70 class MockDownloadFileFactory : public content::DownloadFileFactory { |
71 public: | 71 public: |
72 content::DownloadFile* CreateFile( | 72 content::DownloadFile* CreateFile( |
73 DownloadCreateInfo* info, | 73 scoped_ptr<DownloadCreateInfo> info, |
74 scoped_ptr<content::ByteStreamReader> stream_reader, | 74 scoped_ptr<content::ByteStreamReader> stream_reader, |
75 DownloadManager* mgr, | 75 DownloadManager* mgr, |
76 bool calculate_hash, | 76 bool calculate_hash, |
77 const net::BoundNetLog& bound_net_log) { | 77 const net::BoundNetLog& bound_net_log) { |
78 return MockCreateFile( | 78 return MockCreateFile( |
79 info, stream_reader.get(), info->request_handle, mgr, calculate_hash, | 79 info.get(), stream_reader.get(), info->request_handle, mgr, |
80 bound_net_log); | 80 calculate_hash, bound_net_log); |
81 } | 81 } |
82 | 82 |
83 MOCK_METHOD6(MockCreateFile, | 83 MOCK_METHOD6(MockCreateFile, |
84 content::DownloadFile*(DownloadCreateInfo*, | 84 content::DownloadFile*(DownloadCreateInfo*, |
85 content::ByteStreamReader*, | 85 content::ByteStreamReader*, |
86 const DownloadRequestHandle&, | 86 const DownloadRequestHandle&, |
87 DownloadManager*, | 87 DownloadManager*, |
88 bool, | 88 bool, |
89 const net::BoundNetLog&)); | 89 const net::BoundNetLog&)); |
90 }; | 90 }; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); | 532 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); |
533 | 533 |
534 EXPECT_FALSE(item->GetFileExternallyRemoved()); | 534 EXPECT_FALSE(item->GetFileExternallyRemoved()); |
535 item->OnDownloadedFileRemoved(); | 535 item->OnDownloadedFileRemoved(); |
536 EXPECT_TRUE(item->GetFileExternallyRemoved()); | 536 EXPECT_TRUE(item->GetFileExternallyRemoved()); |
537 } | 537 } |
538 | 538 |
539 TEST(MockDownloadItem, Compiles) { | 539 TEST(MockDownloadItem, Compiles) { |
540 MockDownloadItem mock_item; | 540 MockDownloadItem mock_item; |
541 } | 541 } |
OLD | NEW |