| 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..5062b4641195559608e7353a88a497b2265cb2cc 100644
|
| --- a/content/test/test_url_fetcher_factory.cc
|
| +++ b/content/test/test_url_fetcher_factory.cc
|
| @@ -125,17 +125,47 @@ 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)) {
|
| }
|
|
|
| // Start the request. This will call the given delegate asynchronously
|
| // with the pre-baked response as parameter.
|
| - virtual void Start() {
|
| + virtual void Start() OVERRIDE {
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| method_factory_.NewRunnableMethod(&FakeURLFetcher::RunDelegate));
|
| }
|
|
|
| + // These methods are overriden so we can use the version of
|
| + // OnURLFetchComplete that only has a single URLFetcher argument.
|
| + virtual const net::ResponseCookies& cookies() const OVERRIDE {
|
| + return cookies_;
|
| + }
|
| +
|
| + virtual const std::string& GetResponseStringRef() const OVERRIDE {
|
| + return response_data_;
|
| + }
|
| +
|
| + virtual bool GetResponseAsString(
|
| + std::string* out_response_string) const OVERRIDE {
|
| + *out_response_string = response_data_;
|
| + return true;
|
| + }
|
| +
|
| + virtual int response_code() const OVERRIDE {
|
| + return success_ ? 200 : 500;
|
| + }
|
| +
|
| + virtual const net::URLRequestStatus& status() const OVERRIDE {
|
| + return status_;
|
| + }
|
| +
|
| + virtual const GURL& url() const OVERRIDE {
|
| + return url_;
|
| + }
|
| +
|
| private:
|
| virtual ~FakeURLFetcher() {
|
| }
|
| @@ -143,11 +173,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 +181,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_;
|
| @@ -200,7 +228,7 @@ void FakeURLFetcherFactory::SetFakeResponse(const std::string& url,
|
| fake_responses_[GURL(url)] = std::make_pair(response_data, success);
|
| }
|
|
|
| -void FakeURLFetcherFactory::ClearFakeReponses() {
|
| +void FakeURLFetcherFactory::ClearFakeResponses() {
|
| fake_responses_.clear();
|
| }
|
|
|
|
|