Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/android/download/download_manager_service_unittest.cc

Issue 1603903002: Add an OriginFilterBuilder class for [white|black]listing origins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "content/public/browser/download_item.h" 12 #include "content/public/browser/download_item.h"
13 #include "content/public/browser/download_manager.h" 13 #include "content/public/browser/download_manager.h"
14 #include "content/public/browser/download_url_parameters.h" 14 #include "content/public/browser/download_url_parameters.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "url/origin.h" 17 #include "url/origin.h"
18 #include "url/origin_filter.h"
18 19
19 using ::testing::_; 20 using ::testing::_;
20 21
21 namespace content { 22 namespace content {
22 class BrowserContext; 23 class BrowserContext;
23 class ByteStreamReader; 24 class ByteStreamReader;
24 class DownloadManagerDelegate; 25 class DownloadManagerDelegate;
25 struct DownloadCreateInfo; 26 struct DownloadCreateInfo;
26 } 27 }
27 28
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 class MockDownloadManager : public content::DownloadManager { 110 class MockDownloadManager : public content::DownloadManager {
110 public: 111 public:
111 MockDownloadManager() {} 112 MockDownloadManager() {}
112 ~MockDownloadManager() override {} 113 ~MockDownloadManager() override {}
113 114
114 MOCK_METHOD1(SetDelegate, void(content::DownloadManagerDelegate*)); 115 MOCK_METHOD1(SetDelegate, void(content::DownloadManagerDelegate*));
115 MOCK_CONST_METHOD0(GetDelegate, content::DownloadManagerDelegate*()); 116 MOCK_CONST_METHOD0(GetDelegate, content::DownloadManagerDelegate*());
116 MOCK_METHOD0(Shutdown, void()); 117 MOCK_METHOD0(Shutdown, void());
117 MOCK_METHOD1(GetAllDownloads, void(DownloadVector*)); 118 MOCK_METHOD1(GetAllDownloads, void(DownloadVector*));
118 MOCK_METHOD3(RemoveDownloadsByOriginAndTime, 119 MOCK_METHOD3(RemoveDownloadsByOriginAndTime,
119 int(const url::Origin&, base::Time, base::Time)); 120 int(const url::OriginFilter* origins, base::Time, base::Time));
120 MOCK_METHOD2(RemoveDownloadsBetween, int(base::Time, base::Time)); 121 MOCK_METHOD2(RemoveDownloadsBetween, int(base::Time, base::Time));
121 MOCK_METHOD1(RemoveDownloads, int(base::Time)); 122 MOCK_METHOD1(RemoveDownloads, int(base::Time));
122 MOCK_METHOD0(RemoveAllDownloads, int()); 123 MOCK_METHOD0(RemoveAllDownloads, int());
123 void DownloadUrl(scoped_ptr<content::DownloadUrlParameters>) override {} 124 void DownloadUrl(scoped_ptr<content::DownloadUrlParameters>) override {}
124 MOCK_METHOD1(AddObserver, void(content::DownloadManager::Observer*)); 125 MOCK_METHOD1(AddObserver, void(content::DownloadManager::Observer*));
125 MOCK_METHOD1(RemoveObserver, void(content::DownloadManager::Observer*)); 126 MOCK_METHOD1(RemoveObserver, void(content::DownloadManager::Observer*));
126 MOCK_CONST_METHOD0(InProgressCount, int()); 127 MOCK_CONST_METHOD0(InProgressCount, int());
127 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int()); 128 MOCK_CONST_METHOD0(NonMaliciousInProgressCount, int());
128 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); 129 MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*());
129 MOCK_METHOD0(CheckForHistoryFilesRemoval, void()); 130 MOCK_METHOD0(CheckForHistoryFilesRemoval, void());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 StartDownload(1); 214 StartDownload(1);
214 EXPECT_TRUE(success_); 215 EXPECT_TRUE(success_);
215 } 216 }
216 217
217 // Test that resumption fails if the target download item is not resumable. 218 // Test that resumption fails if the target download item is not resumable.
218 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) { 219 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) {
219 CreateDownloadItem(false); 220 CreateDownloadItem(false);
220 StartDownload(1); 221 StartDownload(1);
221 EXPECT_FALSE(success_); 222 EXPECT_FALSE(success_);
222 } 223 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | url/origin_filter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698