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

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

Issue 48713008: [sync] Allow FakeURLFetcher to return arbitrary HTTP response codes (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 5c238f3d4166253bded0dfebefc6f63cef31cc9e..27d6df8c8c4f3e6763bb45f507c02149a5d528e9 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -28,6 +28,7 @@
#include "content/public/test/test_browser_thread.h"
#include "extensions/common/manifest_constants.h"
#include "net/http/http_response_headers.h"
+#include "net/http/http_status_code.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "url/gurl.h"
@@ -173,7 +174,7 @@ class ConfigParserTest : public testing::Test {
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
- bool success);
+ net::HttpStatusCode response_code);
MOCK_METHOD0(Callback, void(void));
@@ -213,10 +214,13 @@ scoped_ptr<net::FakeURLFetcher> ConfigParserTest::CreateFakeURLFetcher(
const GURL& url,
net::URLFetcherDelegate* fetcher_delegate,
const std::string& response_data,
- bool success) {
+ net::HttpStatusCode response_code) {
request_listener_.real_delegate = fetcher_delegate;
scoped_ptr<net::FakeURLFetcher> fetcher(
- new net::FakeURLFetcher(url, &request_listener_, response_data, success));
+ new net::FakeURLFetcher(url,
+ &request_listener_,
+ response_data,
+ response_code));
scoped_refptr<net::HttpResponseHeaders> download_headers =
new net::HttpResponseHeaders("");
download_headers->AddHeader("Content-Type: text/xml");
@@ -649,7 +653,7 @@ TEST_F(ProfileResetterTest, ResetFewFlags) {
// Tries to load unavailable config file.
TEST_F(ConfigParserTest, NoConnectivity) {
const GURL url("http://test");
- factory().SetFakeResponse(url, "", false);
+ factory().SetFakeResponse(url, "", net::HTTP_INTERNAL_SERVER_ERROR);
scoped_ptr<BrandcodeConfigFetcher> fetcher = WaitForRequest(GURL(url));
EXPECT_FALSE(fetcher->GetSettings());
@@ -663,7 +667,7 @@ TEST_F(ConfigParserTest, ParseConfig) {
ReplaceString(&xml_config,
"placeholder_for_id",
"abbaabbaabbaabbaabbaabbaabbaabba");
- factory().SetFakeResponse(url, xml_config, true);
+ factory().SetFakeResponse(url, xml_config, net::HTTP_OK);
scoped_ptr<BrandcodeConfigFetcher> fetcher = WaitForRequest(GURL(url));
scoped_ptr<BrandcodedDefaultSettings> settings = fetcher->GetSettings();

Powered by Google App Engine
This is Rietveld 408576698