summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/eula_browsertest.cc7
-rw-r--r--chrome/browser/chromeos/policy/cloud_external_data_manager_base.h2
-rw-r--r--chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc81
-rw-r--r--chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc11
-rw-r--r--chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc6
-rw-r--r--chrome/browser/profile_resetter/profile_resetter_unittest.cc5
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.cc15
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.h4
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service_unittest.cc4
-rw-r--r--chrome/browser/safe_browsing/download_protection_service.cc13
-rw-r--r--chrome/browser/safe_browsing/download_protection_service.h2
-rw-r--r--chrome/browser/signin/signin_browsertest.cc6
-rw-r--r--chrome/browser/sync/test/integration/sync_test.cc14
-rw-r--r--chrome/browser/ui/search/instant_extended_interactive_uitest.cc6
-rw-r--r--chrome/service/cloud_print/printer_job_handler_unittest.cc78
-rw-r--r--net/url_request/test_url_fetcher_factory.cc8
-rw-r--r--net/url_request/test_url_fetcher_factory.h8
-rw-r--r--remoting/host/token_validator_factory_impl_unittest.cc9
18 files changed, 139 insertions, 140 deletions
diff --git a/chrome/browser/chromeos/login/eula_browsertest.cc b/chrome/browser/chromeos/login/eula_browsertest.cc
index 11a8cd4d..412ddb5 100644
--- a/chrome/browser/chromeos/login/eula_browsertest.cc
+++ b/chrome/browser/chromeos/login/eula_browsertest.cc
@@ -19,7 +19,8 @@ using ::testing::_;
namespace {
-const char kEULAURL[] = "https://www.google.com/intl/en-US/chrome/eula_text.html";
+const char kEULAURL[] =
+ "https://www.google.com/intl/en-US/chrome/eula_text.html";
const char kFakeOnlineEULA[] = "No obligations at all";
const char kOfflineEULAWarning[] = "A copy of the Google Terms of Service";
@@ -56,7 +57,7 @@ IN_PROC_BROWSER_TEST_F(TermsOfServiceProcessBrowserTest, LoadOnline) {
NULL,
base::Bind(&TestURLFetcherCallback::CreateURLFetcher,
base::Unretained(&url_callback)));
- factory.SetFakeResponse(kEULAURL, kFakeOnlineEULA, true);
+ factory.SetFakeResponse(GURL(kEULAURL), kFakeOnlineEULA, true);
EXPECT_CALL(url_callback, OnRequestCreate(GURL(kEULAURL), _))
.Times(Exactly(1))
.WillRepeatedly(Invoke(AddMimeHeader));
@@ -76,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(TermsOfServiceProcessBrowserTest, LoadOnline) {
// Make sure offline version is shown.
IN_PROC_BROWSER_TEST_F(TermsOfServiceProcessBrowserTest, LoadOffline) {
net::FakeURLFetcherFactory factory(NULL);
- factory.SetFakeResponse(kEULAURL, "", false);
+ factory.SetFakeResponse(GURL(kEULAURL), "", false);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUITermsURL));
content::WebContents* web_contents =
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_manager_base.h b/chrome/browser/chromeos/policy/cloud_external_data_manager_base.h
index 6db8bc2..f07299f 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_manager_base.h
+++ b/chrome/browser/chromeos/policy/cloud_external_data_manager_base.h
@@ -64,7 +64,7 @@ class CloudExternalDataManagerBase : public CloudExternalDataManager,
static void SetMaxExternalDataSizeForTesting(int max_size);
protected:
- friend class CouldExternalDataManagerBaseTest;
+ friend class CloudExternalDataManagerBaseTest;
// Try to download and cache all external data referenced by policies in
// |policy_store_|.
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
index 8112633..acfd274f 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
+++ b/chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc
@@ -102,9 +102,9 @@ net::URLFetcher* FakeURLFetcherFactory::CreateURLFetcher(
} // namespace
-class CouldExternalDataManagerBaseTest : public testing::Test {
+class CloudExternalDataManagerBaseTest : public testing::Test {
protected:
- CouldExternalDataManagerBaseTest();
+ CloudExternalDataManagerBaseTest();
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
@@ -123,6 +123,10 @@ class CouldExternalDataManagerBaseTest : public testing::Test {
void FetchAll();
+ void SetFakeResponse(const std::string& url,
+ const std::string& repsonse_data,
+ bool success);
+
base::MessageLoop message_loop_;
base::ScopedTempDir temp_dir_;
scoped_ptr<ResourceCache> resource_cache_;
@@ -134,13 +138,13 @@ class CouldExternalDataManagerBaseTest : public testing::Test {
std::map<int, std::string*> callback_data_;
- DISALLOW_COPY_AND_ASSIGN(CouldExternalDataManagerBaseTest);
+ DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManagerBaseTest);
};
-CouldExternalDataManagerBaseTest::CouldExternalDataManagerBaseTest() {
+CloudExternalDataManagerBaseTest::CloudExternalDataManagerBaseTest() {
}
-void CouldExternalDataManagerBaseTest::SetUp() {
+void CloudExternalDataManagerBaseTest::SetUp() {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
resource_cache_.reset(new ResourceCache(temp_dir_.path(),
message_loop_.message_loop_proxy()));
@@ -166,13 +170,13 @@ void CouldExternalDataManagerBaseTest::SetUp() {
base::MessageLoopProxy::current());
}
-void CouldExternalDataManagerBaseTest::TearDown() {
+void CloudExternalDataManagerBaseTest::TearDown() {
external_data_manager_.reset();
base::RunLoop().RunUntilIdle();
ResetCallbackData();
}
-void CouldExternalDataManagerBaseTest::SetUpExternalDataManager() {
+void CloudExternalDataManagerBaseTest::SetUpExternalDataManager() {
external_data_manager_.reset(new CloudExternalDataManagerBase(
&kPolicyDefinitionList,
message_loop_.message_loop_proxy(),
@@ -185,7 +189,7 @@ void CouldExternalDataManagerBaseTest::SetUpExternalDataManager() {
}
scoped_ptr<base::DictionaryValue>
- CouldExternalDataManagerBaseTest::ConstructMetadata(
+ CloudExternalDataManagerBaseTest::ConstructMetadata(
const std::string& url,
const std::string& hash) {
scoped_ptr<base::DictionaryValue> metadata(new base::DictionaryValue);
@@ -195,7 +199,7 @@ scoped_ptr<base::DictionaryValue>
return metadata.Pass();
}
-void CouldExternalDataManagerBaseTest::SetExternalDataReference(
+void CloudExternalDataManagerBaseTest::SetExternalDataReference(
const std::string& policy,
scoped_ptr<base::DictionaryValue> metadata) {
cloud_policy_store_.policy_map_.Set(
@@ -208,30 +212,37 @@ void CouldExternalDataManagerBaseTest::SetExternalDataReference(
}
ExternalDataFetcher::FetchCallback
-CouldExternalDataManagerBaseTest::ConstructFetchCallback(int id) {
- return base::Bind(&CouldExternalDataManagerBaseTest::OnFetchDone,
+CloudExternalDataManagerBaseTest::ConstructFetchCallback(int id) {
+ return base::Bind(&CloudExternalDataManagerBaseTest::OnFetchDone,
base::Unretained(this),
id);
}
-void CouldExternalDataManagerBaseTest::ResetCallbackData() {
+void CloudExternalDataManagerBaseTest::ResetCallbackData() {
STLDeleteValues(&callback_data_);
}
-void CouldExternalDataManagerBaseTest::OnFetchDone(
+void CloudExternalDataManagerBaseTest::OnFetchDone(
int id,
scoped_ptr<std::string> data) {
delete callback_data_[id];
callback_data_[id] = data.release();
}
-void CouldExternalDataManagerBaseTest::FetchAll() {
+void CloudExternalDataManagerBaseTest::FetchAll() {
external_data_manager_->FetchAll();
}
+void CloudExternalDataManagerBaseTest::SetFakeResponse(
+ const std::string& url,
+ const std::string& response_data,
+ bool success) {
+ fetcher_factory_.SetFakeResponse(GURL(url), response_data, success);
+}
+
// Verifies that when no valid external data reference has been set for a
// policy, the attempt to retrieve the external data fails immediately.
-TEST_F(CouldExternalDataManagerBaseTest, FailToFetchInvalid) {
+TEST_F(CloudExternalDataManagerBaseTest, FailToFetchInvalid) {
external_data_manager_->Connect(request_content_getter_);
// Attempt to retrieve external data for |kStringPolicy|, which is a string
@@ -270,9 +281,9 @@ TEST_F(CouldExternalDataManagerBaseTest, FailToFetchInvalid) {
// Verifies that external data referenced by a policy is downloaded and cached
// when first requested. Subsequent requests are served from the cache without
// further download attempts.
-TEST_F(CouldExternalDataManagerBaseTest, DownloadAndCache) {
+TEST_F(CloudExternalDataManagerBaseTest, DownloadAndCache) {
// Serve valid external data for |k10BytePolicy|.
- fetcher_factory_.SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
external_data_manager_->Connect(request_content_getter_);
// Retrieve external data for |k10BytePolicy|. Verify that a download happens
@@ -325,10 +336,10 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadAndCache) {
// Verifies that a request to download and cache all external data referenced by
// policies is carried out correctly. Subsequent requests for the data are
// served from the cache without further download attempts.
-TEST_F(CouldExternalDataManagerBaseTest, DownloadAndCacheAll) {
+TEST_F(CloudExternalDataManagerBaseTest, DownloadAndCacheAll) {
// Serve valid external data for |k10BytePolicy| and |k20BytePolicy|.
- fetcher_factory_.SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, k20ByteData, true);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
+ SetFakeResponse(k20BytePolicyURL, k20ByteData, true);
external_data_manager_->Connect(request_content_getter_);
// Request that external data referenced by all policies be downloaded.
@@ -386,7 +397,7 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadAndCacheAll) {
// Verifies that when the external data referenced by a policy is not present in
// the cache and downloads are not allowed, a request to retrieve the data is
// enqueued and carried out when downloads become possible.
-TEST_F(CouldExternalDataManagerBaseTest, DownloadAfterConnect) {
+TEST_F(CloudExternalDataManagerBaseTest, DownloadAfterConnect) {
// Attempt to retrieve external data for |k10BytePolicy|. Verify that the
// callback is not invoked as the request remains pending.
external_data_manager_->Fetch(k10BytePolicy, ConstructFetchCallback(0));
@@ -396,7 +407,7 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadAfterConnect) {
// Serve valid external data for |k10BytePolicy| and allow the
// external_data_manager_ to perform downloads.
- fetcher_factory_.SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, true);
external_data_manager_->Connect(request_content_getter_);
// Verify that a download happens and the callback is invoked with the
@@ -411,10 +422,10 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadAfterConnect) {
// Verifies that when the external data referenced by a policy is not present in
// the cache and cannot be downloaded at this time, a request to retrieve the
// data is enqueued to be retried later.
-TEST_F(CouldExternalDataManagerBaseTest, DownloadError) {
+TEST_F(CloudExternalDataManagerBaseTest, DownloadError) {
// Make attempts to download the external data for |k20BytePolicy| fail with
// an error.
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, std::string(), false);
+ SetFakeResponse(k20BytePolicyURL, std::string(), false);
external_data_manager_->Connect(request_content_getter_);
// Attempt to retrieve external data for |k20BytePolicy|. Verify that the
@@ -449,7 +460,7 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadError) {
// Serve external data for |k20BytePolicy| that does not match the hash
// specified in its current external data reference.
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, k10ByteData, true);
+ SetFakeResponse(k20BytePolicyURL, k10ByteData, true);
// Attempt to retrieve external data for |k20BytePolicy| again. Verify that
// no callback is invoked still as the downloaded succeeds but returns data
@@ -487,7 +498,7 @@ TEST_F(CouldExternalDataManagerBaseTest, DownloadError) {
// Verifies that when the external data referenced by a policy is present in the
// cache, a request to retrieve it is served from the cache without any download
// attempts.
-TEST_F(CouldExternalDataManagerBaseTest, LoadFromCache) {
+TEST_F(CloudExternalDataManagerBaseTest, LoadFromCache) {
// Store valid external data for |k10BytePolicy| in the cache.
external_data_manager_.reset();
base::RunLoop().RunUntilIdle();
@@ -513,7 +524,7 @@ TEST_F(CouldExternalDataManagerBaseTest, LoadFromCache) {
// Verifies that cache entries which do not correspond to the external data
// referenced by any policy are pruned on startup.
-TEST_F(CouldExternalDataManagerBaseTest, PruneCacheOnStartup) {
+TEST_F(CloudExternalDataManagerBaseTest, PruneCacheOnStartup) {
external_data_manager_.reset();
base::RunLoop().RunUntilIdle();
scoped_ptr<CloudExternalDataStore>
@@ -560,7 +571,7 @@ TEST_F(CouldExternalDataManagerBaseTest, PruneCacheOnStartup) {
// Verifies that when the external data referenced by a policy is present in the
// cache and the reference changes, the old data is pruned from the cache.
-TEST_F(CouldExternalDataManagerBaseTest, PruneCacheOnChange) {
+TEST_F(CloudExternalDataManagerBaseTest, PruneCacheOnChange) {
// Store valid external data for |k20BytePolicy| in the cache.
external_data_manager_.reset();
base::RunLoop().RunUntilIdle();
@@ -596,7 +607,7 @@ TEST_F(CouldExternalDataManagerBaseTest, PruneCacheOnChange) {
}
// Verifies that corrupt cache entries are detected and deleted when accessed.
-TEST_F(CouldExternalDataManagerBaseTest, CacheCorruption) {
+TEST_F(CloudExternalDataManagerBaseTest, CacheCorruption) {
external_data_manager_.reset();
base::RunLoop().RunUntilIdle();
scoped_ptr<CloudExternalDataStore>
@@ -618,7 +629,7 @@ TEST_F(CouldExternalDataManagerBaseTest, CacheCorruption) {
SetUpExternalDataManager();
// Serve external data for |k10BytePolicy| that exceeds the maximal external
// data size allowed for that policy.
- fetcher_factory_.SetFakeResponse(k10BytePolicyURL, k20ByteData, true);
+ SetFakeResponse(k10BytePolicyURL, k20ByteData, true);
external_data_manager_->Connect(request_content_getter_);
// Modify the external data reference for |k10BytePolicy| to match the
@@ -637,7 +648,7 @@ TEST_F(CouldExternalDataManagerBaseTest, CacheCorruption) {
ResetCallbackData();
// Serve valid external data for |k20BytePolicy|.
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, k20ByteData, true);
+ SetFakeResponse(k20BytePolicyURL, k20ByteData, true);
// Retrieve external data for |k20BytePolicy|. Verify that the callback is
// invoked with the valid downloaded data, not the invalid data in the cache.
@@ -675,11 +686,11 @@ TEST_F(CouldExternalDataManagerBaseTest, CacheCorruption) {
// Verifies that when the external data reference for a policy changes while a
// download of the external data for that policy is pending, the download is
// immediately retried using the new reference.
-TEST_F(CouldExternalDataManagerBaseTest, PolicyChangeWhileDownloadPending) {
+TEST_F(CloudExternalDataManagerBaseTest, PolicyChangeWhileDownloadPending) {
// Make attempts to download the external data for |k10BytePolicy| and
// |k20BytePolicy| fail with an error.
- fetcher_factory_.SetFakeResponse(k10BytePolicyURL, std::string(), false);
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, std::string(), false);
+ SetFakeResponse(k10BytePolicyURL, std::string(), false);
+ SetFakeResponse(k20BytePolicyURL, std::string(), false);
external_data_manager_->Connect(request_content_getter_);
// Attempt to retrieve external data for |k10BytePolicy| and |k20BytePolicy|.
@@ -704,7 +715,7 @@ TEST_F(CouldExternalDataManagerBaseTest, PolicyChangeWhileDownloadPending) {
// Serve valid external data for |k20BytePolicy|.
fetcher_factory_.ClearFakeResponses();
- fetcher_factory_.SetFakeResponse(k20BytePolicyURL, k10ByteData, true);
+ SetFakeResponse(k20BytePolicyURL, k10ByteData, true);
// Modify the external data reference for |k20BytePolicy| to match the
// external data now being served. Verify that the callback is invoked with
diff --git a/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc b/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc
index 3309073..7136525 100644
--- a/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc
+++ b/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc
@@ -17,10 +17,11 @@
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+using testing::Mock;
using testing::NiceMock;
using testing::StrictMock;
-using testing::Mock;
namespace local_discovery {
@@ -102,10 +103,10 @@ class CloudPrintPrinterListTest : public testing::Test {
};
TEST_F(CloudPrintPrinterListTest, SuccessOAuth2) {
- fetcher_factory_->SetFakeResponse("http://SoMeUrL.com/cloudprint/search",
- kSampleSuccessResponseOAuth,
- true);
-
+ fetcher_factory_->SetFakeResponse(
+ GURL("http://SoMeUrL.com/cloudprint/search"),
+ kSampleSuccessResponseOAuth,
+ true);
CloudPrintBaseApiFlow* cloudprint_flow =
printer_list_->GetOAuth2ApiFlowForTests();
diff --git a/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc b/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc
index cd0caf1..afc8d61 100644
--- a/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc
+++ b/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc
@@ -104,7 +104,7 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
NotificationBitmapFetcher fetcher(url, &delegate);
- url_fetcher_factory_->SetFakeResponse(url.spec(), image_string, true);
+ url_fetcher_factory_->SetFakeResponse(url, image_string, true);
// We expect that the image decoder will get called and return
// an image in a callback to OnImageDecoded().
@@ -154,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
NotificationBitmapFetcher fetcher(url, &delegate);
- url_fetcher_factory_->SetFakeResponse(url.spec(), std::string(), false);
+ url_fetcher_factory_->SetFakeResponse(url, std::string(), false);
fetcher.Start(browser()->profile());
@@ -170,7 +170,7 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
NotificationBitmapFetcherTestDelegate delegate(kAsyncCall);
NotificationBitmapFetcher fetcher(url, &delegate);
url_fetcher_factory_->SetFakeResponse(
- url.spec(), std::string("Not a real bitmap"), true);
+ url, std::string("Not a real bitmap"), true);
fetcher.Start(browser()->profile());
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index f72b5f7..45db01f 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -29,6 +29,7 @@
#include "extensions/common/manifest_constants.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "url/gurl.h"
namespace {
@@ -649,7 +650,7 @@ TEST_F(ProfileResetterTest, ResetFewFlags) {
// Tries to load unavailable config file.
TEST_F(ConfigParserTest, NoConnectivity) {
- const std::string url("http://test");
+ const GURL url("http://test");
factory().SetFakeResponse(url, "", false);
scoped_ptr<BrandcodeConfigFetcher> fetcher = WaitForRequest(GURL(url));
@@ -658,7 +659,7 @@ TEST_F(ConfigParserTest, NoConnectivity) {
// Tries to load available config file.
TEST_F(ConfigParserTest, ParseConfig) {
- const std::string url("http://test");
+ const GURL url("http://test");
std::string xml_config(kXmlConfig);
ReplaceString(&xml_config, "placeholder_for_data", kDistributionConfig);
ReplaceString(&xml_config,
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index 543779f..46d0145 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,14 +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());
- }
+ if (!api_key.empty())
+ url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
+
return url;
}
} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h
index e442de6..cbb1a97 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.h
+++ b/chrome/browser/safe_browsing/client_side_detection_service.h
@@ -286,7 +286,7 @@ class ClientSideDetectionService : public net::URLFetcherDelegate,
static bool ModelHasValidHashIds(const ClientSideModel& model);
// Returns the URL that will be used for phishing requests.
- static std::string GetClientReportUrl(const std::string& report_url);
+ static GURL GetClientReportUrl(const std::string& report_url);
// Whether the service is running or not. When the service is not running,
// it won't download the model nor report detected phishing URLs.
@@ -343,6 +343,6 @@ class ClientSideDetectionService : public net::URLFetcherDelegate,
DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
};
-} // namepsace safe_browsing
+} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
index 70a18ed..e32dcc4 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -23,10 +23,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
-using ::testing::_;
using ::testing::Invoke;
using ::testing::Mock;
using ::testing::StrictMock;
+using ::testing::_;
using content::BrowserThread;
namespace safe_browsing {
@@ -106,7 +106,7 @@ class ClientSideDetectionServiceTest : public testing::Test {
}
void SetModelFetchResponse(std::string response_data, bool success) {
- factory_->SetFakeResponse(ClientSideDetectionService::kClientModelUrl,
+ factory_->SetFakeResponse(GURL(ClientSideDetectionService::kClientModelUrl),
response_data, success);
}
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index 473dc53..37370dc 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=" + net::EscapeQueryParamValue(api_key, true));
+
return url;
}
diff --git a/chrome/browser/safe_browsing/download_protection_service.h b/chrome/browser/safe_browsing/download_protection_service.h
index 0b61b6d..4d334a6 100644
--- a/chrome/browser/safe_browsing/download_protection_service.h
+++ b/chrome/browser/safe_browsing/download_protection_service.h
@@ -171,7 +171,7 @@ class DownloadProtectionService {
std::vector<std::string>* whitelist_strings);
// Returns the URL that will be used for download requests.
- static std::string GetDownloadRequestUrl();
+ static GURL GetDownloadRequestUrl();
// These pointers may be NULL if SafeBrowsing is disabled.
scoped_refptr<SafeBrowsingUIManager> ui_manager_;
diff --git a/chrome/browser/signin/signin_browsertest.cc b/chrome/browser/signin/signin_browsertest.cc
index e9cbfda..d3031c0 100644
--- a/chrome/browser/signin/signin_browsertest.cc
+++ b/chrome/browser/signin/signin_browsertest.cc
@@ -28,7 +28,7 @@
#include "net/url_request/test_url_fetcher_factory.h"
namespace {
- const char kNonSigninURL[] = "www.google.com";
+const char kNonSigninURL[] = "www.google.com";
}
class SigninBrowserTest : public InProcessBrowserTest {
@@ -53,11 +53,11 @@ class SigninBrowserTest : public InProcessBrowserTest {
virtual void SetUp() OVERRIDE {
factory_.reset(new net::URLFetcherImplFactory());
fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get()));
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->service_login_url(),
std::string(),
true);
- fake_factory_->SetFakeResponse(kNonSigninURL, std::string(), true);
+ fake_factory_->SetFakeResponse(GURL(kNonSigninURL), std::string(), true);
// Yield control back to the InProcessBrowserTest framework.
InProcessBrowserTest::SetUp();
}
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index c1d8deb..212ea59 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -426,27 +426,27 @@ void SyncTest::SetupMockGaiaResponses() {
password_ = "password";
factory_.reset(new net::URLFetcherImplFactory());
fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get()));
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->client_login_url(),
"SID=sid\nLSID=lsid",
true);
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->get_user_info_url(),
"email=user@gmail.com\ndisplayEmail=user@gmail.com",
true);
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->issue_auth_token_url(),
"auth",
true);
fake_factory_->SetFakeResponse(
- GoogleURLTracker::kSearchDomainCheckURL,
+ GURL(GoogleURLTracker::kSearchDomainCheckURL),
".google.com",
true);
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->client_login_to_oauth2_url(),
"some_response",
true);
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->oauth2_token_url(),
"{"
" \"refresh_token\": \"rt1\","
@@ -455,7 +455,7 @@ void SyncTest::SetupMockGaiaResponses() {
" \"token_type\": \"Bearer\""
"}",
true);
- fake_factory_->SetFakeResponseForURL(
+ fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->oauth1_login_url(),
"SID=sid\nLSID=lsid\nAuth=auth_token",
true);
diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
index a1142c5..31aacb7 100644
--- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
+++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
@@ -512,7 +512,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest,
content::WindowedNotificationObserver observer_2(
chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
content::NotificationService::AllSources());
- SetOmniboxText(instant_url().spec() + "#q=puppies");
+ SetOmniboxText(instant_url().Resolve("#q=puppies").spec());
PressEnterAndWaitForNavigation();
observer_2.Wait();
@@ -918,7 +918,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, SetPrefetchQuery) {
// Set the fake response for suggest request. Response has prefetch details.
// Ensure that the page received the prefetch query.
fake_factory()->SetFakeResponse(
- instant_url().spec() + "#q=pupp",
+ instant_url().Resolve("#q=pupp"),
"[\"pupp\",[\"puppy\", \"puppies\"],[],[],"
"{\"google:clientdata\":{\"phi\": 0},"
"\"google:suggesttype\":[\"QUERY\", \"QUERY\"],"
@@ -964,7 +964,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, ClearPrefetchedResults) {
// details. Ensure that the page received a blank query to clear the
// prefetched results.
fake_factory()->SetFakeResponse(
- instant_url().spec() + "#q=dogs",
+ instant_url().Resolve("#q=dogs"),
"[\"dogs\",[\"https://dogs.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[2]}]",
diff --git a/chrome/service/cloud_print/printer_job_handler_unittest.cc b/chrome/service/cloud_print/printer_job_handler_unittest.cc
index a41b3e8..20f8027 100644
--- a/chrome/service/cloud_print/printer_job_handler_unittest.cc
+++ b/chrome/service/cloud_print/printer_job_handler_unittest.cc
@@ -22,17 +22,17 @@
#include "testing/gtest/include/gtest/gtest.h"
using ::testing::AtLeast;
+using ::testing::DoAll;
using ::testing::Exactly;
-using ::testing::Sequence;
+using ::testing::Invoke;
+using ::testing::InvokeWithoutArgs;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::SaveArg;
-using ::testing::DoAll;
-using ::testing::_;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Invoke;
+using ::testing::Sequence;
using ::testing::SetArgPointee;
-using ::testing::InvokeWithoutArgs;
+using ::testing::StrictMock;
+using ::testing::_;
namespace cloud_print {
@@ -203,36 +203,35 @@ std::string JobListResponse(int num_jobs) {
return StringPrintf(kExampleJobListResponse, job_objects.c_str());
}
-std::string JobListURI(const char* reason) {
- return StringPrintf(kExamplePrinterJobListURI, reason);
+GURL JobListURI(const char* reason) {
+ return GURL(StringPrintf(kExamplePrinterJobListURI, reason));
}
std::string JobID(int job_num) {
return StringPrintf(kExampleJobID, job_num);
}
-std::string DoneURI(int job_num) {
- return StringPrintf(kExampleUpdateDoneURI, job_num);
+GURL DoneURI(int job_num) {
+ return GURL(StringPrintf(kExampleUpdateDoneURI, job_num));
}
-std::string ErrorURI(int job_num) {
- return StringPrintf(kExampleUpdateErrorURI, job_num);
+GURL ErrorURI(int job_num) {
+ return GURL(StringPrintf(kExampleUpdateErrorURI, job_num));
}
-std::string TicketURI(int job_num) {
- return StringPrintf(kExamplePrintTicketURI, job_num);
+GURL TicketURI(int job_num) {
+ return GURL(StringPrintf(kExamplePrintTicketURI, job_num));
}
-std::string DownloadURI(int job_num) {
- return StringPrintf(kExamplePrintDownloadURI, job_num);
+GURL DownloadURI(int job_num) {
+ return GURL(StringPrintf(kExamplePrintDownloadURI, job_num));
}
-// converts to string for consistency
-std::string InProgressURI(int job_num) {
+GURL InProgressURI(int job_num) {
return GetUrlForJobStatusUpdate(GURL(kExampleCloudPrintServerURL),
StringPrintf(kExampleJobID, job_num),
PRINT_JOB_STATUS_IN_PROGRESS,
- 0).spec();
+ 0);
}
std::string StatusResponse(int job_num, const char* status_string) {
@@ -557,18 +556,17 @@ void PrinterJobHandlerTest::SetUpJobSuccessTest(int job_num) {
// The times requirement is relaxed for the ticket URI
// in order to accommodate TicketDownloadFailureTest
- EXPECT_CALL(url_callback_, OnRequestCreate(
- GURL(TicketURI(job_num)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(job_num), _))
.Times(AtLeast(1));
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(DownloadURI(job_num)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(DownloadURI(job_num), _))
.Times(Exactly(1))
.WillOnce(Invoke(this, &PrinterJobHandlerTest::AddMimeHeader));
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(InProgressURI(job_num)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(InProgressURI(job_num), _))
.Times(Exactly(1));
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(DoneURI(job_num)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(DoneURI(job_num), _))
.Times(Exactly(1));
EXPECT_CALL(print_system_->JobSpooler(),
@@ -663,10 +661,10 @@ TEST_F(PrinterJobHandlerTest, DISABLED_HappyPathTest) {
JobListResponse(0), true);
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonStartup)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
.Times(Exactly(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonQueryMore)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _))
.Times(Exactly(1));
SetUpJobSuccessTest(1);
@@ -682,19 +680,19 @@ TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) {
JobListResponse(0), true);
factory_.SetFakeResponse(TicketURI(1), std::string(), false);
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(TicketURI(1)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonStartup)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonQueryMore)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonFailure)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonFailure), _))
.Times(AtLeast(1));
SetUpJobSuccessTest(2);
@@ -714,19 +712,19 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) {
JobListResponse(0), true);
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonStartup)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonQueryMore)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonFailure)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonFailure), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonRetry)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonRetry), _))
.Times(AtLeast(1));
SetUpJobSuccessTest(1);
@@ -759,23 +757,23 @@ TEST_F(PrinterJobHandlerTest, DISABLED_CompleteFailureTest) {
factory_.SetFakeResponse(TicketURI(1), std::string(), false);
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonStartup)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonFailure)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonFailure), _))
.Times(AtLeast(1));
EXPECT_CALL(url_callback_,
- OnRequestCreate(GURL(JobListURI(kJobFetchReasonRetry)), _))
+ OnRequestCreate(JobListURI(kJobFetchReasonRetry), _))
.Times(AtLeast(1));
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(ErrorURI(1)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(ErrorURI(1), _))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(
this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs));
- EXPECT_CALL(url_callback_, OnRequestCreate(GURL(TicketURI(1)), _))
+ EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _))
.Times(AtLeast(kNumRetriesBeforeAbandonJob));
BeginTest(70);
diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc
index 3038035..1380c67 100644
--- a/net/url_request/test_url_fetcher_factory.cc
+++ b/net/url_request/test_url_fetcher_factory.cc
@@ -357,7 +357,7 @@ URLFetcher* FakeURLFetcherFactory::CreateURLFetcher(
return fake_fetcher.release();
}
-void FakeURLFetcherFactory::SetFakeResponseForURL(
+void FakeURLFetcherFactory::SetFakeResponse(
const GURL& url,
const std::string& response_data,
bool success) {
@@ -365,12 +365,6 @@ void FakeURLFetcherFactory::SetFakeResponseForURL(
fake_responses_[url] = std::make_pair(response_data, success);
}
-void FakeURLFetcherFactory::SetFakeResponse(const std::string& url,
- const std::string& response_data,
- bool success) {
- SetFakeResponseForURL(GURL(url), response_data, success);
-}
-
void FakeURLFetcherFactory::ClearFakeResponses() {
fake_responses_.clear();
}
diff --git a/net/url_request/test_url_fetcher_factory.h b/net/url_request/test_url_fetcher_factory.h
index 35b4607..79f3156 100644
--- a/net/url_request/test_url_fetcher_factory.h
+++ b/net/url_request/test_url_fetcher_factory.h
@@ -377,13 +377,7 @@ class FakeURLFetcherFactory : public URLFetcherFactory,
// Sets the fake response for a given URL. If success is true we will serve
// an HTTP/200 and an HTTP/500 otherwise. The |response_data| may be empty.
- void SetFakeResponseForURL(const GURL& url,
- const std::string& response_data,
- bool success);
-
- // Convenience helper that calls SetFakeResponseForURL with GURL(url).
- // TODO(mnissler): Convert callers to SetFakeResponseForURL.
- void SetFakeResponse(const std::string& url,
+ void SetFakeResponse(const GURL& url,
const std::string& response_data,
bool success);
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc
index fff915bf..fa30d8f 100644
--- a/remoting/host/token_validator_factory_impl_unittest.cc
+++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -93,7 +93,7 @@ TEST_F(TokenValidatorFactoryImplTest, Success) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(kTokenValidationUrl, CreateResponse(
+ factory.SetFakeResponse(GURL(kTokenValidationUrl), CreateResponse(
token_validator_->token_scope()), true);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::SuccessCallback,
@@ -105,7 +105,7 @@ TEST_F(TokenValidatorFactoryImplTest, BadToken) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(kTokenValidationUrl, std::string(), false);
+ factory.SetFakeResponse(GURL(kTokenValidationUrl), std::string(), false);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::FailureCallback,
base::Unretained(this)));
@@ -116,7 +116,8 @@ TEST_F(TokenValidatorFactoryImplTest, BadScope) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(kTokenValidationUrl, CreateResponse(kBadScope), true);
+ factory.SetFakeResponse(
+ GURL(kTokenValidationUrl), CreateResponse(kBadScope), true);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(&TokenValidatorFactoryImplTest::FailureCallback,
base::Unretained(this)));
@@ -127,7 +128,7 @@ TEST_F(TokenValidatorFactoryImplTest, DeleteOnFailure) {
net::FakeURLFetcherFactory factory(NULL);
token_validator_ = token_validator_factory_->CreateTokenValidator(
kLocalJid, kRemoteJid);
- factory.SetFakeResponse(kTokenValidationUrl, std::string(), false);
+ factory.SetFakeResponse(GURL(kTokenValidationUrl), std::string(), false);
token_validator_->ValidateThirdPartyToken(
kToken, base::Bind(
&TokenValidatorFactoryImplTest::DeleteOnFailureCallback,