| Index: net/url_request/test_url_fetcher_factory.h
|
| diff --git a/net/url_request/test_url_fetcher_factory.h b/net/url_request/test_url_fetcher_factory.h
|
| index 50ab815d63ea8b4c968df0d53c66fe2e0fea36d8..cd64e675c0c6c1d0b3033b6b1f73016b333b97c2 100644
|
| --- a/net/url_request/test_url_fetcher_factory.h
|
| +++ b/net/url_request/test_url_fetcher_factory.h
|
| @@ -287,7 +287,7 @@ class FakeURLFetcher : public TestURLFetcher {
|
| FakeURLFetcher(const GURL& url,
|
| URLFetcherDelegate* d,
|
| const std::string& response_data,
|
| - HttpStatusCode response_code);
|
| + URLRequestStatus request_status);
|
|
|
| // Start the request. This will call the given delegate asynchronously
|
| // with the pre-baked response as parameter.
|
| @@ -326,18 +326,21 @@ class FakeURLFetcher : public TestURLFetcher {
|
| // // want to respond with a simple html page and an HTTP/200 code.
|
| // factory.SetFakeResponse("http://a.com/success",
|
| // "<html><body>hello world</body></html>",
|
| -// HTTP_OK);
|
| +// HTTP_OK,
|
| +// URLRequestStatus::SUCCESS);
|
| // // You know that class SomeService will request url http://a.com/failure and
|
| // // you want to test the service class by returning a server error.
|
| // factory.SetFakeResponse("http://a.com/failure",
|
| // "",
|
| -// HTTP_INTERNAL_SERVER_ERROR);
|
| +// HTTP_INTERNAL_SERVER_ERROR,
|
| +// URLRequestStatus::FAILED);
|
| // // You know that class SomeService will request url http://a.com/error and
|
| // // you want to test the service class by returning a specific error code,
|
| // // say, a HTTP/401 error.
|
| // factory.SetFakeResponse("http://a.com/error",
|
| // "some_response",
|
| -// HTTP_UNAUTHORIZED);
|
| +// HTTP_UNAUTHORIZED,
|
| +// URLRequestStatus::SUCCESS);
|
| //
|
| // SomeService service;
|
| // service.Run(); // Will eventually request these three URLs.
|
| @@ -349,14 +352,14 @@ class FakeURLFetcherFactory : public URLFetcherFactory,
|
| // |url| URL for instantiated FakeURLFetcher
|
| // |delegate| Delegate for FakeURLFetcher
|
| // |response_data| response data for FakeURLFetcher
|
| - // |response_code| response code for FakeURLFetcher
|
| + // |request_status| URLRequestStatus for FakeURLFetcher
|
| // These arguments should by default be used in instantiating FakeURLFetcher
|
| - // as follows: new FakeURLFetcher(url, delegate, response_data, response_code)
|
| + // like so: new FakeURLFetcher(url, delegate, response_data, request_status)
|
| typedef base::Callback<scoped_ptr<FakeURLFetcher>(
|
| const GURL&,
|
| URLFetcherDelegate*,
|
| const std::string&,
|
| - HttpStatusCode)> FakeURLFetcherCreator;
|
| + URLRequestStatus)> FakeURLFetcherCreator;
|
|
|
| // |default_factory|, which can be NULL, is a URLFetcherFactory that
|
| // will be used to construct a URLFetcher in case the URL being created
|
| @@ -390,11 +393,14 @@ class FakeURLFetcherFactory : public URLFetcherFactory,
|
| // Sets the fake response for a given URL. The |response_data| may be empty.
|
| // The |response_code| may be any HttpStatusCode. For instance, HTTP_OK will
|
| // return an HTTP/200 and HTTP_INTERNAL_SERVER_ERROR will return an HTTP/500.
|
| - // Note: The URLRequestStatus of FakeURLFetchers created by the factory will
|
| - // be FAILED for HttpStatusCodes HTTP/5xx, and SUCCESS for all other codes.
|
| + // The |status| argument may be any URLRequestStatus::Status value. Typically,
|
| + // requests that return a valid HttpStatusCode have the SUCCESS status, while
|
| + // requests that indicate a failure to connect to the server have the FAILED
|
| + // status.
|
| void SetFakeResponse(const GURL& url,
|
| const std::string& response_data,
|
| - HttpStatusCode response_code);
|
| + HttpStatusCode response_code,
|
| + URLRequestStatus::Status status);
|
|
|
| // Clear all the fake responses that were previously set via
|
| // SetFakeResponse().
|
| @@ -403,7 +409,7 @@ class FakeURLFetcherFactory : public URLFetcherFactory,
|
| private:
|
| const FakeURLFetcherCreator creator_;
|
| typedef std::map<GURL,
|
| - std::pair<std::string, HttpStatusCode> > FakeResponseMap;
|
| + std::pair<std::string, URLRequestStatus> > FakeResponseMap;
|
| FakeResponseMap fake_responses_;
|
| URLFetcherFactory* const default_factory_;
|
|
|
| @@ -411,7 +417,7 @@ class FakeURLFetcherFactory : public URLFetcherFactory,
|
| const GURL& url,
|
| URLFetcherDelegate* delegate,
|
| const std::string& response_data,
|
| - HttpStatusCode response_code);
|
| + URLRequestStatus request_status);
|
| DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory);
|
| };
|
|
|
|
|