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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // the throttle checks when they are finished. | 106 // the throttle checks when they are finished. |
107 void SimulateWillStartRequest() { | 107 void SimulateWillStartRequest() { |
108 was_callback_called_ = false; | 108 was_callback_called_ = false; |
109 callback_result_ = NavigationThrottle::DEFER; | 109 callback_result_ = NavigationThrottle::DEFER; |
110 | 110 |
111 // It's safe to use base::Unretained since the NavigationHandle is owned by | 111 // It's safe to use base::Unretained since the NavigationHandle is owned by |
112 // the NavigationHandleImplTest. | 112 // the NavigationHandleImplTest. |
113 test_handle_->WillStartRequest( | 113 test_handle_->WillStartRequest( |
114 "GET", nullptr, Referrer(), false, ui::PAGE_TRANSITION_LINK, false, | 114 "GET", nullptr, Referrer(), false, ui::PAGE_TRANSITION_LINK, false, |
115 REQUEST_CONTEXT_TYPE_LOCATION, | 115 REQUEST_CONTEXT_TYPE_LOCATION, |
| 116 blink::WebMixedContentContextType::Blockable, |
116 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, | 117 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, |
117 base::Unretained(this))); | 118 base::Unretained(this))); |
118 } | 119 } |
119 | 120 |
120 // Helper function to call WillRedirectRequest on |handle|. If this function | 121 // Helper function to call WillRedirectRequest on |handle|. If this function |
121 // returns DEFER, |callback_result_| will be set to the actual result of the | 122 // returns DEFER, |callback_result_| will be set to the actual result of the |
122 // throttle checks when they are finished. | 123 // throttle checks when they are finished. |
123 // TODO(clamy): this should also simulate that WillStartRequest was called if | 124 // TODO(clamy): this should also simulate that WillStartRequest was called if |
124 // it has not been called before. | 125 // it has not been called before. |
125 void SimulateWillRedirectRequest() { | 126 void SimulateWillRedirectRequest() { |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 EXPECT_EQ(NavigationThrottle::BLOCK_RESPONSE, callback_result()); | 726 EXPECT_EQ(NavigationThrottle::BLOCK_RESPONSE, callback_result()); |
726 EXPECT_EQ(0, cancel_throttle->will_start_calls()); | 727 EXPECT_EQ(0, cancel_throttle->will_start_calls()); |
727 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); | 728 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); |
728 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); | 729 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); |
729 EXPECT_EQ(0, proceed_throttle->will_start_calls()); | 730 EXPECT_EQ(0, proceed_throttle->will_start_calls()); |
730 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); | 731 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); |
731 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); | 732 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); |
732 } | 733 } |
733 | 734 |
734 } // namespace content | 735 } // namespace content |
OLD | NEW |