| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } | 267 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } |
| 268 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } | 268 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } |
| 269 int set_cookie_count() const { return set_cookie_count_; } | 269 int set_cookie_count() const { return set_cookie_count_; } |
| 270 | 270 |
| 271 void set_can_access_files(bool val) { can_access_files_ = val; } | 271 void set_can_access_files(bool val) { can_access_files_ = val; } |
| 272 bool can_access_files() const { return can_access_files_; } | 272 bool can_access_files() const { return can_access_files_; } |
| 273 | 273 |
| 274 void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; } | 274 void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; } |
| 275 bool can_throttle_requests() const { return can_throttle_requests_; } | 275 bool can_throttle_requests() const { return can_throttle_requests_; } |
| 276 | 276 |
| 277 int observed_before_proxy_headers_sent_callbacks() const { |
| 278 return observed_before_proxy_headers_sent_callbacks_; |
| 279 } |
| 280 |
| 281 // Last observed proxy in proxy header sent callback. |
| 282 HostPortPair last_observed_proxy() { |
| 283 return last_observed_proxy_; |
| 284 } |
| 285 |
| 277 protected: | 286 protected: |
| 278 // NetworkDelegate: | 287 // NetworkDelegate: |
| 279 virtual int OnBeforeURLRequest(URLRequest* request, | 288 virtual int OnBeforeURLRequest(URLRequest* request, |
| 280 const CompletionCallback& callback, | 289 const CompletionCallback& callback, |
| 281 GURL* new_url) OVERRIDE; | 290 GURL* new_url) OVERRIDE; |
| 282 virtual int OnBeforeSendHeaders(URLRequest* request, | 291 virtual int OnBeforeSendHeaders(URLRequest* request, |
| 283 const CompletionCallback& callback, | 292 const CompletionCallback& callback, |
| 284 HttpRequestHeaders* headers) OVERRIDE; | 293 HttpRequestHeaders* headers) OVERRIDE; |
| 294 virtual void OnBeforeSendProxyHeaders( |
| 295 net::URLRequest* request, |
| 296 const net::ProxyInfo& proxy_info, |
| 297 net::HttpRequestHeaders* headers) OVERRIDE; |
| 285 virtual void OnSendHeaders(URLRequest* request, | 298 virtual void OnSendHeaders(URLRequest* request, |
| 286 const HttpRequestHeaders& headers) OVERRIDE; | 299 const HttpRequestHeaders& headers) OVERRIDE; |
| 287 virtual int OnHeadersReceived( | 300 virtual int OnHeadersReceived( |
| 288 URLRequest* request, | 301 URLRequest* request, |
| 289 const CompletionCallback& callback, | 302 const CompletionCallback& callback, |
| 290 const HttpResponseHeaders* original_response_headers, | 303 const HttpResponseHeaders* original_response_headers, |
| 291 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 304 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
| 292 GURL* allowed_unsafe_redirect_url) OVERRIDE; | 305 GURL* allowed_unsafe_redirect_url) OVERRIDE; |
| 293 virtual void OnBeforeRedirect(URLRequest* request, | 306 virtual void OnBeforeRedirect(URLRequest* request, |
| 294 const GURL& new_location) OVERRIDE; | 307 const GURL& new_location) OVERRIDE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 int last_error_; | 339 int last_error_; |
| 327 int error_count_; | 340 int error_count_; |
| 328 int created_requests_; | 341 int created_requests_; |
| 329 int destroyed_requests_; | 342 int destroyed_requests_; |
| 330 int completed_requests_; | 343 int completed_requests_; |
| 331 int canceled_requests_; | 344 int canceled_requests_; |
| 332 int cookie_options_bit_mask_; | 345 int cookie_options_bit_mask_; |
| 333 int blocked_get_cookies_count_; | 346 int blocked_get_cookies_count_; |
| 334 int blocked_set_cookie_count_; | 347 int blocked_set_cookie_count_; |
| 335 int set_cookie_count_; | 348 int set_cookie_count_; |
| 349 int observed_before_proxy_headers_sent_callbacks_; |
| 350 // Last observed proxy in before proxy header sent callback. |
| 351 HostPortPair last_observed_proxy_; |
| 336 | 352 |
| 337 // NetworkDelegate callbacks happen in a particular order (e.g. | 353 // NetworkDelegate callbacks happen in a particular order (e.g. |
| 338 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). | 354 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). |
| 339 // This bit-set indicates for each request id (key) what events may be sent | 355 // This bit-set indicates for each request id (key) what events may be sent |
| 340 // next. | 356 // next. |
| 341 std::map<int, int> next_states_; | 357 std::map<int, int> next_states_; |
| 342 | 358 |
| 343 // A log that records for each request id (key) the order in which On... | 359 // A log that records for each request id (key) the order in which On... |
| 344 // functions were called. | 360 // functions were called. |
| 345 std::map<int, std::string> event_order_; | 361 std::map<int, std::string> event_order_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 NetworkDelegate* network_delegate) const OVERRIDE; | 407 NetworkDelegate* network_delegate) const OVERRIDE; |
| 392 void set_main_intercept_job(URLRequestJob* job); | 408 void set_main_intercept_job(URLRequestJob* job); |
| 393 | 409 |
| 394 private: | 410 private: |
| 395 mutable URLRequestJob* main_intercept_job_; | 411 mutable URLRequestJob* main_intercept_job_; |
| 396 }; | 412 }; |
| 397 | 413 |
| 398 } // namespace net | 414 } // namespace net |
| 399 | 415 |
| 400 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 416 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |