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

Side by Side Diff: content/test/test_url_fetcher_factory.h

Issue 8375039: Create a content::UrlFetcher interface that lives in content/public/common and convert users to i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/url_fetcher_delegate.h ('k') | content/test/test_url_fetcher_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ 5 #ifndef CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_
6 #define CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ 6 #define CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 virtual void Start() {} 64 virtual void Start() {}
65 65
66 // Overriden to cache the chunks uploaded. Caller can read back the uploaded 66 // Overriden to cache the chunks uploaded. Caller can read back the uploaded
67 // chunks with the upload_data() accessor. 67 // chunks with the upload_data() accessor.
68 virtual void AppendChunkToUpload(const std::string& data, bool is_last_chunk) 68 virtual void AppendChunkToUpload(const std::string& data, bool is_last_chunk)
69 OVERRIDE; 69 OVERRIDE;
70 70
71 // Unique ID in our factory. 71 // Unique ID in our factory.
72 int id() const { return id_; } 72 int id() const { return id_; }
73 73
74 // URL we were created with. Because of how we're using URLFetcher url() 74 // URL we were created with. Because of how we're using URLFetcher GetUrl()
75 // always returns an empty URL. Chances are you'll want to use original_url() 75 // always returns an empty URL. Chances are you'll want to use
76 // in your tests. 76 // GetOriginalUrl() in your tests.
77 virtual const GURL& original_url() const OVERRIDE; 77 virtual const GURL& GetOriginalUrl() const OVERRIDE;
78 78
79 // Returns the data uploaded on this URLFetcher. 79 // Returns the data uploaded on this URLFetcher.
80 const std::string& upload_data() const { return URLFetcher::upload_data(); } 80 const std::string& upload_data() const { return URLFetcher::upload_data(); }
81 81
82 // Returns the chunks of data uploaded on this URLFetcher. 82 // Returns the chunks of data uploaded on this URLFetcher.
83 const std::list<std::string>& upload_chunks() const { return chunks_; } 83 const std::list<std::string>& upload_chunks() const { return chunks_; }
84 84
85 // Returns the delegate installed on the URLFetcher. 85 // Returns the delegate installed on the URLFetcher.
86 content::URLFetcherDelegate* delegate() const { 86 content::URLFetcherDelegate* delegate() const {
87 return URLFetcher::delegate(); 87 return URLFetcher::delegate();
88 } 88 }
89 89
90 void set_url(const GURL& url) { fake_url_ = url; } 90 void set_url(const GURL& url) { fake_url_ = url; }
91 virtual const GURL& url() const OVERRIDE; 91 virtual const GURL& GetUrl() const OVERRIDE;
92 92
93 void set_status(const net::URLRequestStatus& status); 93 void set_status(const net::URLRequestStatus& status);
94 virtual const net::URLRequestStatus& status() const OVERRIDE; 94 virtual const net::URLRequestStatus& GetStatus() const OVERRIDE;
95 95
96 void set_response_code(int response_code) { 96 void set_response_code(int response_code) {
97 fake_response_code_ = response_code; 97 fake_response_code_ = response_code;
98 } 98 }
99 virtual int response_code() const OVERRIDE; 99 virtual int GetResponseCode() const OVERRIDE;
100 100
101 void set_cookies(const net::ResponseCookies& c) { fake_cookies_ = c; } 101 void set_cookies(const net::ResponseCookies& c) { fake_cookies_ = c; }
102 virtual const net::ResponseCookies& cookies() const OVERRIDE; 102 virtual const net::ResponseCookies& GetCookies() const OVERRIDE;
103 103
104 void set_was_fetched_via_proxy(bool flag); 104 void set_was_fetched_via_proxy(bool flag);
105 105
106 void set_response_headers(scoped_refptr<net::HttpResponseHeaders> headers); 106 void set_response_headers(scoped_refptr<net::HttpResponseHeaders> headers);
107 107
108 // Set string data. 108 // Set string data.
109 void SetResponseString(const std::string& response); 109 void SetResponseString(const std::string& response);
110 110
111 // Set File data. 111 // Set File data.
112 void SetResponseFilePath(const FilePath& path); 112 void SetResponseFilePath(const FilePath& path);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 // This method will create a real URLFetcher. 242 // This method will create a real URLFetcher.
243 virtual URLFetcher* CreateURLFetcher(int id, 243 virtual URLFetcher* CreateURLFetcher(int id,
244 const GURL& url, 244 const GURL& url,
245 URLFetcher::RequestType request_type, 245 URLFetcher::RequestType request_type,
246 content::URLFetcherDelegate* d) OVERRIDE; 246 content::URLFetcherDelegate* d) OVERRIDE;
247 247
248 }; 248 };
249 249
250 #endif // CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ 250 #endif // CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_
OLDNEW
« no previous file with comments | « content/public/common/url_fetcher_delegate.h ('k') | content/test/test_url_fetcher_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698