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 <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 | 283 |
284 int observed_before_proxy_headers_sent_callbacks() const { | 284 int observed_before_proxy_headers_sent_callbacks() const { |
285 return observed_before_proxy_headers_sent_callbacks_; | 285 return observed_before_proxy_headers_sent_callbacks_; |
286 } | 286 } |
287 int before_send_headers_count() const { return before_send_headers_count_; } | 287 int before_send_headers_count() const { return before_send_headers_count_; } |
288 int headers_received_count() const { return headers_received_count_; } | 288 int headers_received_count() const { return headers_received_count_; } |
289 int64_t total_network_bytes_received() const { | 289 int64_t total_network_bytes_received() const { |
290 return total_network_bytes_received_; | 290 return total_network_bytes_received_; |
291 } | 291 } |
| 292 int64_t total_network_bytes_sent() const { return total_network_bytes_sent_; } |
292 | 293 |
293 // Last observed proxy in proxy header sent callback. | 294 // Last observed proxy in proxy header sent callback. |
294 HostPortPair last_observed_proxy() { | 295 HostPortPair last_observed_proxy() { |
295 return last_observed_proxy_; | 296 return last_observed_proxy_; |
296 } | 297 } |
297 | 298 |
298 void set_can_be_intercepted_on_error(bool can_be_intercepted_on_error) { | 299 void set_can_be_intercepted_on_error(bool can_be_intercepted_on_error) { |
299 will_be_intercepted_on_next_error_ = can_be_intercepted_on_error; | 300 will_be_intercepted_on_next_error_ = can_be_intercepted_on_error; |
300 } | 301 } |
301 | 302 |
(...skipping 13 matching lines...) Expand all Loading... |
315 int OnHeadersReceived( | 316 int OnHeadersReceived( |
316 URLRequest* request, | 317 URLRequest* request, |
317 const CompletionCallback& callback, | 318 const CompletionCallback& callback, |
318 const HttpResponseHeaders* original_response_headers, | 319 const HttpResponseHeaders* original_response_headers, |
319 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 320 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
320 GURL* allowed_unsafe_redirect_url) override; | 321 GURL* allowed_unsafe_redirect_url) override; |
321 void OnBeforeRedirect(URLRequest* request, const GURL& new_location) override; | 322 void OnBeforeRedirect(URLRequest* request, const GURL& new_location) override; |
322 void OnResponseStarted(URLRequest* request) override; | 323 void OnResponseStarted(URLRequest* request) override; |
323 void OnNetworkBytesReceived(const URLRequest& request, | 324 void OnNetworkBytesReceived(const URLRequest& request, |
324 int64_t bytes_received) override; | 325 int64_t bytes_received) override; |
| 326 void OnNetworkBytesSent(const URLRequest& request, |
| 327 int64_t bytes_sent) override; |
325 void OnCompleted(URLRequest* request, bool started) override; | 328 void OnCompleted(URLRequest* request, bool started) override; |
326 void OnURLRequestDestroyed(URLRequest* request) override; | 329 void OnURLRequestDestroyed(URLRequest* request) override; |
327 void OnPACScriptError(int line_number, const base::string16& error) override; | 330 void OnPACScriptError(int line_number, const base::string16& error) override; |
328 NetworkDelegate::AuthRequiredResponse OnAuthRequired( | 331 NetworkDelegate::AuthRequiredResponse OnAuthRequired( |
329 URLRequest* request, | 332 URLRequest* request, |
330 const AuthChallengeInfo& auth_info, | 333 const AuthChallengeInfo& auth_info, |
331 const AuthCallback& callback, | 334 const AuthCallback& callback, |
332 AuthCredentials* credentials) override; | 335 AuthCredentials* credentials) override; |
333 bool OnCanGetCookies(const URLRequest& request, | 336 bool OnCanGetCookies(const URLRequest& request, |
334 const CookieList& cookie_list) override; | 337 const CookieList& cookie_list) override; |
(...skipping 21 matching lines...) Expand all Loading... |
356 int completed_requests_; | 359 int completed_requests_; |
357 int canceled_requests_; | 360 int canceled_requests_; |
358 int cookie_options_bit_mask_; | 361 int cookie_options_bit_mask_; |
359 int blocked_get_cookies_count_; | 362 int blocked_get_cookies_count_; |
360 int blocked_set_cookie_count_; | 363 int blocked_set_cookie_count_; |
361 int set_cookie_count_; | 364 int set_cookie_count_; |
362 int observed_before_proxy_headers_sent_callbacks_; | 365 int observed_before_proxy_headers_sent_callbacks_; |
363 int before_send_headers_count_; | 366 int before_send_headers_count_; |
364 int headers_received_count_; | 367 int headers_received_count_; |
365 int64_t total_network_bytes_received_; | 368 int64_t total_network_bytes_received_; |
| 369 int64_t total_network_bytes_sent_; |
366 // Last observed proxy in before proxy header sent callback. | 370 // Last observed proxy in before proxy header sent callback. |
367 HostPortPair last_observed_proxy_; | 371 HostPortPair last_observed_proxy_; |
368 | 372 |
369 // NetworkDelegate callbacks happen in a particular order (e.g. | 373 // NetworkDelegate callbacks happen in a particular order (e.g. |
370 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). | 374 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). |
371 // This bit-set indicates for each request id (key) what events may be sent | 375 // This bit-set indicates for each request id (key) what events may be sent |
372 // next. | 376 // next. |
373 std::map<int, int> next_states_; | 377 std::map<int, int> next_states_; |
374 | 378 |
375 // A log that records for each request id (key) the order in which On... | 379 // A log that records for each request id (key) the order in which On... |
(...skipping 24 matching lines...) Expand all Loading... |
400 NetworkDelegate* network_delegate) const override; | 404 NetworkDelegate* network_delegate) const override; |
401 void set_main_intercept_job(URLRequestJob* job); | 405 void set_main_intercept_job(URLRequestJob* job); |
402 | 406 |
403 private: | 407 private: |
404 mutable URLRequestJob* main_intercept_job_; | 408 mutable URLRequestJob* main_intercept_job_; |
405 }; | 409 }; |
406 | 410 |
407 } // namespace net | 411 } // namespace net |
408 | 412 |
409 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 413 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
OLD | NEW |