| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 5 #ifndef NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
| 6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 6 #define NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 // URLFetcher implementation | 89 // URLFetcher implementation |
| 90 void SetUploadData(const std::string& upload_content_type, | 90 void SetUploadData(const std::string& upload_content_type, |
| 91 const std::string& upload_content) override; | 91 const std::string& upload_content) override; |
| 92 void SetUploadFilePath( | 92 void SetUploadFilePath( |
| 93 const std::string& upload_content_type, | 93 const std::string& upload_content_type, |
| 94 const base::FilePath& file_path, | 94 const base::FilePath& file_path, |
| 95 uint64 range_offset, | 95 uint64 range_offset, |
| 96 uint64 range_length, | 96 uint64 range_length, |
| 97 scoped_refptr<base::TaskRunner> file_task_runner) override; | 97 scoped_refptr<base::TaskRunner> file_task_runner) override; |
| 98 void SetUploadStream( |
| 99 const std::string& upload_content_type, |
| 100 scoped_ptr<net::UploadDataStream> upload_stream) override; |
| 98 void SetChunkedUpload(const std::string& upload_content_type) override; | 101 void SetChunkedUpload(const std::string& upload_content_type) override; |
| 99 // Overriden to cache the chunks uploaded. Caller can read back the uploaded | 102 // Overriden to cache the chunks uploaded. Caller can read back the uploaded |
| 100 // chunks with the upload_chunks() accessor. | 103 // chunks with the upload_chunks() accessor. |
| 101 void AppendChunkToUpload(const std::string& data, | 104 void AppendChunkToUpload(const std::string& data, |
| 102 bool is_last_chunk) override; | 105 bool is_last_chunk) override; |
| 103 void SetLoadFlags(int load_flags) override; | 106 void SetLoadFlags(int load_flags) override; |
| 104 int GetLoadFlags() const override; | 107 int GetLoadFlags() const override; |
| 105 void SetReferrer(const std::string& referrer) override; | 108 void SetReferrer(const std::string& referrer) override; |
| 106 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy) override; | 109 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy) override; |
| 107 void SetExtraRequestHeaders( | 110 void SetExtraRequestHeaders( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 }; | 198 }; |
| 196 | 199 |
| 197 TestURLFetcherFactory* owner_; | 200 TestURLFetcherFactory* owner_; |
| 198 const int id_; | 201 const int id_; |
| 199 const GURL original_url_; | 202 const GURL original_url_; |
| 200 URLFetcherDelegate* delegate_; | 203 URLFetcherDelegate* delegate_; |
| 201 DelegateForTests* delegate_for_tests_; | 204 DelegateForTests* delegate_for_tests_; |
| 202 std::string upload_content_type_; | 205 std::string upload_content_type_; |
| 203 std::string upload_data_; | 206 std::string upload_data_; |
| 204 base::FilePath upload_file_path_; | 207 base::FilePath upload_file_path_; |
| 208 scoped_ptr<net::UploadDataStream> upload_stream_; |
| 205 std::list<std::string> chunks_; | 209 std::list<std::string> chunks_; |
| 206 bool did_receive_last_chunk_; | 210 bool did_receive_last_chunk_; |
| 207 | 211 |
| 208 // User can use set_* methods to provide values returned by getters. | 212 // User can use set_* methods to provide values returned by getters. |
| 209 // Setting the real values is not possible, because the real class | 213 // Setting the real values is not possible, because the real class |
| 210 // has no setters. The data is a private member of a class defined | 214 // has no setters. The data is a private member of a class defined |
| 211 // in a .cc file, so we can't get at it with friendship. | 215 // in a .cc file, so we can't get at it with friendship. |
| 212 int fake_load_flags_; | 216 int fake_load_flags_; |
| 213 GURL fake_url_; | 217 GURL fake_url_; |
| 214 URLRequestStatus fake_status_; | 218 URLRequestStatus fake_status_; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // This method will create a real URLFetcher. | 456 // This method will create a real URLFetcher. |
| 453 URLFetcher* CreateURLFetcher(int id, | 457 URLFetcher* CreateURLFetcher(int id, |
| 454 const GURL& url, | 458 const GURL& url, |
| 455 URLFetcher::RequestType request_type, | 459 URLFetcher::RequestType request_type, |
| 456 URLFetcherDelegate* d) override; | 460 URLFetcherDelegate* d) override; |
| 457 }; | 461 }; |
| 458 | 462 |
| 459 } // namespace net | 463 } // namespace net |
| 460 | 464 |
| 461 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ | 465 #endif // NET_URL_REQUEST_TEST_URL_FETCHER_FACTORY_H_ |
| OLD | NEW |