summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 18:36:32 +0000
committerrsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-06 18:36:32 +0000
commit911a0bc8f2dea094d6d9be4dbf236e90db720cd5 (patch)
tree4eb4b0eb75019eccf92c6eac1658310fc229dda7 /chrome
parent45ba64ab757f1eb681d9b285330634b4bc437747 (diff)
downloadchromium_src-911a0bc8f2dea094d6d9be4dbf236e90db720cd5.zip
chromium_src-911a0bc8f2dea094d6d9be4dbf236e90db720cd5.tar.gz
chromium_src-911a0bc8f2dea094d6d9be4dbf236e90db720cd5.tar.bz2
[sync] Allow FakeURLFetcher to return an arbitrary URLRequestStatus
In r232724, FakeURLFetcher went from being able to return only HTTP/200 or HTTP/500, to being able to return any arbitrary HttpResponseCode. However, the URLRequestStatus returned was hard coded to FAILURE for HTTP/5xx and SUCCESS for all other codes. This patch further modifies FakeURLFetcher to be able to return arbitrary URLRequestStatus values in addition to an HttpResponseCode. We no longer hard code the URLRequestStatus based on the HttpResponseCode being returned. It also updates all call sites that currently use FakeURLFetcher. R=achuith@chromium.org, ajwong@chromium.org, akalin@chromium.org, mattm@chromium.org, mmenke@chromium.org, nyquist@chromium.org, sky@chromium.org, tim@chromium.org, vitalybuka@chromium.org TBR=bengr, sergeyu BUG=313905 TEST=All existing tests pass trybots and waterfall Review URL: https://codereview.chromium.org/60923002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/login/eula_browsertest.cc12
-rw-r--r--chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc43
-rw-r--r--chrome/browser/chromeos/policy/device_local_account_browsertest.cc9
-rw-r--r--chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc4
-rw-r--r--chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc4
-rw-r--r--chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc10
-rw-r--r--chrome/browser/profile_resetter/profile_resetter_unittest.cc19
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service_unittest.cc100
-rw-r--r--chrome/browser/safe_browsing/download_protection_service_unittest.cc26
-rw-r--r--chrome/browser/signin/signin_browsertest.cc12
-rw-r--r--chrome/browser/sync/test/integration/sync_test.cc21
-rw-r--r--chrome/browser/ui/search/instant_extended_interactive_uitest.cc7
-rw-r--r--chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc32
-rw-r--r--chrome/service/cloud_print/printer_job_handler_unittest.cc77
14 files changed, 239 insertions, 137 deletions
diff --git a/chrome/browser/chromeos/login/eula_browsertest.cc b/chrome/browser/chromeos/login/eula_browsertest.cc
index c760cc2..d75083c 100644
--- a/chrome/browser/chromeos/login/eula_browsertest.cc
+++ b/chrome/browser/chromeos/login/eula_browsertest.cc
@@ -12,6 +12,7 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
#include "testing/gmock/include/gmock/gmock.h"
using ::testing::Exactly;
@@ -36,9 +37,10 @@ class TestURLFetcherCallback {
const GURL& url,
net::URLFetcherDelegate* d,
const std::string& response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
scoped_ptr<net::FakeURLFetcher> fetcher(
- new net::FakeURLFetcher(url, d, response_data, response_code));
+ new net::FakeURLFetcher(url, d, response_data, response_code, status));
OnRequestCreate(url, fetcher.get());
return fetcher.Pass();
}
@@ -60,7 +62,8 @@ IN_PROC_BROWSER_TEST_F(TermsOfServiceProcessBrowserTest, LoadOnline) {
NULL,
base::Bind(&TestURLFetcherCallback::CreateURLFetcher,
base::Unretained(&url_callback)));
- factory.SetFakeResponse(GURL(kEULAURL), kFakeOnlineEULA, net::HTTP_OK);
+ factory.SetFakeResponse(GURL(kEULAURL), kFakeOnlineEULA,
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(url_callback, OnRequestCreate(GURL(kEULAURL), _))
.Times(Exactly(1))
.WillRepeatedly(Invoke(AddMimeHeader));
@@ -80,7 +83,8 @@ 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(GURL(kEULAURL), "", net::HTTP_INTERNAL_SERVER_ERROR);
+ factory.SetFakeResponse(GURL(kEULAURL), "", net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUITermsURL));
content::WebContents* web_contents =
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 d795fc5..0ef3531 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
@@ -28,6 +28,7 @@
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
+#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
#include "policy/policy_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -126,7 +127,8 @@ class CloudExternalDataManagerBaseTest : public testing::Test {
void SetFakeResponse(const std::string& url,
const std::string& repsonse_data,
- net::HttpStatusCode response_code);
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status);
base::MessageLoop message_loop_;
base::ScopedTempDir temp_dir_;
@@ -237,8 +239,10 @@ void CloudExternalDataManagerBaseTest::FetchAll() {
void CloudExternalDataManagerBaseTest::SetFakeResponse(
const std::string& url,
const std::string& response_data,
- net::HttpStatusCode response_code) {
- fetcher_factory_.SetFakeResponse(GURL(url), response_data, response_code);
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
+ fetcher_factory_.SetFakeResponse(
+ GURL(url), response_data, response_code, status);
}
// Verifies that when no valid external data reference has been set for a
@@ -284,7 +288,8 @@ TEST_F(CloudExternalDataManagerBaseTest, FailToFetchInvalid) {
// further download attempts.
TEST_F(CloudExternalDataManagerBaseTest, DownloadAndCache) {
// Serve valid external data for |k10BytePolicy|.
- SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
external_data_manager_->Connect(request_content_getter_);
// Retrieve external data for |k10BytePolicy|. Verify that a download happens
@@ -339,8 +344,10 @@ TEST_F(CloudExternalDataManagerBaseTest, DownloadAndCache) {
// served from the cache without further download attempts.
TEST_F(CloudExternalDataManagerBaseTest, DownloadAndCacheAll) {
// Serve valid external data for |k10BytePolicy| and |k20BytePolicy|.
- SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK);
- SetFakeResponse(k20BytePolicyURL, k20ByteData, net::HTTP_OK);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
+ SetFakeResponse(k20BytePolicyURL, k20ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
external_data_manager_->Connect(request_content_getter_);
// Request that external data referenced by all policies be downloaded.
@@ -408,7 +415,8 @@ TEST_F(CloudExternalDataManagerBaseTest, DownloadAfterConnect) {
// Serve valid external data for |k10BytePolicy| and allow the
// external_data_manager_ to perform downloads.
- SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK);
+ SetFakeResponse(k10BytePolicyURL, k10ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
external_data_manager_->Connect(request_content_getter_);
// Verify that a download happens and the callback is invoked with the
@@ -427,7 +435,8 @@ TEST_F(CloudExternalDataManagerBaseTest, DownloadError) {
// Make attempts to download the external data for |k20BytePolicy| fail with
// an error.
SetFakeResponse(k20BytePolicyURL, std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
external_data_manager_->Connect(request_content_getter_);
// Attempt to retrieve external data for |k20BytePolicy|. Verify that the
@@ -462,7 +471,8 @@ TEST_F(CloudExternalDataManagerBaseTest, DownloadError) {
// Serve external data for |k20BytePolicy| that does not match the hash
// specified in its current external data reference.
- SetFakeResponse(k20BytePolicyURL, k10ByteData, net::HTTP_OK);
+ SetFakeResponse(k20BytePolicyURL, k10ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// Attempt to retrieve external data for |k20BytePolicy| again. Verify that
// no callback is invoked still as the downloaded succeeds but returns data
@@ -631,7 +641,8 @@ TEST_F(CloudExternalDataManagerBaseTest, CacheCorruption) {
SetUpExternalDataManager();
// Serve external data for |k10BytePolicy| that exceeds the maximal external
// data size allowed for that policy.
- SetFakeResponse(k10BytePolicyURL, k20ByteData, net::HTTP_OK);
+ SetFakeResponse(k10BytePolicyURL, k20ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
external_data_manager_->Connect(request_content_getter_);
// Modify the external data reference for |k10BytePolicy| to match the
@@ -650,7 +661,8 @@ TEST_F(CloudExternalDataManagerBaseTest, CacheCorruption) {
ResetCallbackData();
// Serve valid external data for |k20BytePolicy|.
- SetFakeResponse(k20BytePolicyURL, k20ByteData, net::HTTP_OK);
+ SetFakeResponse(k20BytePolicyURL, k20ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// Retrieve external data for |k20BytePolicy|. Verify that the callback is
// invoked with the valid downloaded data, not the invalid data in the cache.
@@ -692,9 +704,11 @@ TEST_F(CloudExternalDataManagerBaseTest, PolicyChangeWhileDownloadPending) {
// Make attempts to download the external data for |k10BytePolicy| and
// |k20BytePolicy| fail with an error.
SetFakeResponse(k10BytePolicyURL, std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
SetFakeResponse(k20BytePolicyURL, std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
external_data_manager_->Connect(request_content_getter_);
// Attempt to retrieve external data for |k10BytePolicy| and |k20BytePolicy|.
@@ -719,7 +733,8 @@ TEST_F(CloudExternalDataManagerBaseTest, PolicyChangeWhileDownloadPending) {
// Serve valid external data for |k20BytePolicy|.
fetcher_factory_.ClearFakeResponses();
- SetFakeResponse(k20BytePolicyURL, k10ByteData, net::HTTP_OK);
+ SetFakeResponse(k20BytePolicyURL, k10ByteData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// 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/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
index 6a24f9b..86614d7 100644
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -97,6 +97,7 @@
#include "net/test/embedded_test_server/http_response.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
+#include "net/url_request/url_request_status.h"
#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -256,10 +257,11 @@ scoped_ptr<net::FakeURLFetcher> RunCallbackAndReturnFakeURLFetcher(
const GURL& url,
net::URLFetcherDelegate* delegate,
const std::string& response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
task_runner->PostTask(FROM_HERE, callback);
return make_scoped_ptr(new net::FakeURLFetcher(
- url, delegate, response_data, response_code));
+ url, delegate, response_data, response_code, status));
}
} // namespace
@@ -837,7 +839,8 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExternalData) {
run_loop->QuitClosure())));
fetcher_factory->SetFakeResponse(GURL(kExternalDataURL),
kExternalData,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// TODO(bartfab): The test injects an ExternalDataFetcher for an arbitrary
// policy. This is only done because there are no policies that reference
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 d81df86..7ab0eb9 100644
--- a/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc
+++ b/chrome/browser/local_discovery/cloud_print_printer_list_unittest.cc
@@ -15,6 +15,7 @@
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_impl.h"
+#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -107,7 +108,8 @@ TEST_F(CloudPrintPrinterListTest, SuccessOAuth2) {
fetcher_factory_->SetFakeResponse(
GURL("http://SoMeUrL.com/cloudprint/search"),
kSampleSuccessResponseOAuth,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
CloudPrintBaseApiFlow* cloudprint_flow =
printer_list_->GetOAuth2ApiFlowForTests();
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc
index 0796606..25f33d5 100644
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest.cc
@@ -123,7 +123,9 @@ void DataReductionProxySettingsTestBase::SetProbeResult(
GURL(test_url),
settings,
response,
- success ? net::HTTP_OK : net::HTTP_INTERNAL_SERVER_ERROR)));
+ success ? net::HTTP_OK : net::HTTP_INTERNAL_SERVER_ERROR,
+ success ? net::URLRequestStatus::SUCCESS :
+ net::URLRequestStatus::FAILED)));
}
}
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 ceca2cf..35a95bb 100644
--- a/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc
+++ b/chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc
@@ -12,6 +12,7 @@
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/png_codec.h"
@@ -111,7 +112,8 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
NotificationBitmapFetcher fetcher(url, &delegate);
- url_fetcher_factory_->SetFakeResponse(url, image_string, net::HTTP_OK);
+ url_fetcher_factory_->SetFakeResponse(url, image_string, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// We expect that the image decoder will get called and return
// an image in a callback to OnImageDecoded().
@@ -163,7 +165,8 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
url_fetcher_factory_->SetFakeResponse(url,
std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
fetcher.Start(browser()->profile());
@@ -179,7 +182,8 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
NotificationBitmapFetcherTestDelegate delegate(kAsyncCall);
NotificationBitmapFetcher fetcher(url, &delegate);
url_fetcher_factory_->SetFakeResponse(
- url, std::string("Not a real bitmap"), net::HTTP_OK);
+ url, std::string("Not a real bitmap"),
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
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 27d6df8..45818a2 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -30,6 +30,7 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
#include "url/gurl.h"
@@ -174,7 +175,8 @@ class ConfigParserTest : public testing::Test {
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
- net::HttpStatusCode response_code);
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status);
MOCK_METHOD0(Callback, void(void));
@@ -214,13 +216,12 @@ scoped_ptr<net::FakeURLFetcher> ConfigParserTest::CreateFakeURLFetcher(
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
request_listener_.real_delegate = fetcher_delegate;
scoped_ptr<net::FakeURLFetcher> fetcher(
- new net::FakeURLFetcher(url,
- &request_listener_,
- response_data,
- response_code));
+ new net::FakeURLFetcher(
+ url, &request_listener_, response_data, response_code, status));
scoped_refptr<net::HttpResponseHeaders> download_headers =
new net::HttpResponseHeaders("");
download_headers->AddHeader("Content-Type: text/xml");
@@ -653,7 +654,8 @@ TEST_F(ProfileResetterTest, ResetFewFlags) {
// Tries to load unavailable config file.
TEST_F(ConfigParserTest, NoConnectivity) {
const GURL url("http://test");
- factory().SetFakeResponse(url, "", net::HTTP_INTERNAL_SERVER_ERROR);
+ factory().SetFakeResponse(url, "", net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
scoped_ptr<BrandcodeConfigFetcher> fetcher = WaitForRequest(GURL(url));
EXPECT_FALSE(fetcher->GetSettings());
@@ -667,7 +669,8 @@ TEST_F(ConfigParserTest, ParseConfig) {
ReplaceString(&xml_config,
"placeholder_for_id",
"abbaabbaabbaabbaabbaabbaabbaabba");
- factory().SetFakeResponse(url, xml_config, net::HTTP_OK);
+ factory().SetFakeResponse(url, xml_config, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
scoped_ptr<BrandcodeConfigFetcher> fetcher = WaitForRequest(GURL(url));
scoped_ptr<BrandcodedDefaultSettings> settings = fetcher->GetSettings();
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 41b1bca..b5f64d5 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -107,28 +107,28 @@ class ClientSideDetectionServiceTest : public testing::Test {
}
void SetModelFetchResponse(std::string response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
factory_->SetFakeResponse(GURL(ClientSideDetectionService::kClientModelUrl),
- response_data,
- response_code);
+ response_data, response_code, status);
}
void SetClientReportPhishingResponse(std::string response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
factory_->SetFakeResponse(
ClientSideDetectionService::GetClientReportUrl(
ClientSideDetectionService::kClientReportPhishingUrl),
- response_data,
- response_code);
+ response_data, response_code, status);
}
void SetClientReportMalwareResponse(std::string response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
factory_->SetFakeResponse(
ClientSideDetectionService::GetClientReportUrl(
ClientSideDetectionService::kClientReportMalwareUrl),
- response_data,
- response_code);
+ response_data, response_code, status);
}
int GetNumReports(std::queue<base::Time>* report_times) {
@@ -260,7 +260,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
service.SetEnabledAndRefreshState(true);
// The model fetch failed.
- SetModelFetchResponse("blamodel", net::HTTP_INTERNAL_SERVER_ERROR);
+ SetModelFetchResponse("blamodel", net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_FETCH_FAILED))
.WillOnce(QuitCurrentMessageLoop());
@@ -269,7 +270,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
Mock::VerifyAndClearExpectations(&service);
// Empty model file.
- SetModelFetchResponse(std::string(), net::HTTP_OK);
+ SetModelFetchResponse(std::string(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(ClientSideDetectionService::MODEL_EMPTY))
.WillOnce(QuitCurrentMessageLoop());
service.StartFetchModel();
@@ -279,7 +281,7 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// Model is too large.
SetModelFetchResponse(
std::string(ClientSideDetectionService::kMaxModelSizeBytes + 1, 'x'),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_TOO_LARGE))
.WillOnce(QuitCurrentMessageLoop());
@@ -288,7 +290,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
Mock::VerifyAndClearExpectations(&service);
// Unable to parse the model file.
- SetModelFetchResponse("Invalid model file", net::HTTP_OK);
+ SetModelFetchResponse("Invalid model file", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_PARSE_ERROR))
.WillOnce(QuitCurrentMessageLoop());
@@ -299,7 +302,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// Model that is missing some required fields (missing the version field).
ClientSideModel model;
model.set_max_words_per_term(4);
- SetModelFetchResponse(model.SerializePartialAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializePartialAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_MISSING_FIELDS))
.WillOnce(QuitCurrentMessageLoop());
@@ -311,7 +315,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
model.set_version(10);
model.add_hashes("bla");
model.add_page_term(1); // Should be 0 instead of 1.
- SetModelFetchResponse(model.SerializePartialAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializePartialAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_BAD_HASH_IDS))
.WillOnce(QuitCurrentMessageLoop());
@@ -322,7 +327,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// Model version number is wrong.
model.set_version(-1);
- SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_INVALID_VERSION_NUMBER))
.WillOnce(QuitCurrentMessageLoop());
@@ -332,7 +338,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// Normal model.
model.set_version(10);
- SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_SUCCESS))
.WillOnce(QuitCurrentMessageLoop());
@@ -344,7 +351,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// model that is currently loaded in the service object to 11.
service.model_.reset(new ClientSideModel(model));
service.model_->set_version(11);
- SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_INVALID_VERSION_NUMBER))
.WillOnce(QuitCurrentMessageLoop());
@@ -354,7 +362,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
// Model version hasn't changed since the last reload.
service.model_->set_version(10);
- SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(service, EndFetchModel(
ClientSideDetectionService::MODEL_NOT_CHANGED))
.WillOnce(QuitCurrentMessageLoop());
@@ -364,7 +373,8 @@ TEST_F(ClientSideDetectionServiceTest, FetchModelTest) {
}
TEST_F(ClientSideDetectionServiceTest, ServiceObjectDeletedBeforeCallbackDone) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
csd_service_->SetEnabledAndRefreshState(true);
EXPECT_TRUE(csd_service_.get() != NULL);
@@ -377,7 +387,8 @@ TEST_F(ClientSideDetectionServiceTest, ServiceObjectDeletedBeforeCallbackDone) {
}
TEST_F(ClientSideDetectionServiceTest, SendClientReportPhishingRequest) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
csd_service_->SetEnabledAndRefreshState(true);
@@ -387,21 +398,23 @@ TEST_F(ClientSideDetectionServiceTest, SendClientReportPhishingRequest) {
base::Time before = base::Time::Now();
// Invalid response body from the server.
- SetClientReportPhishingResponse("invalid proto response", net::HTTP_OK);
+ SetClientReportPhishingResponse("invalid proto response", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportPhishingRequest(url, score));
// Normal behavior.
ClientPhishingResponse response;
response.set_phishy(true);
- SetClientReportPhishingResponse(response.SerializeAsString(),
- net::HTTP_OK);
+ SetClientReportPhishingResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_TRUE(SendClientReportPhishingRequest(url, score));
// This request will fail
GURL second_url("http://b.com/");
response.set_phishy(false);
SetClientReportPhishingResponse(response.SerializeAsString(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
EXPECT_FALSE(SendClientReportPhishingRequest(second_url, score));
base::Time after = base::Time::Now();
@@ -425,38 +438,44 @@ TEST_F(ClientSideDetectionServiceTest, SendClientReportPhishingRequest) {
}
TEST_F(ClientSideDetectionServiceTest, SendClientReportMalwareRequest) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
csd_service_->SetEnabledAndRefreshState(true);
GURL url("http://a.com/");
base::Time before = base::Time::Now();
// Invalid response body from the server.
- SetClientReportMalwareResponse("invalid proto response", net::HTTP_OK);
+ SetClientReportMalwareResponse("invalid proto response", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportMalwareRequest(url));
// Missing bad_url.
ClientMalwareResponse response;
response.set_blacklist(true);
- SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK);
+ SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportMalwareRequest(url));
// Normal behavior.
response.set_blacklist(true);
response.set_bad_url("http://response-bad.com/");
- SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK);
+ SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_TRUE(SendClientReportMalwareRequest(url));
CheckConfirmedMalwareUrl(GURL("http://response-bad.com/"));
// This request will fail
response.set_blacklist(false);
SetClientReportMalwareResponse(response.SerializeAsString(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
EXPECT_FALSE(SendClientReportMalwareRequest(url));
// server blacklist decision is false, and response is succesful
response.set_blacklist(false);
- SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK);
+ SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportMalwareRequest(url));
// Check that we have recorded all 4 requests within the correct time range.
@@ -466,7 +485,8 @@ TEST_F(ClientSideDetectionServiceTest, SendClientReportMalwareRequest) {
// Another normal behavior will fail because of the limit is hit
response.set_blacklist(true);
- SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK);
+ SetClientReportMalwareResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportMalwareRequest(url));
report_times = GetMalwareReportTimes();
@@ -480,7 +500,8 @@ TEST_F(ClientSideDetectionServiceTest, SendClientReportMalwareRequest) {
}
TEST_F(ClientSideDetectionServiceTest, GetNumReportTest) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
std::queue<base::Time>& report_times = GetPhishingReportTimes();
@@ -495,14 +516,16 @@ TEST_F(ClientSideDetectionServiceTest, GetNumReportTest) {
}
TEST_F(ClientSideDetectionServiceTest, CacheTest) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
TestCache();
}
TEST_F(ClientSideDetectionServiceTest, IsPrivateIPAddress) {
- SetModelFetchResponse("bogus model", net::HTTP_OK);
+ SetModelFetchResponse("bogus model", net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
csd_service_.reset(ClientSideDetectionService::Create(NULL));
EXPECT_TRUE(csd_service_->IsPrivateIPAddress("10.1.2.3"));
@@ -633,7 +656,8 @@ TEST_F(ClientSideDetectionServiceTest, SetEnabledAndRefreshState) {
ClientSideModel model;
model.set_version(10);
model.set_max_words_per_term(4);
- SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK);
+ SetModelFetchResponse(model.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(*service, ScheduleFetchModel(_))
.WillOnce(Invoke(service, &MockClientSideDetectionService::Schedule));
EXPECT_CALL(*service, EndFetchModel(
@@ -665,8 +689,8 @@ TEST_F(ClientSideDetectionServiceTest, SetEnabledAndRefreshState) {
// Requests always return false when the service is disabled.
ClientPhishingResponse response;
response.set_phishy(true);
- SetClientReportPhishingResponse(response.SerializeAsString(),
- net::HTTP_OK);
+ SetClientReportPhishingResponse(response.SerializeAsString(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_FALSE(SendClientReportPhishingRequest(GURL("http://a.com/"), 0.4f));
// Pending requests also return false if the service is disabled before they
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index 9954fd1..c75d3a5 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -32,6 +32,7 @@
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
+#include "net/url_request/url_request_status.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/google/zip.h"
@@ -401,9 +402,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) {
net::FakeURLFetcherFactory factory(NULL);
// HTTP request will fail.
factory.SetFakeResponse(
- DownloadProtectionService::GetDownloadRequestUrl(),
- std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ DownloadProtectionService::GetDownloadRequestUrl(), std::string(),
+ net::HTTP_INTERNAL_SERVER_ERROR, net::URLRequestStatus::FAILED);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -445,7 +445,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -483,7 +483,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializePartialAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -501,7 +501,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -521,7 +521,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -546,7 +546,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -568,7 +568,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -589,7 +589,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
@@ -635,7 +635,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
base::ScopedTempDir download_dir;
ASSERT_TRUE(download_dir.CreateUniqueTempDir());
@@ -702,7 +702,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
download_service_->CheckClientDownload(
&item,
@@ -765,7 +765,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientCrxDownloadSuccess) {
factory.SetFakeResponse(
DownloadProtectionService::GetDownloadRequestUrl(),
response.SerializeAsString(),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
base::FilePath a_crx(FILE_PATH_LITERAL("a.crx"));
diff --git a/chrome/browser/signin/signin_browsertest.cc b/chrome/browser/signin/signin_browsertest.cc
index aebd1f8..a8f5395 100644
--- a/chrome/browser/signin/signin_browsertest.cc
+++ b/chrome/browser/signin/signin_browsertest.cc
@@ -27,6 +27,7 @@
#include "google_apis/gaia/gaia_urls.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
namespace {
const char kNonSigninURL[] = "www.google.com";
@@ -55,12 +56,11 @@ class SigninBrowserTest : public InProcessBrowserTest {
factory_.reset(new net::URLFetcherImplFactory());
fake_factory_.reset(new net::FakeURLFetcherFactory(factory_.get()));
fake_factory_->SetFakeResponse(
- GaiaUrls::GetInstance()->service_login_url(),
- std::string(),
- net::HTTP_OK);
- fake_factory_->SetFakeResponse(GURL(kNonSigninURL),
- std::string(),
- net::HTTP_OK);
+ GaiaUrls::GetInstance()->service_login_url(), std::string(),
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
+ fake_factory_->SetFakeResponse(
+ GURL(kNonSigninURL), std::string(), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// 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 28e1e64..be97945 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -430,23 +430,28 @@ void SyncTest::SetupMockGaiaResponses() {
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->client_login_url(),
"SID=sid\nLSID=lsid",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->get_user_info_url(),
"email=user@gmail.com\ndisplayEmail=user@gmail.com",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->issue_auth_token_url(),
"auth",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GURL(GoogleURLTracker::kSearchDomainCheckURL),
".google.com",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->client_login_to_oauth2_url(),
"some_response",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->oauth2_token_url(),
"{"
@@ -455,11 +460,13 @@ void SyncTest::SetupMockGaiaResponses() {
" \"expires_in\": 3600,"
" \"token_type\": \"Bearer\""
"}",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_factory_->SetFakeResponse(
GaiaUrls::GetInstance()->oauth1_login_url(),
"SID=sid\nLSID=lsid\nAuth=auth_token",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
}
void SyncTest::ClearMockGaiaResponses() {
diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
index 97879d2..d1493f0 100644
--- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
+++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc
@@ -79,6 +79,7 @@
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_impl.h"
+#include "net/url_request/url_request_status.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
@@ -924,7 +925,8 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, SetPrefetchQuery) {
"{\"google:clientdata\":{\"phi\": 0},"
"\"google:suggesttype\":[\"QUERY\", \"QUERY\"],"
"\"google:suggestrelevance\":[1400, 9]}]",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
SetOmniboxText("pupp");
while (!omnibox()->model()->autocomplete_controller()->done()) {
@@ -969,7 +971,8 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedPrefetchTest, ClearPrefetchedResults) {
"[\"dogs\",[\"https://dogs.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[2]}]",
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
SetOmniboxText("dogs");
while (!omnibox()->model()->autocomplete_controller()->done()) {
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
index 87d26e0..76f25fe 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc
@@ -22,6 +22,7 @@
#include "chrome/test/base/web_ui_browsertest.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
using testing::InvokeWithoutArgs;
@@ -294,10 +295,11 @@ class MockableFakeURLFetcherCreator {
const GURL& url,
net::URLFetcherDelegate* delegate,
const std::string& response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
OnCreateFakeURLFetcher(url.spec());
- return scoped_ptr<net::FakeURLFetcher>(
- new net::FakeURLFetcher(url, delegate, response_data, response_code));
+ return scoped_ptr<net::FakeURLFetcher>(new net::FakeURLFetcher(
+ url, delegate, response_data, response_code, status));
}
net::FakeURLFetcherFactory::FakeURLFetcherCreator callback() {
@@ -337,32 +339,38 @@ class LocalDiscoveryUITest : public WebUIBrowserTest {
fake_fetcher_factory().SetFakeResponse(
GURL(kURLInfo),
kResponseInfo,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLRegisterStart),
kResponseRegisterStart,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLRegisterClaimToken),
kResponseRegisterClaimTokenNoConfirm,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLCloudPrintConfirm),
kResponseCloudPrintConfirm,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLRegisterComplete),
kResponseRegisterComplete,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLGaiaToken),
kResponseGaiaToken,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(fake_url_fetcher_creator(), OnCreateFakeURLFetcher(
kURLGaiaToken))
@@ -482,12 +490,14 @@ IN_PROC_BROWSER_TEST_F(LocalDiscoveryUITest, RegisterTest) {
fake_fetcher_factory().SetFakeResponse(
GURL(kURLRegisterClaimToken),
kResponseRegisterClaimTokenConfirm,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
fake_fetcher_factory().SetFakeResponse(
GURL(kURLInfo),
kResponseInfoWithID,
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
{
InSequence s;
diff --git a/chrome/service/cloud_print/printer_job_handler_unittest.cc b/chrome/service/cloud_print/printer_job_handler_unittest.cc
index 1eeaa44..a97a1f1 100644
--- a/chrome/service/cloud_print/printer_job_handler_unittest.cc
+++ b/chrome/service/cloud_print/printer_job_handler_unittest.cc
@@ -17,6 +17,7 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
+#include "net/url_request/url_request_status.h"
#include "net/url_request/url_request_test_util.h"
#include "printing/backend/print_backend.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -282,9 +283,10 @@ class TestURLFetcherCallback {
const GURL& url,
net::URLFetcherDelegate* d,
const std::string& response_data,
- net::HttpStatusCode response_code) {
+ net::HttpStatusCode response_code,
+ net::URLRequestStatus::Status status) {
scoped_ptr<net::FakeURLFetcher> fetcher(
- new net::FakeURLFetcher(url, d, response_data, response_code));
+ new net::FakeURLFetcher(url, d, response_data, response_code, status));
OnRequestCreate(url, fetcher.get());
return fetcher.Pass();
}
@@ -498,11 +500,14 @@ void PrinterJobHandlerTest::SetUp() {
void PrinterJobHandlerTest::MakeJobFetchReturnNoJobs() {
factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
}
void PrinterJobHandlerTest::MessageLoopQuitNowHelper(
@@ -544,16 +549,20 @@ void PrinterJobHandlerTest::AddMimeHeader(const GURL& url,
void PrinterJobHandlerTest::SetUpJobSuccessTest(int job_num) {
factory_.SetFakeResponse(TicketURI(job_num),
- kExamplePrintTicket, net::HTTP_OK);
+ kExamplePrintTicket, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(DownloadURI(job_num),
- kExamplePrintData, net::HTTP_OK);
+ kExamplePrintData, net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(DoneURI(job_num),
StatusResponse(job_num, "DONE"),
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(InProgressURI(job_num),
StatusResponse(job_num, "IN_PROGRESS"),
- net::HTTP_OK);
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
// The times requirement is relaxed for the ticket URI
// in order to accommodate TicketDownloadFailureTest
@@ -657,9 +666,11 @@ MockPrintSystem::MockPrintSystem()
// Disabled - http://crbug.com/184245
TEST_F(PrinterJobHandlerTest, DISABLED_HappyPathTest) {
factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(url_callback_,
OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
@@ -674,13 +685,17 @@ TEST_F(PrinterJobHandlerTest, DISABLED_HappyPathTest) {
TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) {
factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup),
- JobListResponse(2), net::HTTP_OK);
+ JobListResponse(2), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure),
- JobListResponse(2), net::HTTP_OK);
+ JobListResponse(2), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(TicketURI(1), std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _))
.Times(AtLeast(1));
@@ -705,13 +720,17 @@ TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) {
// re-enable it
TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) {
factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore),
- JobListResponse(0), net::HTTP_OK);
+ JobListResponse(0), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
EXPECT_CALL(url_callback_,
OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))
@@ -733,14 +752,16 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) {
factory_.SetFakeResponse(TicketURI(1),
std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
loop_.PostDelayedTask(FROM_HERE,
base::Bind(&net::FakeURLFetcherFactory::SetFakeResponse,
base::Unretained(&factory_),
TicketURI(1),
kExamplePrintTicket,
- net::HTTP_OK),
+ net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS),
base::TimeDelta::FromSeconds(1));
@@ -752,15 +773,19 @@ TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) {
// constant values) seconds and re-enable it
TEST_F(PrinterJobHandlerTest, DISABLED_CompleteFailureTest) {
factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry),
- JobListResponse(1), net::HTTP_OK);
+ JobListResponse(1), net::HTTP_OK,
+ net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(ErrorURI(1), StatusResponse(1, "ERROR"),
- net::HTTP_OK);
+ net::HTTP_OK, net::URLRequestStatus::SUCCESS);
factory_.SetFakeResponse(TicketURI(1), std::string(),
- net::HTTP_INTERNAL_SERVER_ERROR);
+ net::HTTP_INTERNAL_SERVER_ERROR,
+ net::URLRequestStatus::FAILED);
EXPECT_CALL(url_callback_,
OnRequestCreate(JobListURI(kJobFetchReasonStartup), _))