Chromium Code Reviews| Index: content/test/test_url_fetcher_factory.cc |
| diff --git a/content/test/test_url_fetcher_factory.cc b/content/test/test_url_fetcher_factory.cc |
| index d95fbf2b0a23d910c421798c2d33940a5d81a2de..f1ee36052d1c2e7c3872b6b2bcf3cccbb0e5708f 100644 |
| --- a/content/test/test_url_fetcher_factory.cc |
| +++ b/content/test/test_url_fetcher_factory.cc |
| @@ -125,6 +125,8 @@ class FakeURLFetcher : public URLFetcher { |
| url_(url), |
| response_data_(response_data), |
| success_(success), |
| + status_(success ? net::URLRequestStatus::SUCCESS : |
| + net::URLRequestStatus::FAILED, 0), |
| ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| } |
| @@ -136,6 +138,23 @@ class FakeURLFetcher : public URLFetcher { |
| method_factory_.NewRunnableMethod(&FakeURLFetcher::RunDelegate)); |
| } |
| + // These methods are overriden so we can use the version of |
|
Mihai Parparita -not on Chrome
2011/08/31 23:26:23
Add OVERRIDE to the methods that you're overriding
jstritar
2011/09/01 16:10:13
Done.
|
| + // OnURLFetchComplete that only has a single URLFetcher argument. |
| + virtual const net::ResponseCookies& cookies() const { return cookies_; } |
| + |
| + virtual const std::string& GetResponseStringRef() const { |
| + return response_data_; |
| + } |
| + |
| + virtual bool GetResponseAsString(std::string* out_response_string) const { |
| + *out_response_string = response_data_; |
| + return true; |
| + } |
| + |
| + virtual int response_code() const { return success_ ? 200 : 500; } |
| + |
| + virtual const net::URLRequestStatus& status() const { return status_; } |
| + |
| private: |
| virtual ~FakeURLFetcher() { |
| } |
| @@ -143,11 +162,7 @@ class FakeURLFetcher : public URLFetcher { |
| // This is the method which actually calls the delegate that is passed in the |
| // constructor. |
| void RunDelegate() { |
| - net::URLRequestStatus status; |
| - status.set_status(success_ ? net::URLRequestStatus::SUCCESS : |
| - net::URLRequestStatus::FAILED); |
| - delegate()->OnURLFetchComplete(this, url_, status, success_ ? 200 : 500, |
| - net::ResponseCookies(), response_data_); |
| + delegate()->OnURLFetchComplete(this); |
| } |
| // Pre-baked response data and flag which indicates whether the request should |
| @@ -155,6 +170,8 @@ class FakeURLFetcher : public URLFetcher { |
| GURL url_; |
| std::string response_data_; |
| bool success_; |
| + net::URLRequestStatus status_; |
| + net::ResponseCookies cookies_; |
| // Method factory used to run the delegate. |
| ScopedRunnableMethodFactory<FakeURLFetcher> method_factory_; |