| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "content/browser/frame_host/navigation_handle_impl.h" | 6 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 7 #include "content/public/browser/navigation_throttle.h" | 7 #include "content/public/browser/navigation_throttle.h" |
| 8 #include "content/public/browser/ssl_status.h" | 8 #include "content/public/browser/ssl_status.h" |
| 9 #include "content/public/common/request_context_type.h" | 9 #include "content/public/common/request_context_type.h" |
| 10 #include "content/test/test_render_frame_host.h" | 10 #include "content/test/test_render_frame_host.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // TODO(clamy): this should also simulate that WillStartRequest was called if | 128 // TODO(clamy): this should also simulate that WillStartRequest was called if |
| 129 // it has not been called before. | 129 // it has not been called before. |
| 130 void SimulateWillRedirectRequest() { | 130 void SimulateWillRedirectRequest() { |
| 131 was_callback_called_ = false; | 131 was_callback_called_ = false; |
| 132 callback_result_ = NavigationThrottle::DEFER; | 132 callback_result_ = NavigationThrottle::DEFER; |
| 133 | 133 |
| 134 // It's safe to use base::Unretained since the NavigationHandle is owned by | 134 // It's safe to use base::Unretained since the NavigationHandle is owned by |
| 135 // the NavigationHandleImplTest. | 135 // the NavigationHandleImplTest. |
| 136 test_handle_->WillRedirectRequest( | 136 test_handle_->WillRedirectRequest( |
| 137 GURL(), "GET", GURL(), false, scoped_refptr<net::HttpResponseHeaders>(), | 137 GURL(), "GET", GURL(), false, scoped_refptr<net::HttpResponseHeaders>(), |
| 138 net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, | 138 net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, nullptr, |
| 139 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, | 139 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, |
| 140 base::Unretained(this))); | 140 base::Unretained(this))); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Helper function to call WillProcessResponse on |handle|. If this function | 143 // Helper function to call WillProcessResponse on |handle|. If this function |
| 144 // returns DEFER, |callback_result_| will be set to the actual result of the | 144 // returns DEFER, |callback_result_| will be set to the actual result of the |
| 145 // throttle checks when they are finished. | 145 // throttle checks when they are finished. |
| 146 // TODO(clamy): this should also simulate that WillStartRequest was called if | 146 // TODO(clamy): this should also simulate that WillStartRequest was called if |
| 147 // it has not been called before. | 147 // it has not been called before. |
| 148 void SimulateWillProcessResponse() { | 148 void SimulateWillProcessResponse() { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 EXPECT_EQ(NavigationThrottle::BLOCK_RESPONSE, callback_result()); | 730 EXPECT_EQ(NavigationThrottle::BLOCK_RESPONSE, callback_result()); |
| 731 EXPECT_EQ(0, cancel_throttle->will_start_calls()); | 731 EXPECT_EQ(0, cancel_throttle->will_start_calls()); |
| 732 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); | 732 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); |
| 733 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); | 733 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); |
| 734 EXPECT_EQ(0, proceed_throttle->will_start_calls()); | 734 EXPECT_EQ(0, proceed_throttle->will_start_calls()); |
| 735 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); | 735 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); |
| 736 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); | 736 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); |
| 737 } | 737 } |
| 738 | 738 |
| 739 } // namespace content | 739 } // namespace content |
| OLD | NEW |