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

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

Issue 23625015: Consolidate TestURLFetcherFactory::SetFakeResponse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index 473dc5348dfdb212a1c46065a7802e2c29237a93..369382755eac75bf6c93cbadac4e9be26bc9e4b3 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -660,7 +660,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
VLOG(2) << "Sending a request for URL: "
<< item_->GetUrlChain().back();
fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */,
- GURL(GetDownloadRequestUrl()),
+ GetDownloadRequestUrl(),
net::URLFetcher::POST,
this));
fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
@@ -967,13 +967,12 @@ void DownloadProtectionService::GetCertificateWhitelistStrings(
}
// static
-std::string DownloadProtectionService::GetDownloadRequestUrl() {
- std::string url = kDownloadRequestUrl;
+GURL DownloadProtectionService::GetDownloadRequestUrl() {
+ GURL url(kDownloadRequestUrl);
std::string api_key = google_apis::GetAPIKey();
- if (!api_key.empty()) {
- base::StringAppendF(&url, "?key=%s",
- net::EscapeQueryParamValue(api_key, true).c_str());
- }
+ if (!api_key.empty())
+ url = url.Resolve("?key=%s" + net::EscapeQueryParamValue(api_key, true));
mattm 2013/09/23 21:37:00 remove %s
Mattias Nissler (ping if slow) 2013/09/24 08:53:29 Done.
akalin 2013/09/25 21:35:38 did tests catch this? if not, that's worrisome :/
Mattias Nissler (ping if slow) 2013/09/26 08:48:10 AFAICS, they didn't.
+
return url;
}

Powered by Google App Engine
This is Rietveld 408576698