OLD | NEW |
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 CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 5 #ifndef CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ |
6 #define CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 6 #define CHROME_COMMON_NET_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Returns the data uploaded on this URLFetcher. | 69 // Returns the data uploaded on this URLFetcher. |
70 const std::string& upload_data() const { return URLFetcher::upload_data(); } | 70 const std::string& upload_data() const { return URLFetcher::upload_data(); } |
71 | 71 |
72 // Returns the chunks of data uploaded on this URLFetcher. | 72 // Returns the chunks of data uploaded on this URLFetcher. |
73 const std::list<std::string>& upload_chunks() const { return chunks_; } | 73 const std::list<std::string>& upload_chunks() const { return chunks_; } |
74 | 74 |
75 // Returns the delegate installed on the URLFetcher. | 75 // Returns the delegate installed on the URLFetcher. |
76 Delegate* delegate() const { return URLFetcher::delegate(); } | 76 Delegate* delegate() const { return URLFetcher::delegate(); } |
77 | 77 |
78 void set_url(const GURL& url) { fake_url_ = url; } | 78 void set_url(const GURL& url) { fake_url_ = url; } |
79 const GURL& url() const { return fake_url_; } | 79 virtual const GURL& url() const; |
80 | 80 |
81 void set_status(const net::URLRequestStatus& status); | 81 void set_status(const net::URLRequestStatus& status); |
82 const net::URLRequestStatus& status() const { return fake_status_; } | 82 virtual const net::URLRequestStatus& status() const; |
83 | 83 |
84 void set_response_code(int response_code) { | 84 void set_response_code(int response_code) { |
85 fake_response_code_ = response_code; | 85 fake_response_code_ = response_code; |
86 } | 86 } |
87 virtual int response_code() const { return fake_response_code_; } | 87 virtual int response_code() const; |
88 | 88 |
89 // Set string data. | 89 // Set string data. |
90 void SetResponseString(const std::string& response); | 90 void SetResponseString(const std::string& response); |
91 | 91 |
92 // Set File data. | 92 // Set File data. |
93 void SetResponseFilePath(const FilePath& path); | 93 void SetResponseFilePath(const FilePath& path); |
94 | 94 |
95 // Override response access functions to return fake data. | 95 // Override response access functions to return fake data. |
96 virtual bool GetResponseAsString(std::string* out_response_string) const; | 96 virtual bool GetResponseAsString(std::string* out_response_string) const; |
97 virtual bool GetResponseAsFilePath(bool take_ownership, | 97 virtual bool GetResponseAsFilePath(bool take_ownership, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void ClearFakeReponses(); | 195 void ClearFakeReponses(); |
196 | 196 |
197 private: | 197 private: |
198 typedef std::map<GURL, std::pair<std::string, bool> > FakeResponseMap; | 198 typedef std::map<GURL, std::pair<std::string, bool> > FakeResponseMap; |
199 FakeResponseMap fake_responses_; | 199 FakeResponseMap fake_responses_; |
200 | 200 |
201 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); | 201 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); |
202 }; | 202 }; |
203 | 203 |
204 #endif // CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ | 204 #endif // CHROME_COMMON_NET_TEST_URL_FETCHER_FACTORY_H_ |
OLD | NEW |