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

Unified Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 60923002: [sync] Allow FakeURLFetcher to return an arbitrary URLRequestStatus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profile_resetter/profile_resetter_unittest.cc
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index 27d6df8c8c4f3e6763bb45f507c02149a5d528e9..45818a24bb51e98aa332fcf7fee09cc2eacc6092 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();

Powered by Google App Engine
This is Rietveld 408576698