| 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 #include "net/url_request/url_request_test_util.h" | 5 #include "net/url_request/url_request_test_util.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 blocked_get_cookies_count_(0), | 315 blocked_get_cookies_count_(0), |
| 316 blocked_set_cookie_count_(0), | 316 blocked_set_cookie_count_(0), |
| 317 set_cookie_count_(0), | 317 set_cookie_count_(0), |
| 318 observed_before_proxy_headers_sent_callbacks_(0), | 318 observed_before_proxy_headers_sent_callbacks_(0), |
| 319 before_send_headers_count_(0), | 319 before_send_headers_count_(0), |
| 320 headers_received_count_(0), | 320 headers_received_count_(0), |
| 321 has_load_timing_info_before_redirect_(false), | 321 has_load_timing_info_before_redirect_(false), |
| 322 has_load_timing_info_before_auth_(false), | 322 has_load_timing_info_before_auth_(false), |
| 323 can_access_files_(true), | 323 can_access_files_(true), |
| 324 can_throttle_requests_(true), | 324 can_throttle_requests_(true), |
| 325 first_party_only_cookies_enabled_(false), |
| 325 cancel_request_with_policy_violating_referrer_(false), | 326 cancel_request_with_policy_violating_referrer_(false), |
| 326 will_be_intercepted_on_next_error_(false) { | 327 will_be_intercepted_on_next_error_(false) { |
| 327 } | 328 } |
| 328 | 329 |
| 329 TestNetworkDelegate::~TestNetworkDelegate() { | 330 TestNetworkDelegate::~TestNetworkDelegate() { |
| 330 for (std::map<int, int>::iterator i = next_states_.begin(); | 331 for (std::map<int, int>::iterator i = next_states_.begin(); |
| 331 i != next_states_.end(); ++i) { | 332 i != next_states_.end(); ++i) { |
| 332 event_order_[i->first] += "~TestNetworkDelegate\n"; | 333 event_order_[i->first] += "~TestNetworkDelegate\n"; |
| 333 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; | 334 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; |
| 334 } | 335 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request, | 597 bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request, |
| 597 const base::FilePath& path) const { | 598 const base::FilePath& path) const { |
| 598 return can_access_files_; | 599 return can_access_files_; |
| 599 } | 600 } |
| 600 | 601 |
| 601 bool TestNetworkDelegate::OnCanThrottleRequest( | 602 bool TestNetworkDelegate::OnCanThrottleRequest( |
| 602 const URLRequest& request) const { | 603 const URLRequest& request) const { |
| 603 return can_throttle_requests_; | 604 return can_throttle_requests_; |
| 604 } | 605 } |
| 605 | 606 |
| 607 bool TestNetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const { |
| 608 return first_party_only_cookies_enabled_; |
| 609 } |
| 610 |
| 606 bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 611 bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 607 const URLRequest& request, | 612 const URLRequest& request, |
| 608 const GURL& target_url, | 613 const GURL& target_url, |
| 609 const GURL& referrer_url) const { | 614 const GURL& referrer_url) const { |
| 610 return cancel_request_with_policy_violating_referrer_; | 615 return cancel_request_with_policy_violating_referrer_; |
| 611 } | 616 } |
| 612 | 617 |
| 613 // static | 618 // static |
| 614 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); | 619 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); |
| 615 | 620 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 639 URLRequestJob* job = main_intercept_job_; | 644 URLRequestJob* job = main_intercept_job_; |
| 640 main_intercept_job_ = NULL; | 645 main_intercept_job_ = NULL; |
| 641 return job; | 646 return job; |
| 642 } | 647 } |
| 643 | 648 |
| 644 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 649 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
| 645 main_intercept_job_ = job; | 650 main_intercept_job_ = job; |
| 646 } | 651 } |
| 647 | 652 |
| 648 } // namespace net | 653 } // namespace net |
| OLD | NEW |