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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate_unittest.cc

Issue 12313141: Use DownloadItem directly in DownloadProtectionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/chrome_download_manager_delegate_unittest.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
index 6ad0579573d98165fd2b8b9d6e8f32ba37e6e66d..36e813d29780bf96fce71b5246684b3ce4fbf389 100644
--- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -32,6 +32,7 @@
using ::testing::AtMost;
using ::testing::Invoke;
+using ::testing::Ref;
using ::testing::Return;
using ::testing::ReturnPointee;
using ::testing::ReturnRef;
@@ -65,14 +66,6 @@ ACTION_P(ScheduleCallback, result) {
MessageLoop::current()->PostTask(FROM_HERE, base::Bind(arg0, result));
}
-// Matches a safe_browsing::DownloadProtectionService::DownloadInfo that has
-// |url| as the first URL in the |download_url_chain|.
-// Example:
-// EXPECT_CALL(Foo(InfoMatchinURL(url)))
-MATCHER_P(InfoMatchingURL, url, "DownloadInfo matching URL " + url.spec()) {
- return url == arg.download_url_chain.front();
-}
-
// Used with DownloadTestCase. Indicates the type of test case. The expectations
// for the test is set based on the type.
enum TestCaseType {
@@ -145,13 +138,14 @@ class TestDownloadProtectionService
TestDownloadProtectionService()
: safe_browsing::DownloadProtectionService(NULL, NULL) {}
MOCK_METHOD2(CheckClientDownload,
- void(const DownloadProtectionService::DownloadInfo&,
+ void(content::DownloadItem*,
const DownloadProtectionService::CheckDownloadCallback&));
MOCK_METHOD2(CheckDownloadUrl,
- void(const DownloadProtectionService::DownloadInfo&,
+ void(const content::DownloadItem&,
const DownloadProtectionService::CheckDownloadCallback&));
- MOCK_CONST_METHOD1(IsSupportedDownload,
- bool(const DownloadProtectionService::DownloadInfo&));
+ MOCK_CONST_METHOD2(IsSupportedDownload,
+ bool(const content::DownloadItem&,
+ const base::FilePath&));
};
#endif
@@ -404,7 +398,7 @@ void ChromeDownloadManagerDelegateTest::RunTestCaseWithDownloadItem(
DownloadProtectionService::DANGEROUS :
DownloadProtectionService::SAFE;
EXPECT_CALL(*delegate_->test_download_protection_service(),
- CheckDownloadUrl(InfoMatchingURL(download_url), _))
+ CheckDownloadUrl(Ref(*item), _))
.WillOnce(WithArg<1>(ScheduleCallback(url_check_result)));
// Downloads that are flagged as DANGEROUS_URL aren't checked for dangerous
@@ -414,7 +408,7 @@ void ChromeDownloadManagerDelegateTest::RunTestCaseWithDownloadItem(
(test_case.danger_type ==
content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT);
EXPECT_CALL(*delegate_->test_download_protection_service(),
- IsSupportedDownload(InfoMatchingURL(download_url)))
+ IsSupportedDownload(Ref(*item), _))
.WillOnce(Return(maybe_dangerous));
}
#else // FULL_SAFE_BROWSING
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | chrome/browser/download/download_shelf_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698