diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 18:36:32 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-06 18:36:32 +0000 |
commit | 911a0bc8f2dea094d6d9be4dbf236e90db720cd5 (patch) | |
tree | 4eb4b0eb75019eccf92c6eac1658310fc229dda7 /chrome/browser/profile_resetter | |
parent | 45ba64ab757f1eb681d9b285330634b4bc437747 (diff) | |
download | chromium_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/browser/profile_resetter')
-rw-r--r-- | chrome/browser/profile_resetter/profile_resetter_unittest.cc | 19 |
1 files changed, 11 insertions, 8 deletions
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(); |