Chromium Code Reviews| 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_URL_REQUEST_TEST_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 URLRequestTestJob(URLRequest* request, | 56 URLRequestTestJob(URLRequest* request, |
| 57 NetworkDelegate* network_delegate, | 57 NetworkDelegate* network_delegate, |
| 58 const std::string& response_headers, | 58 const std::string& response_headers, |
| 59 const std::string& response_data, | 59 const std::string& response_data, |
| 60 bool auto_advance); | 60 bool auto_advance); |
| 61 | 61 |
| 62 ~URLRequestTestJob() override; | 62 ~URLRequestTestJob() override; |
| 63 | 63 |
| 64 // The canned URLs this handler will respond to without having been | 64 // The canned URLs this handler will respond to without having been |
| 65 // explicitly initialized with response headers and data. | 65 // explicitly initialized with response headers and data. |
| 66 // FIXME(brettw): we should probably also have a redirect one | 66 |
| 67 // URL that, by default, automatically advances through each state. Reads | |
| 68 // complete synchronously. | |
|
Randy Smith (Not in Mondays)
2016/12/08 22:15:09
nit, suggestion: Name the methods s.t. there's a g
mmenke
2016/12/08 22:46:37
Yea, I'm going with "You have a point, but I don't
| |
| 67 static GURL test_url_1(); | 69 static GURL test_url_1(); |
| 70 | |
| 71 // URLs that, by default, must be manually advanced through each state. | |
| 68 static GURL test_url_2(); | 72 static GURL test_url_2(); |
| 69 static GURL test_url_3(); | 73 static GURL test_url_3(); |
| 70 static GURL test_url_4(); | 74 static GURL test_url_4(); |
| 75 | |
| 76 // URL that, by default, automatically advances through each state. Reads | |
| 77 // complete asynchronously. Has same response body as test_url_1(), which is | |
| 78 // (test_data_1()). | |
| 79 static GURL test_url_auto_advance_async_reads_1(); | |
| 80 | |
| 81 // URL that fails with ERR_INVALID_URL. | |
| 71 static GURL test_url_error(); | 82 static GURL test_url_error(); |
| 83 | |
| 84 // Redirects to test_url_1(). | |
| 72 static GURL test_url_redirect_to_url_1(); | 85 static GURL test_url_redirect_to_url_1(); |
| 86 | |
| 87 // Redirects to test_url_2(). | |
| 73 static GURL test_url_redirect_to_url_2(); | 88 static GURL test_url_redirect_to_url_2(); |
| 74 | 89 |
| 75 // The data that corresponds to each of the URLs above | 90 // The data that corresponds to each of the URLs above |
| 76 static std::string test_data_1(); | 91 static std::string test_data_1(); |
| 77 static std::string test_data_2(); | 92 static std::string test_data_2(); |
| 78 static std::string test_data_3(); | 93 static std::string test_data_3(); |
| 79 static std::string test_data_4(); | 94 static std::string test_data_4(); |
| 80 | 95 |
| 81 // The headers that correspond to each of the URLs above | 96 // The headers that correspond to each of the URLs above |
| 82 static std::string test_headers(); | 97 static std::string test_headers(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 LoadTimingInfo load_timing_info_; | 186 LoadTimingInfo load_timing_info_; |
| 172 | 187 |
| 173 private: | 188 private: |
| 174 // The headers the job should return, will be set in Start() if not provided | 189 // The headers the job should return, will be set in Start() if not provided |
| 175 // in the explicit ctor. | 190 // in the explicit ctor. |
| 176 scoped_refptr<HttpResponseHeaders> response_headers_; | 191 scoped_refptr<HttpResponseHeaders> response_headers_; |
| 177 | 192 |
| 178 // Original size in bytes of the response headers before decoding. | 193 // Original size in bytes of the response headers before decoding. |
| 179 int response_headers_length_; | 194 int response_headers_length_; |
| 180 | 195 |
| 196 bool async_reads_; | |
| 197 | |
| 181 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; | 198 base::WeakPtrFactory<URLRequestTestJob> weak_factory_; |
| 182 }; | 199 }; |
| 183 | 200 |
| 184 } // namespace net | 201 } // namespace net |
| 185 | 202 |
| 186 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ | 203 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_ |
| OLD | NEW |