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

Unified Diff: content/test/test_url_fetcher_factory.cc

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 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
Index: content/test/test_url_fetcher_factory.cc
===================================================================
--- content/test/test_url_fetcher_factory.cc (revision 106929)
+++ content/test/test_url_fetcher_factory.cc (working copy)
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "content/public/common/url_fetcher_delegate.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
@@ -24,7 +25,7 @@
TestURLFetcher::TestURLFetcher(int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d)
+ content::URLFetcherDelegate* d)
: URLFetcher(url, request_type, d),
id_(id),
original_url_(url),
@@ -68,10 +69,6 @@
fake_response_file_path_ = path;
}
-const std::string& TestURLFetcher::GetResponseStringRef() const {
- return fake_response_string_;
-}
-
bool TestURLFetcher::GetResponseAsString(
std::string* out_response_string) const {
if (GetResponseDestinationForTesting() != STRING)
@@ -100,7 +97,7 @@
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
+ content::URLFetcherDelegate* d) {
TestURLFetcher* fetcher = new TestURLFetcher(id, url, request_type, d);
fetchers_[id] = fetcher;
return fetcher;
@@ -129,11 +126,16 @@
return fake_response_code_;
}
+const net::ResponseCookies& TestURLFetcher::cookies() const {
+ return fake_cookies_;
+}
+
// This class is used by the FakeURLFetcherFactory below.
class FakeURLFetcher : public URLFetcher {
public:
// Normal URL fetcher constructor but also takes in a pre-baked response.
- FakeURLFetcher(const GURL& url, RequestType request_type, Delegate* d,
+ FakeURLFetcher(const GURL& url, RequestType request_type,
+ content::URLFetcherDelegate* d,
const std::string& response_data, bool success)
: URLFetcher(url, request_type, d),
url_(url),
@@ -158,10 +160,6 @@
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_;
@@ -220,7 +218,7 @@
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
+ content::URLFetcherDelegate* d) {
FakeResponseMap::const_iterator it = fake_responses_.find(url);
if (it == fake_responses_.end()) {
if (default_factory_ == NULL) {
@@ -254,6 +252,6 @@
int id,
const GURL& url,
URLFetcher::RequestType request_type,
- URLFetcher::Delegate* d) {
+ content::URLFetcherDelegate* d) {
return new URLFetcher(url, request_type, d);
}
« content/common/net/url_fetcher.h ('K') | « 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