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

Unified Diff: chrome/browser/safe_browsing/client_side_detection_host_unittest.cc

Issue 351553004: Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/safe_browsing/client_side_detection_host_unittest.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index b095af20e53e26c3bb048506923529a83a556976..cc60e17d3847a72ac54ed79809c057c56f3fe484 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -91,12 +91,10 @@ ACTION(QuitUIMessageLoop) {
base::MessageLoopForUI::current()->Quit();
}
-// It's kind of insane that InvokeArgument doesn't work with callbacks, but it
-// doesn't seem like it.
-ACTION_TEMPLATE(InvokeCallbackArgument,
- HAS_1_TEMPLATE_PARAMS(int, k),
- AND_2_VALUE_PARAMS(p0, p1)) {
- ::std::tr1::get<k>(args).Run(p0, p1);
+ACTION_P(InvokeDoneCallback, verdict) {
+ scoped_ptr<ClientPhishingRequest> request(::std::tr1::get<1>(args));
+ request->CopyFrom(*verdict);
+ ::std::tr1::get<2>(args).Run(true, request.Pass());
}
ACTION_P(InvokeMalwareCallback, verdict) {
@@ -482,8 +480,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneNotPhishing) {
verdict.set_is_phishing(true);
EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _))
- .WillOnce(DoAll(DeleteArg<1>(),
- InvokeCallbackArgument<2>(true, &verdict)));
+ .WillOnce(InvokeDoneCallback(&verdict));
EXPECT_CALL(*csd_service_,
SendClientReportPhishingRequest(
Pointee(PartiallyEqualVerdict(verdict)), _))
@@ -515,8 +512,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneDisabled) {
verdict.set_is_phishing(true);
EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _))
- .WillOnce(DoAll(DeleteArg<1>(),
- InvokeCallbackArgument<2>(true, &verdict)));
+ .WillOnce(InvokeDoneCallback(&verdict));
EXPECT_CALL(*csd_service_,
SendClientReportPhishingRequest(
Pointee(PartiallyEqualVerdict(verdict)), _))
@@ -549,8 +545,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneShowInterstitial) {
verdict.set_is_phishing(true);
EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _))
- .WillOnce(DoAll(DeleteArg<1>(),
- InvokeCallbackArgument<2>(true, &verdict)));
+ .WillOnce(InvokeDoneCallback(&verdict));
EXPECT_CALL(*csd_service_,
SendClientReportPhishingRequest(
Pointee(PartiallyEqualVerdict(verdict)), _))
@@ -604,8 +599,7 @@ TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneMultiplePings) {
verdict.set_is_phishing(true);
EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _))
- .WillOnce(DoAll(DeleteArg<1>(),
- InvokeCallbackArgument<2>(true, &verdict)));
+ .WillOnce(InvokeDoneCallback(&verdict));
EXPECT_CALL(*csd_service_,
SendClientReportPhishingRequest(
Pointee(PartiallyEqualVerdict(verdict)), _))

Powered by Google App Engine
This is Rietveld 408576698