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

Unified Diff: content/test/test_url_fetcher_factory.cc

Issue 7820003: Add support to download web store promo logos over https. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix sync failures Created 9 years, 3 months 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
« no previous file with comments | « content/test/test_url_fetcher_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « content/test/test_url_fetcher_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698