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

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

Issue 23625015: Consolidate TestURLFetcherFactory::SetFakeResponse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Could have spelled it Cloud... Created 7 years, 3 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_service.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index 543779f253ca69f911e90b929bff7600ee99f16c..f61a6175d0f89577f73614f94d178ca7b4aa8979 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -367,7 +367,7 @@ void ClientSideDetectionService::StartClientReportPhishingRequest(
net::URLFetcher* fetcher = net::URLFetcher::Create(
0 /* ID used for testing */,
- GURL(GetClientReportUrl(kClientReportPhishingUrl)),
+ GetClientReportUrl(kClientReportPhishingUrl),
net::URLFetcher::POST, this);
// Remember which callback and URL correspond to the current fetcher object.
@@ -417,7 +417,7 @@ void ClientSideDetectionService::StartClientReportMalwareRequest(
net::URLFetcher* fetcher = net::URLFetcher::Create(
0 /* ID used for testing */,
- GURL(GetClientReportUrl(kClientReportMalwareUrl)),
+ GetClientReportUrl(kClientReportMalwareUrl),
net::URLFetcher::POST, this);
// Remember which callback and URL correspond to the current fetcher object.
@@ -706,13 +706,13 @@ bool ClientSideDetectionService::ModelHasValidHashIds(
}
// static
-std::string ClientSideDetectionService::GetClientReportUrl(
+GURL ClientSideDetectionService::GetClientReportUrl(
const std::string& report_url) {
- std::string url = report_url;
+ GURL url(report_url);
std::string api_key = google_apis::GetAPIKey();
if (!api_key.empty()) {
- base::StringAppendF(&url, "?key=%s",
- net::EscapeQueryParamValue(api_key, true).c_str());
+ url = url.Resolve(base::StringPrintf(
+ "?key=%s", net::EscapeQueryParamValue(api_key, true).c_str()));
akalin 2013/09/19 18:54:00 nit -- no need for StringPrintf, can just do "?key
Mattias Nissler (ping if slow) 2013/09/20 15:33:53 Done.
}
return url;
}

Powered by Google App Engine
This is Rietveld 408576698