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/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 blocked_set_cookie_count_(0), | 325 blocked_set_cookie_count_(0), |
326 set_cookie_count_(0), | 326 set_cookie_count_(0), |
327 observed_before_proxy_headers_sent_callbacks_(0), | 327 observed_before_proxy_headers_sent_callbacks_(0), |
328 before_send_headers_count_(0), | 328 before_send_headers_count_(0), |
329 headers_received_count_(0), | 329 headers_received_count_(0), |
330 total_network_bytes_received_(0), | 330 total_network_bytes_received_(0), |
331 total_network_bytes_sent_(0), | 331 total_network_bytes_sent_(0), |
332 has_load_timing_info_before_redirect_(false), | 332 has_load_timing_info_before_redirect_(false), |
333 has_load_timing_info_before_auth_(false), | 333 has_load_timing_info_before_auth_(false), |
334 can_access_files_(true), | 334 can_access_files_(true), |
335 first_party_only_cookies_enabled_(false), | 335 experimental_cookie_features_enabled_(false), |
336 cancel_request_with_policy_violating_referrer_(false), | 336 cancel_request_with_policy_violating_referrer_(false), |
337 will_be_intercepted_on_next_error_(false) {} | 337 will_be_intercepted_on_next_error_(false) {} |
338 | 338 |
339 TestNetworkDelegate::~TestNetworkDelegate() { | 339 TestNetworkDelegate::~TestNetworkDelegate() { |
340 for (std::map<int, int>::iterator i = next_states_.begin(); | 340 for (std::map<int, int>::iterator i = next_states_.begin(); |
341 i != next_states_.end(); ++i) { | 341 i != next_states_.end(); ++i) { |
342 event_order_[i->first] += "~TestNetworkDelegate\n"; | 342 event_order_[i->first] += "~TestNetworkDelegate\n"; |
343 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; | 343 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; |
344 } | 344 } |
345 } | 345 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 } | 609 } |
610 | 610 |
611 return allow; | 611 return allow; |
612 } | 612 } |
613 | 613 |
614 bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request, | 614 bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request, |
615 const base::FilePath& path) const { | 615 const base::FilePath& path) const { |
616 return can_access_files_; | 616 return can_access_files_; |
617 } | 617 } |
618 | 618 |
619 bool TestNetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const { | 619 bool TestNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { |
620 return first_party_only_cookies_enabled_; | 620 return experimental_cookie_features_enabled_; |
621 } | 621 } |
622 | 622 |
623 bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 623 bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
624 const URLRequest& request, | 624 const URLRequest& request, |
625 const GURL& target_url, | 625 const GURL& target_url, |
626 const GURL& referrer_url) const { | 626 const GURL& referrer_url) const { |
627 return cancel_request_with_policy_violating_referrer_; | 627 return cancel_request_with_policy_violating_referrer_; |
628 } | 628 } |
629 | 629 |
630 TestJobInterceptor::TestJobInterceptor() : main_intercept_job_(NULL) { | 630 TestJobInterceptor::TestJobInterceptor() : main_intercept_job_(NULL) { |
631 } | 631 } |
632 | 632 |
633 URLRequestJob* TestJobInterceptor::MaybeCreateJob( | 633 URLRequestJob* TestJobInterceptor::MaybeCreateJob( |
634 URLRequest* request, | 634 URLRequest* request, |
635 NetworkDelegate* network_delegate) const { | 635 NetworkDelegate* network_delegate) const { |
636 URLRequestJob* job = main_intercept_job_; | 636 URLRequestJob* job = main_intercept_job_; |
637 main_intercept_job_ = NULL; | 637 main_intercept_job_ = NULL; |
638 return job; | 638 return job; |
639 } | 639 } |
640 | 640 |
641 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 641 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
642 main_intercept_job_ = job; | 642 main_intercept_job_ = job; |
643 } | 643 } |
644 | 644 |
645 } // namespace net | 645 } // namespace net |
OLD | NEW |