OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/download/download_manager_service.h" | 5 #include "chrome/browser/android/download/download_manager_service.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Mock implementation of content::DownloadManager. | 108 // Mock implementation of content::DownloadManager. |
109 class MockDownloadManager : public content::DownloadManager { | 109 class MockDownloadManager : public content::DownloadManager { |
110 public: | 110 public: |
111 MockDownloadManager() {} | 111 MockDownloadManager() {} |
112 ~MockDownloadManager() override {} | 112 ~MockDownloadManager() override {} |
113 | 113 |
114 MOCK_METHOD1(SetDelegate, void(content::DownloadManagerDelegate*)); | 114 MOCK_METHOD1(SetDelegate, void(content::DownloadManagerDelegate*)); |
115 MOCK_CONST_METHOD0(GetDelegate, content::DownloadManagerDelegate*()); | 115 MOCK_CONST_METHOD0(GetDelegate, content::DownloadManagerDelegate*()); |
116 MOCK_METHOD0(Shutdown, void()); | 116 MOCK_METHOD0(Shutdown, void()); |
117 MOCK_METHOD1(GetAllDownloads, void(DownloadVector*)); | 117 MOCK_METHOD1(GetAllDownloads, void(DownloadVector*)); |
118 MOCK_METHOD3(RemoveDownloadsByOriginAndTime, | 118 MOCK_METHOD3(RemoveDownloadsByURLAndTime, |
119 int(const url::Origin&, base::Time, base::Time)); | 119 int(const base::Callback<bool(const GURL&)>& url_filter, |
| 120 base::Time, |
| 121 base::Time)); |
120 MOCK_METHOD2(RemoveDownloadsBetween, int(base::Time, base::Time)); | 122 MOCK_METHOD2(RemoveDownloadsBetween, int(base::Time, base::Time)); |
121 MOCK_METHOD1(RemoveDownloads, int(base::Time)); | 123 MOCK_METHOD1(RemoveDownloads, int(base::Time)); |
122 MOCK_METHOD0(RemoveAllDownloads, int()); | 124 MOCK_METHOD0(RemoveAllDownloads, int()); |
123 void DownloadUrl(scoped_ptr<content::DownloadUrlParameters>) override {} | 125 void DownloadUrl(scoped_ptr<content::DownloadUrlParameters>) override {} |
124 MOCK_METHOD1(AddObserver, void(content::DownloadManager::Observer*)); | 126 MOCK_METHOD1(AddObserver, void(content::DownloadManager::Observer*)); |
125 MOCK_METHOD1(RemoveObserver, void(content::DownloadManager::Observer*)); | 127 MOCK_METHOD1(RemoveObserver, void(content::DownloadManager::Observer*)); |
126 MOCK_CONST_METHOD0(InProgressCount, int()); | 128 MOCK_CONST_METHOD0(InProgressCount, int()); |
127 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); | 129 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); |
128 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); | 130 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); |
129 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); | 131 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 StartDownload(1); | 215 StartDownload(1); |
214 EXPECT_TRUE(success_); | 216 EXPECT_TRUE(success_); |
215 } | 217 } |
216 | 218 |
217 // Test that resumption fails if the target download item is not resumable. | 219 // Test that resumption fails if the target download item is not resumable. |
218 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) { | 220 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) { |
219 CreateDownloadItem(false); | 221 CreateDownloadItem(false); |
220 StartDownload(1); | 222 StartDownload(1); |
221 EXPECT_FALSE(success_); | 223 EXPECT_FALSE(success_); |
222 } | 224 } |
OLD | NEW |