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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 completed_requests_(0), | 313 completed_requests_(0), |
314 canceled_requests_(0), | 314 canceled_requests_(0), |
315 cookie_options_bit_mask_(0), | 315 cookie_options_bit_mask_(0), |
316 blocked_get_cookies_count_(0), | 316 blocked_get_cookies_count_(0), |
317 blocked_set_cookie_count_(0), | 317 blocked_set_cookie_count_(0), |
318 set_cookie_count_(0), | 318 set_cookie_count_(0), |
319 observed_before_proxy_headers_sent_callbacks_(0), | 319 observed_before_proxy_headers_sent_callbacks_(0), |
320 has_load_timing_info_before_redirect_(false), | 320 has_load_timing_info_before_redirect_(false), |
321 has_load_timing_info_before_auth_(false), | 321 has_load_timing_info_before_auth_(false), |
322 can_access_files_(true), | 322 can_access_files_(true), |
323 can_throttle_requests_(true) { | 323 can_throttle_requests_(true), |
| 324 cancel_request_with_policy_violating_referrer_(false) { |
324 } | 325 } |
325 | 326 |
326 TestNetworkDelegate::~TestNetworkDelegate() { | 327 TestNetworkDelegate::~TestNetworkDelegate() { |
327 for (std::map<int, int>::iterator i = next_states_.begin(); | 328 for (std::map<int, int>::iterator i = next_states_.begin(); |
328 i != next_states_.end(); ++i) { | 329 i != next_states_.end(); ++i) { |
329 event_order_[i->first] += "~TestNetworkDelegate\n"; | 330 event_order_[i->first] += "~TestNetworkDelegate\n"; |
330 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; | 331 EXPECT_TRUE(i->second & kStageDestruction) << event_order_[i->first]; |
331 } | 332 } |
332 } | 333 } |
333 | 334 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 const URLRequest& request) const { | 598 const URLRequest& request) const { |
598 return can_throttle_requests_; | 599 return can_throttle_requests_; |
599 } | 600 } |
600 | 601 |
601 int TestNetworkDelegate::OnBeforeSocketStreamConnect( | 602 int TestNetworkDelegate::OnBeforeSocketStreamConnect( |
602 SocketStream* socket, | 603 SocketStream* socket, |
603 const CompletionCallback& callback) { | 604 const CompletionCallback& callback) { |
604 return OK; | 605 return OK; |
605 } | 606 } |
606 | 607 |
| 608 bool TestNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 609 const URLRequest& request, |
| 610 const GURL& target_url, |
| 611 const GURL& referrer_url) const { |
| 612 return cancel_request_with_policy_violating_referrer_; |
| 613 } |
| 614 |
607 // static | 615 // static |
608 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); | 616 std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); |
609 | 617 |
610 ScopedCustomUrlRequestTestHttpHost::ScopedCustomUrlRequestTestHttpHost( | 618 ScopedCustomUrlRequestTestHttpHost::ScopedCustomUrlRequestTestHttpHost( |
611 const std::string& new_value) | 619 const std::string& new_value) |
612 : old_value_(value_), | 620 : old_value_(value_), |
613 new_value_(new_value) { | 621 new_value_(new_value) { |
614 value_ = new_value_; | 622 value_ = new_value_; |
615 } | 623 } |
616 | 624 |
(...skipping 16 matching lines...) Expand all Loading... |
633 URLRequestJob* job = main_intercept_job_; | 641 URLRequestJob* job = main_intercept_job_; |
634 main_intercept_job_ = NULL; | 642 main_intercept_job_ = NULL; |
635 return job; | 643 return job; |
636 } | 644 } |
637 | 645 |
638 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 646 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
639 main_intercept_job_ = job; | 647 main_intercept_job_ = job; |
640 } | 648 } |
641 | 649 |
642 } // namespace net | 650 } // namespace net |
OLD | NEW |