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_UTIL_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 protected: | 110 protected: |
| 111 virtual ~TestURLRequestContextGetter(); | 111 virtual ~TestURLRequestContextGetter(); |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 114 const scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
| 115 scoped_ptr<TestURLRequestContext> context_; | 115 scoped_ptr<TestURLRequestContext> context_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 //----------------------------------------------------------------------------- | 118 //----------------------------------------------------------------------------- |
| 119 | 119 |
| 120 // TODO(mmenke): This class doesn't really seem to serve a purpose. Get rid | |
| 121 // of it, and make tests use context->CreateRequest instead. | |
| 120 class TestURLRequest : public URLRequest { | 122 class TestURLRequest : public URLRequest { |
| 121 public: | 123 public: |
| 122 TestURLRequest(const GURL& url, | 124 TestURLRequest(const GURL& url, |
| 123 RequestPriority priority, | 125 RequestPriority priority, |
| 124 Delegate* delegate, | 126 Delegate* delegate, |
| 125 TestURLRequestContext* context); | 127 TestURLRequestContext* context); |
| 126 virtual ~TestURLRequest(); | 128 virtual ~TestURLRequest(); |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 //----------------------------------------------------------------------------- | 131 //----------------------------------------------------------------------------- |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 GURL redirect_on_headers_received_url) { | 253 GURL redirect_on_headers_received_url) { |
| 252 redirect_on_headers_received_url_ = redirect_on_headers_received_url; | 254 redirect_on_headers_received_url_ = redirect_on_headers_received_url; |
| 253 } | 255 } |
| 254 | 256 |
| 255 void set_allowed_unsafe_redirect_url(GURL allowed_unsafe_redirect_url) { | 257 void set_allowed_unsafe_redirect_url(GURL allowed_unsafe_redirect_url) { |
| 256 allowed_unsafe_redirect_url_ = allowed_unsafe_redirect_url; | 258 allowed_unsafe_redirect_url_ = allowed_unsafe_redirect_url; |
| 257 } | 259 } |
| 258 | 260 |
| 259 void set_cookie_options(int o) {cookie_options_bit_mask_ = o; } | 261 void set_cookie_options(int o) {cookie_options_bit_mask_ = o; } |
| 260 | 262 |
| 263 size_t total_seen_requests() const { return event_order_.size(); } | |
|
pauljensen
2014/07/31 15:38:17
I didn't see any caller of this function nor a use
mmenke
2014/07/31 16:03:14
No, you're not. These accidentally slipped in fro
| |
| 261 int last_error() const { return last_error_; } | 264 int last_error() const { return last_error_; } |
| 262 int error_count() const { return error_count_; } | 265 int error_count() const { return error_count_; } |
| 263 int created_requests() const { return created_requests_; } | 266 int created_requests() const { return created_requests_; } |
| 267 int sent_headers_for_requests() const { return sent_headers_for_requests_; } | |
| 268 int redirected_requests() const { return redirected_requests_; } | |
| 264 int destroyed_requests() const { return destroyed_requests_; } | 269 int destroyed_requests() const { return destroyed_requests_; } |
| 265 int completed_requests() const { return completed_requests_; } | 270 int completed_requests() const { return completed_requests_; } |
| 266 int canceled_requests() const { return canceled_requests_; } | 271 int canceled_requests() const { return canceled_requests_; } |
| 267 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } | 272 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } |
| 268 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } | 273 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } |
| 269 int set_cookie_count() const { return set_cookie_count_; } | 274 int set_cookie_count() const { return set_cookie_count_; } |
| 270 | 275 |
| 271 void set_can_access_files(bool val) { can_access_files_ = val; } | 276 void set_can_access_files(bool val) { can_access_files_ = val; } |
| 272 bool can_access_files() const { return can_access_files_; } | 277 bool can_access_files() const { return can_access_files_; } |
| 273 | 278 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 337 |
| 333 void InitRequestStatesIfNew(int request_id); | 338 void InitRequestStatesIfNew(int request_id); |
| 334 | 339 |
| 335 GURL redirect_on_headers_received_url_; | 340 GURL redirect_on_headers_received_url_; |
| 336 // URL marked as safe for redirection at the onHeadersReceived stage. | 341 // URL marked as safe for redirection at the onHeadersReceived stage. |
| 337 GURL allowed_unsafe_redirect_url_; | 342 GURL allowed_unsafe_redirect_url_; |
| 338 | 343 |
| 339 int last_error_; | 344 int last_error_; |
| 340 int error_count_; | 345 int error_count_; |
| 341 int created_requests_; | 346 int created_requests_; |
| 347 int sent_headers_for_requests_; | |
| 348 // Number of requests for which OnBeforeRedirect is called. Some redirects | |
| 349 // may not have been followed. | |
| 350 int redirected_requests_; | |
| 342 int destroyed_requests_; | 351 int destroyed_requests_; |
| 343 int completed_requests_; | 352 int completed_requests_; |
| 344 int canceled_requests_; | 353 int canceled_requests_; |
| 345 int cookie_options_bit_mask_; | 354 int cookie_options_bit_mask_; |
| 346 int blocked_get_cookies_count_; | 355 int blocked_get_cookies_count_; |
| 347 int blocked_set_cookie_count_; | 356 int blocked_set_cookie_count_; |
| 348 int set_cookie_count_; | 357 int set_cookie_count_; |
| 349 int observed_before_proxy_headers_sent_callbacks_; | 358 int observed_before_proxy_headers_sent_callbacks_; |
| 350 // Last observed proxy in before proxy header sent callback. | 359 // Last observed proxy in before proxy header sent callback. |
| 351 HostPortPair last_observed_proxy_; | 360 HostPortPair last_observed_proxy_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 NetworkDelegate* network_delegate) const OVERRIDE; | 416 NetworkDelegate* network_delegate) const OVERRIDE; |
| 408 void set_main_intercept_job(URLRequestJob* job); | 417 void set_main_intercept_job(URLRequestJob* job); |
| 409 | 418 |
| 410 private: | 419 private: |
| 411 mutable URLRequestJob* main_intercept_job_; | 420 mutable URLRequestJob* main_intercept_job_; |
| 412 }; | 421 }; |
| 413 | 422 |
| 414 } // namespace net | 423 } // namespace net |
| 415 | 424 |
| 416 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 425 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |