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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 std::unique_ptr<NavigationHandleImpl> test_handle_; | 190 std::unique_ptr<NavigationHandleImpl> test_handle_; |
191 bool was_callback_called_; | 191 bool was_callback_called_; |
192 NavigationThrottle::ThrottleCheckResult callback_result_; | 192 NavigationThrottle::ThrottleCheckResult callback_result_; |
193 }; | 193 }; |
194 | 194 |
195 // Checks that the request_context_type is properly set. | 195 // Checks that the request_context_type is properly set. |
196 // Note: can be extended to cover more internal members. | 196 // Note: can be extended to cover more internal members. |
197 TEST_F(NavigationHandleImplTest, SimpleDataChecks) { | 197 TEST_F(NavigationHandleImplTest, SimpleDataChecks) { |
198 SimulateWillStartRequest(); | 198 SimulateWillStartRequest(); |
199 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, | 199 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, |
200 test_handle()->GetRequestContextType()); | 200 test_handle()->request_context_type()); |
201 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, | 201 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, |
202 test_handle()->GetConnectionInfo()); | 202 test_handle()->GetConnectionInfo()); |
203 | 203 |
204 test_handle()->Resume(); | 204 test_handle()->Resume(); |
205 SimulateWillRedirectRequest(); | 205 SimulateWillRedirectRequest(); |
206 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, | 206 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, |
207 test_handle()->GetRequestContextType()); | 207 test_handle()->request_context_type()); |
208 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, | 208 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, |
209 test_handle()->GetConnectionInfo()); | 209 test_handle()->GetConnectionInfo()); |
210 | 210 |
211 test_handle()->Resume(); | 211 test_handle()->Resume(); |
212 SimulateWillProcessResponse(); | 212 SimulateWillProcessResponse(); |
213 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, | 213 EXPECT_EQ(REQUEST_CONTEXT_TYPE_LOCATION, |
214 test_handle()->GetRequestContextType()); | 214 test_handle()->request_context_type()); |
215 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, | 215 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, |
216 test_handle()->GetConnectionInfo()); | 216 test_handle()->GetConnectionInfo()); |
217 } | 217 } |
218 | 218 |
219 TEST_F(NavigationHandleImplTest, SimpleDataCheckNoRedirect) { | 219 TEST_F(NavigationHandleImplTest, SimpleDataCheckNoRedirect) { |
220 SimulateWillStartRequest(); | 220 SimulateWillStartRequest(); |
221 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, | 221 EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, |
222 test_handle()->GetConnectionInfo()); | 222 test_handle()->GetConnectionInfo()); |
223 | 223 |
224 test_handle()->Resume(); | 224 test_handle()->Resume(); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); | 688 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); |
689 EXPECT_EQ(0, cancel_throttle->will_start_calls()); | 689 EXPECT_EQ(0, cancel_throttle->will_start_calls()); |
690 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); | 690 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); |
691 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); | 691 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); |
692 EXPECT_EQ(0, proceed_throttle->will_start_calls()); | 692 EXPECT_EQ(0, proceed_throttle->will_start_calls()); |
693 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); | 693 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); |
694 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); | 694 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); |
695 } | 695 } |
696 | 696 |
697 } // namespace content | 697 } // namespace content |
OLD | NEW |