clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 5 | #include "content/browser/frame_host/navigation_request.h" |
Sebastien Marchand | f8cbfab | 2019-01-25 16:02:30 | [diff] [blame] | 6 | #include "base/bind.h" |
Charles Harrison | 860f7ef | 2017-06-28 15:31:41 | [diff] [blame] | 7 | #include "base/macros.h" |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 8 | #include "base/optional.h" |
Becky Zhou | 9898cb6e | 2019-06-05 00:35:30 | [diff] [blame] | 9 | #include "build/build_config.h" |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 10 | #include "content/public/browser/navigation_throttle.h" |
jam | 6d47c345 | 2016-09-09 18:51:01 | [diff] [blame] | 11 | #include "content/public/browser/ssl_status.h" |
Hans Wennborg | 5ffd139 | 2019-10-16 11:00:02 | [diff] [blame] | 12 | #include "content/public/common/content_client.h" |
Charles Harrison | 860f7ef | 2017-06-28 15:31:41 | [diff] [blame] | 13 | #include "content/public/common/url_constants.h" |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 14 | #include "content/public/test/test_navigation_throttle.h" |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 15 | #include "content/test/navigation_simulator_impl.h" |
Charles Harrison | 860f7ef | 2017-06-28 15:31:41 | [diff] [blame] | 16 | #include "content/test/test_content_browser_client.h" |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 17 | #include "content/test/test_render_frame_host.h" |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 18 | #include "content/test/test_web_contents.h" |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 19 | #include "net/ssl/ssl_connection_status_flags.h" |
Richard Li | e689995 | 2018-11-30 08:42:00 | [diff] [blame] | 20 | #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h" |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 21 | |
| 22 | namespace content { |
| 23 | |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 24 | // Test version of a NavigationThrottle that will execute a callback when |
| 25 | // called. |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 26 | class DeletingNavigationThrottle : public NavigationThrottle { |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 27 | public: |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 28 | DeletingNavigationThrottle(NavigationHandle* handle, |
| 29 | const base::RepeatingClosure& deletion_callback) |
| 30 | : NavigationThrottle(handle), deletion_callback_(deletion_callback) {} |
| 31 | ~DeletingNavigationThrottle() override {} |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 32 | |
| 33 | NavigationThrottle::ThrottleCheckResult WillStartRequest() override { |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 34 | deletion_callback_.Run(); |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 35 | return NavigationThrottle::PROCEED; |
| 36 | } |
| 37 | |
| 38 | NavigationThrottle::ThrottleCheckResult WillRedirectRequest() override { |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 39 | deletion_callback_.Run(); |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 40 | return NavigationThrottle::PROCEED; |
| 41 | } |
| 42 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 43 | NavigationThrottle::ThrottleCheckResult WillFailRequest() override { |
| 44 | deletion_callback_.Run(); |
| 45 | return NavigationThrottle::PROCEED; |
| 46 | } |
| 47 | |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 48 | NavigationThrottle::ThrottleCheckResult WillProcessResponse() override { |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 49 | deletion_callback_.Run(); |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 50 | return NavigationThrottle::PROCEED; |
| 51 | } |
| 52 | |
| 53 | const char* GetNameForLogging() override { |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 54 | return "DeletingNavigationThrottle"; |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | private: |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 58 | base::RepeatingClosure deletion_callback_; |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 59 | }; |
| 60 | |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 61 | class NavigationRequestTest : public RenderViewHostImplTestHarness { |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 62 | public: |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 63 | NavigationRequestTest() |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 64 | : was_callback_called_(false), |
| 65 | callback_result_(NavigationThrottle::DEFER) {} |
| 66 | |
| 67 | void SetUp() override { |
| 68 | RenderViewHostImplTestHarness::SetUp(); |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 69 | CreateNavigationHandle(); |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 70 | contents()->GetMainFrame()->InitializeRenderFrameIfNeeded(); |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | void TearDown() override { |
Mohamed Abdelhalim | b7cabb1 | 2019-03-26 13:31:25 | [diff] [blame] | 74 | // Release the |request_| before destroying the WebContents, to match |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 75 | // the WebContentsObserverSanityChecker expectations. |
Mohamed Abdelhalim | b7cabb1 | 2019-03-26 13:31:25 | [diff] [blame] | 76 | request_.reset(); |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 77 | RenderViewHostImplTestHarness::TearDown(); |
| 78 | } |
| 79 | |
Charles Harrison | 4f2bf1a | 2017-07-18 20:21:21 | [diff] [blame] | 80 | void CancelDeferredNavigation( |
| 81 | NavigationThrottle::ThrottleCheckResult result) { |
Mohamed Abdelhalim | 9ef43fc | 2019-04-05 13:09:43 | [diff] [blame] | 82 | request_->CancelDeferredNavigationInternal(result); |
Charles Harrison | 4f2bf1a | 2017-07-18 20:21:21 | [diff] [blame] | 83 | } |
| 84 | |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 85 | // Helper function to call WillStartRequest on |handle|. If this function |
| 86 | // returns DEFER, |callback_result_| will be set to the actual result of |
| 87 | // the throttle checks when they are finished. |
| 88 | void SimulateWillStartRequest() { |
| 89 | was_callback_called_ = false; |
| 90 | callback_result_ = NavigationThrottle::DEFER; |
| 91 | |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 92 | // It's safe to use base::Unretained since the NavigationRequest is owned by |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 93 | // the NavigationRequestTest. |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 94 | request_->set_complete_callback_for_testing( |
Makoto Shimazu | d2aa220 | 2019-10-09 13:57:18 | [diff] [blame] | 95 | base::BindOnce(&NavigationRequestTest::UpdateThrottleCheckResult, |
| 96 | base::Unretained(this))); |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 97 | |
| 98 | request_->WillStartRequest(); |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | // Helper function to call WillRedirectRequest on |handle|. If this function |
| 102 | // returns DEFER, |callback_result_| will be set to the actual result of the |
| 103 | // throttle checks when they are finished. |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 104 | // TODO(clamy): this should also simulate that WillStartRequest was called if |
| 105 | // it has not been called before. |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 106 | void SimulateWillRedirectRequest() { |
| 107 | was_callback_called_ = false; |
| 108 | callback_result_ = NavigationThrottle::DEFER; |
| 109 | |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 110 | // It's safe to use base::Unretained since the NavigationRequest is owned by |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 111 | // the NavigationRequestTest. |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 112 | request_->set_complete_callback_for_testing( |
Makoto Shimazu | d2aa220 | 2019-10-09 13:57:18 | [diff] [blame] | 113 | base::BindOnce(&NavigationRequestTest::UpdateThrottleCheckResult, |
| 114 | base::Unretained(this))); |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 115 | |
| 116 | request_->WillRedirectRequest(GURL(), nullptr); |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 117 | } |
| 118 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 119 | // Helper function to call WillFailRequest on |handle|. If this function |
| 120 | // returns DEFER, |callback_result_| will be set to the actual result of the |
| 121 | // throttle checks when they are finished. |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 122 | void SimulateWillFailRequest( |
| 123 | net::Error net_error_code, |
| 124 | const base::Optional<net::SSLInfo> ssl_info = base::nullopt) { |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 125 | was_callback_called_ = false; |
| 126 | callback_result_ = NavigationThrottle::DEFER; |
Mohamed Abdelhalim | b4db22a | 2019-06-18 10:46:52 | [diff] [blame] | 127 | request_->set_net_error(net_error_code); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 128 | |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 129 | // It's safe to use base::Unretained since the NavigationRequest is owned by |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 130 | // the NavigationRequestTest. |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 131 | request_->set_complete_callback_for_testing( |
Makoto Shimazu | d2aa220 | 2019-10-09 13:57:18 | [diff] [blame] | 132 | base::BindOnce(&NavigationRequestTest::UpdateThrottleCheckResult, |
| 133 | base::Unretained(this))); |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 134 | |
| 135 | request_->WillFailRequest(); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 136 | } |
| 137 | |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 138 | // Whether the callback was called. |
| 139 | bool was_callback_called() const { return was_callback_called_; } |
| 140 | |
| 141 | // Returns the callback_result. |
| 142 | NavigationThrottle::ThrottleCheckResult callback_result() const { |
| 143 | return callback_result_; |
| 144 | } |
| 145 | |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 146 | NavigationRequest::NavigationState state() { return request_->state(); } |
Mohamed Abdelhalim | ccd149af | 2019-10-31 14:48:53 | [diff] [blame] | 147 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 148 | bool call_counts_match(TestNavigationThrottle* throttle, |
| 149 | int start, |
| 150 | int redirect, |
| 151 | int failure, |
| 152 | int process) { |
| 153 | return start == throttle->GetCallCount( |
| 154 | TestNavigationThrottle::WILL_START_REQUEST) && |
| 155 | redirect == throttle->GetCallCount( |
| 156 | TestNavigationThrottle::WILL_REDIRECT_REQUEST) && |
| 157 | failure == throttle->GetCallCount( |
| 158 | TestNavigationThrottle::WILL_FAIL_REQUEST) && |
| 159 | process == throttle->GetCallCount( |
| 160 | TestNavigationThrottle::WILL_PROCESS_RESPONSE); |
| 161 | } |
| 162 | |
| 163 | // Creates, register and returns a TestNavigationThrottle that will |
| 164 | // synchronously return |result| on checks by default. |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 165 | TestNavigationThrottle* CreateTestNavigationThrottle( |
| 166 | NavigationThrottle::ThrottleCheckResult result) { |
| 167 | TestNavigationThrottle* test_throttle = |
Mohamed Abdelhalim | f03d4a2 | 2019-10-01 13:34:31 | [diff] [blame] | 168 | new TestNavigationThrottle(request_.get()); |
Lucas Garron | 79e1a97 | 2017-10-04 22:25:06 | [diff] [blame] | 169 | test_throttle->SetResponseForAllMethods(TestNavigationThrottle::SYNCHRONOUS, |
| 170 | result); |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 171 | request_->RegisterThrottleForTesting( |
dcheng | 9bfa516 | 2016-04-09 01:00:57 | [diff] [blame] | 172 | std::unique_ptr<TestNavigationThrottle>(test_throttle)); |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 173 | return test_throttle; |
| 174 | } |
| 175 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 176 | // Creates, register and returns a TestNavigationThrottle that will |
| 177 | // synchronously return |result| on check for the given |method|, and |
| 178 | // NavigationThrottle::PROCEED otherwise. |
| 179 | TestNavigationThrottle* CreateTestNavigationThrottle( |
| 180 | TestNavigationThrottle::ThrottleMethod method, |
| 181 | NavigationThrottle::ThrottleCheckResult result) { |
| 182 | TestNavigationThrottle* test_throttle = |
| 183 | CreateTestNavigationThrottle(NavigationThrottle::PROCEED); |
| 184 | test_throttle->SetResponse(method, TestNavigationThrottle::SYNCHRONOUS, |
| 185 | result); |
| 186 | return test_throttle; |
| 187 | } |
| 188 | |
Mohamed Abdelhalim | 9ef43fc | 2019-04-05 13:09:43 | [diff] [blame] | 189 | // TODO(zetamoo): Use NavigationSimulator instead of creating |
| 190 | // NavigationRequest and NavigationHandleImpl. |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 191 | void CreateNavigationHandle() { |
Lucas Furukawa Gadani | eeddf2de | 2019-08-01 23:37:57 | [diff] [blame] | 192 | auto common_params = CreateCommonNavigationParams(); |
Lucas Furukawa Gadani | ef8290a | 2019-07-29 20:27:51 | [diff] [blame] | 193 | common_params->initiator_origin = |
Lukasz Anforowicz | 435bcb58 | 2019-07-12 20:50:06 | [diff] [blame] | 194 | url::Origin::Create(GURL("https://initiator.example.com")); |
Camille Lamy | 7c02ec70 | 2019-01-17 17:50:23 | [diff] [blame] | 195 | request_ = NavigationRequest::CreateBrowserInitiated( |
Lucas Furukawa Gadani | ef8290a | 2019-07-29 20:27:51 | [diff] [blame] | 196 | main_test_rfh()->frame_tree_node(), std::move(common_params), |
Lucas Furukawa Gadani | a9c4568 | 2019-07-31 22:05:14 | [diff] [blame] | 197 | CreateCommitNavigationParams(), false /* browser-initiated */, |
John Delaney | 50425f8 | 2020-04-07 16:26:21 | [diff] [blame^] | 198 | std::string() /* extra_headers */, nullptr /* frame_entry */, |
| 199 | nullptr /* entry */, nullptr /* post_body */, |
| 200 | nullptr /* navigation_ui_data */, base::nullopt /* impression */); |
Mohamed Abdelhalim | f03d4a2 | 2019-10-01 13:34:31 | [diff] [blame] | 201 | request_->StartNavigation(true); |
clamy | 1d4e78fd | 2017-07-11 12:59:19 | [diff] [blame] | 202 | } |
| 203 | |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 204 | private: |
Mohamed Abdelhalim | f03d4a2 | 2019-10-01 13:34:31 | [diff] [blame] | 205 | // The callback provided to NavigationRequest::WillStartRequest, |
| 206 | // NavigationRequest::WillRedirectRequest, and |
| 207 | // NavigationRequest::WillFailRequest during the tests. |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 208 | bool UpdateThrottleCheckResult( |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 209 | NavigationThrottle::ThrottleCheckResult result) { |
| 210 | callback_result_ = result; |
| 211 | was_callback_called_ = true; |
Mohamed Abdelhalim | 7e9e9c1 | 2019-11-26 13:48:44 | [diff] [blame] | 212 | return true; |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 213 | } |
| 214 | |
Camille Lamy | 7c02ec70 | 2019-01-17 17:50:23 | [diff] [blame] | 215 | std::unique_ptr<NavigationRequest> request_; |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 216 | bool was_callback_called_; |
| 217 | NavigationThrottle::ThrottleCheckResult callback_result_; |
| 218 | }; |
| 219 | |
carlosk | 489d9e2 | 2016-07-25 14:25:43 | [diff] [blame] | 220 | // Checks that the request_context_type is properly set. |
| 221 | // Note: can be extended to cover more internal members. |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 222 | TEST_F(NavigationRequestTest, SimpleDataChecksRedirectAndProcess) { |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 223 | const GURL kUrl1 = GURL("http://chromium.org"); |
| 224 | const GURL kUrl2 = GURL("http://google.com"); |
| 225 | auto navigation = |
| 226 | NavigationSimulatorImpl::CreateRendererInitiated(kUrl1, main_rfh()); |
| 227 | navigation->Start(); |
| 228 | EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 229 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 230 | ->request_context_type()); |
jkarlin | bb15011 | 2016-11-02 17:55:11 | [diff] [blame] | 231 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 232 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
carlosk | 489d9e2 | 2016-07-25 14:25:43 | [diff] [blame] | 233 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 234 | navigation->set_http_connection_info( |
| 235 | net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1); |
| 236 | navigation->Redirect(kUrl2); |
| 237 | EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 238 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 239 | ->request_context_type()); |
jkarlin | bb15011 | 2016-11-02 17:55:11 | [diff] [blame] | 240 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 241 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
carlosk | 489d9e2 | 2016-07-25 14:25:43 | [diff] [blame] | 242 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 243 | navigation->set_http_connection_info( |
| 244 | net::HttpResponseInfo::CONNECTION_INFO_QUIC_35); |
| 245 | navigation->ReadyToCommit(); |
| 246 | EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 247 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 248 | ->request_context_type()); |
bnc | 90be5dd78 | 2016-11-09 16:28:44 | [diff] [blame] | 249 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 250 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
jkarlin | bb15011 | 2016-11-02 17:55:11 | [diff] [blame] | 251 | } |
| 252 | |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 253 | TEST_F(NavigationRequestTest, SimpleDataCheckNoRedirect) { |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 254 | const GURL kUrl = GURL("http://chromium.org"); |
| 255 | auto navigation = |
| 256 | NavigationSimulatorImpl::CreateRendererInitiated(kUrl, main_rfh()); |
| 257 | navigation->Start(); |
jkarlin | bb15011 | 2016-11-02 17:55:11 | [diff] [blame] | 258 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 259 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
jkarlin | bb15011 | 2016-11-02 17:55:11 | [diff] [blame] | 260 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 261 | navigation->set_http_connection_info( |
| 262 | net::HttpResponseInfo::CONNECTION_INFO_QUIC_35); |
| 263 | navigation->ReadyToCommit(); |
bnc | 90be5dd78 | 2016-11-09 16:28:44 | [diff] [blame] | 264 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_QUIC_35, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 265 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
carlosk | 489d9e2 | 2016-07-25 14:25:43 | [diff] [blame] | 266 | } |
| 267 | |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 268 | TEST_F(NavigationRequestTest, SimpleDataChecksFailure) { |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 269 | const GURL kUrl = GURL("http://chromium.org"); |
| 270 | auto navigation = |
| 271 | NavigationSimulatorImpl::CreateRendererInitiated(kUrl, main_rfh()); |
| 272 | navigation->Start(); |
| 273 | EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 274 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 275 | ->request_context_type()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 276 | EXPECT_EQ(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 277 | navigation->GetNavigationHandle()->GetConnectionInfo()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 278 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 279 | navigation->Fail(net::ERR_CERT_DATE_INVALID); |
| 280 | EXPECT_EQ(blink::mojom::RequestContextType::HYPERLINK, |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 281 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 282 | ->request_context_type()); |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 283 | EXPECT_EQ(net::ERR_CERT_DATE_INVALID, |
| 284 | navigation->GetNavigationHandle()->GetNetErrorCode()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 285 | } |
| 286 | |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 287 | // Checks that a navigation deferred during WillStartRequest can be properly |
| 288 | // cancelled. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 289 | TEST_F(NavigationRequestTest, CancelDeferredWillStart) { |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 290 | TestNavigationThrottle* test_throttle = |
| 291 | CreateTestNavigationThrottle(NavigationThrottle::DEFER); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 292 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 293 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 294 | |
| 295 | // Simulate WillStartRequest. The request should be deferred. The callback |
| 296 | // should not have been called. |
| 297 | SimulateWillStartRequest(); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 298 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 299 | EXPECT_FALSE(was_callback_called()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 300 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 301 | |
| 302 | // Cancel the request. The callback should have been called. |
Charles Harrison | 4f2bf1a | 2017-07-18 20:21:21 | [diff] [blame] | 303 | CancelDeferredNavigation(NavigationThrottle::CANCEL_AND_IGNORE); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 304 | EXPECT_EQ(NavigationRequest::CANCELING, state()); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 305 | EXPECT_TRUE(was_callback_called()); |
| 306 | EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 307 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | // Checks that a navigation deferred during WillRedirectRequest can be properly |
| 311 | // cancelled. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 312 | TEST_F(NavigationRequestTest, CancelDeferredWillRedirect) { |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 313 | TestNavigationThrottle* test_throttle = |
| 314 | CreateTestNavigationThrottle(NavigationThrottle::DEFER); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 315 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 316 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 317 | |
| 318 | // Simulate WillRedirectRequest. The request should be deferred. The callback |
| 319 | // should not have been called. |
| 320 | SimulateWillRedirectRequest(); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 321 | EXPECT_EQ(NavigationRequest::WILL_REDIRECT_REQUEST, state()); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 322 | EXPECT_FALSE(was_callback_called()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 323 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 1, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 324 | |
| 325 | // Cancel the request. The callback should have been called. |
Charles Harrison | 4f2bf1a | 2017-07-18 20:21:21 | [diff] [blame] | 326 | CancelDeferredNavigation(NavigationThrottle::CANCEL_AND_IGNORE); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 327 | EXPECT_EQ(NavigationRequest::CANCELING, state()); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 328 | EXPECT_TRUE(was_callback_called()); |
| 329 | EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 330 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 1, 0, 0)); |
| 331 | } |
| 332 | |
| 333 | // Checks that a navigation deferred during WillFailRequest can be properly |
| 334 | // cancelled. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 335 | TEST_F(NavigationRequestTest, CancelDeferredWillFail) { |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 336 | TestNavigationThrottle* test_throttle = CreateTestNavigationThrottle( |
| 337 | TestNavigationThrottle::WILL_FAIL_REQUEST, NavigationThrottle::DEFER); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 338 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 339 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 0, 0, 0)); |
| 340 | |
| 341 | // Simulate WillStartRequest. |
| 342 | SimulateWillStartRequest(); |
| 343 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
| 344 | |
| 345 | // Simulate WillFailRequest. The request should be deferred. The callback |
| 346 | // should not have been called. |
| 347 | SimulateWillFailRequest(net::ERR_CERT_DATE_INVALID); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 348 | EXPECT_EQ(NavigationRequest::WILL_FAIL_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 349 | EXPECT_FALSE(was_callback_called()); |
| 350 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 1, 0)); |
| 351 | |
| 352 | // Cancel the request. The callback should have been called. |
| 353 | CancelDeferredNavigation(NavigationThrottle::CANCEL_AND_IGNORE); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 354 | EXPECT_EQ(NavigationRequest::CANCELING, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 355 | EXPECT_TRUE(was_callback_called()); |
| 356 | EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); |
| 357 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 1, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | // Checks that a navigation deferred can be canceled and not ignored. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 361 | TEST_F(NavigationRequestTest, CancelDeferredWillRedirectNoIgnore) { |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 362 | TestNavigationThrottle* test_throttle = |
| 363 | CreateTestNavigationThrottle(NavigationThrottle::DEFER); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 364 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 365 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 366 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 367 | // Simulate WillStartRequest. The request should be deferred. The callback |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 368 | // should not have been called. |
| 369 | SimulateWillStartRequest(); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 370 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 371 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 372 | |
| 373 | // Cancel the request. The callback should have been called with CANCEL, and |
| 374 | // not CANCEL_AND_IGNORE. |
Charles Harrison | 4f2bf1a | 2017-07-18 20:21:21 | [diff] [blame] | 375 | CancelDeferredNavigation(NavigationThrottle::CANCEL); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 376 | EXPECT_EQ(NavigationRequest::CANCELING, state()); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 377 | EXPECT_TRUE(was_callback_called()); |
| 378 | EXPECT_EQ(NavigationThrottle::CANCEL, callback_result()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 379 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
clamy | e8853384 | 2015-11-18 12:48:57 | [diff] [blame] | 380 | } |
| 381 | |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 382 | // Checks that a navigation deferred by WillFailRequest can be canceled and not |
| 383 | // ignored. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 384 | TEST_F(NavigationRequestTest, CancelDeferredWillFailNoIgnore) { |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 385 | TestNavigationThrottle* test_throttle = CreateTestNavigationThrottle( |
| 386 | TestNavigationThrottle::WILL_FAIL_REQUEST, NavigationThrottle::DEFER); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 387 | EXPECT_EQ(NavigationRequest::WILL_START_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 388 | EXPECT_TRUE(call_counts_match(test_throttle, 0, 0, 0, 0)); |
| 389 | |
| 390 | // Simulate WillStartRequest. |
| 391 | SimulateWillStartRequest(); |
| 392 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 0, 0)); |
| 393 | |
| 394 | // Simulate WillFailRequest. The request should be deferred. The callback |
| 395 | // should not have been called. |
| 396 | SimulateWillFailRequest(net::ERR_CERT_DATE_INVALID); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 397 | EXPECT_EQ(NavigationRequest::WILL_FAIL_REQUEST, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 398 | EXPECT_FALSE(was_callback_called()); |
| 399 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 1, 0)); |
| 400 | |
| 401 | // Cancel the request. The callback should have been called with CANCEL, and |
| 402 | // not CANCEL_AND_IGNORE. |
| 403 | CancelDeferredNavigation(NavigationThrottle::CANCEL); |
Mohamed Abdelhalim | b6f9f70 | 2019-11-06 17:23:19 | [diff] [blame] | 404 | EXPECT_EQ(NavigationRequest::CANCELING, state()); |
Lucas Garron | 0cedd96 | 2017-10-17 07:23:33 | [diff] [blame] | 405 | EXPECT_TRUE(was_callback_called()); |
| 406 | EXPECT_EQ(NavigationThrottle::CANCEL, callback_result()); |
| 407 | EXPECT_TRUE(call_counts_match(test_throttle, 1, 0, 1, 0)); |
| 408 | } |
| 409 | |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 410 | // Checks that data from the SSLInfo passed into SimulateWillStartRequest() is |
John Abd-El-Malek | f36e05f | 2017-11-30 16:17:52 | [diff] [blame] | 411 | // stored on the handle. |
Mohamed Abdelhalim | 1e8c582 | 2019-08-02 11:45:43 | [diff] [blame] | 412 | TEST_F(NavigationRequestTest, WillFailRequestSetsSSLInfo) { |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 413 | uint16_t cipher_suite = 0xc02f; // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 |
| 414 | int connection_status = 0; |
| 415 | net::SSLConnectionStatusSetCipherSuite(cipher_suite, &connection_status); |
| 416 | |
| 417 | // Set some test values. |
| 418 | net::SSLInfo ssl_info; |
| 419 | ssl_info.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; |
| 420 | ssl_info.connection_status = connection_status; |
| 421 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 422 | const GURL kUrl = GURL("https://chromium.org"); |
| 423 | auto navigation = |
| 424 | NavigationSimulatorImpl::CreateRendererInitiated(kUrl, main_rfh()); |
Emily Stark | fd6978ad1 | 2019-04-30 21:20:07 | [diff] [blame] | 425 | navigation->SetSSLInfo(ssl_info); |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 426 | navigation->Fail(net::ERR_CERT_DATE_INVALID); |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 427 | |
| 428 | EXPECT_EQ(net::CERT_STATUS_AUTHORITY_INVALID, |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 429 | navigation->GetNavigationHandle()->GetSSLInfo()->cert_status); |
| 430 | EXPECT_EQ(connection_status, |
| 431 | navigation->GetNavigationHandle()->GetSSLInfo()->connection_status); |
Lucas Garron | c1edb5ab | 2017-11-08 03:31:13 | [diff] [blame] | 432 | } |
| 433 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 434 | namespace { |
| 435 | |
Alex Moshchuk | 1a66b1d | 2018-05-15 21:18:26 | [diff] [blame] | 436 | // Helper throttle which checks that it can access NavigationHandle's |
| 437 | // RenderFrameHost in WillFailRequest() and then defers the failure. |
| 438 | class GetRenderFrameHostOnFailureNavigationThrottle |
| 439 | : public NavigationThrottle { |
| 440 | public: |
| 441 | GetRenderFrameHostOnFailureNavigationThrottle(NavigationHandle* handle) |
| 442 | : NavigationThrottle(handle) {} |
| 443 | ~GetRenderFrameHostOnFailureNavigationThrottle() override {} |
| 444 | |
| 445 | NavigationThrottle::ThrottleCheckResult WillFailRequest() override { |
| 446 | EXPECT_TRUE(navigation_handle()->GetRenderFrameHost()); |
| 447 | return NavigationThrottle::DEFER; |
| 448 | } |
| 449 | |
| 450 | const char* GetNameForLogging() override { |
| 451 | return "GetRenderFrameHostOnFailureNavigationThrottle"; |
| 452 | } |
| 453 | |
| 454 | private: |
| 455 | DISALLOW_COPY_AND_ASSIGN(GetRenderFrameHostOnFailureNavigationThrottle); |
| 456 | }; |
| 457 | |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 458 | class ThrottleTestContentBrowserClient : public ContentBrowserClient { |
| 459 | std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation( |
| 460 | NavigationHandle* navigation_handle) override { |
| 461 | std::vector<std::unique_ptr<NavigationThrottle>> throttle; |
| 462 | throttle.push_back( |
| 463 | std::make_unique<GetRenderFrameHostOnFailureNavigationThrottle>( |
| 464 | navigation_handle)); |
| 465 | return throttle; |
| 466 | } |
| 467 | }; |
| 468 | |
| 469 | } // namespace |
| 470 | |
Alex Moshchuk | 1a66b1d | 2018-05-15 21:18:26 | [diff] [blame] | 471 | // Verify that the NavigationHandle::GetRenderFrameHost() can be retrieved by a |
| 472 | // throttle in WillFailRequest(), as well as after deferring the failure. This |
| 473 | // is allowed, since at that point the final RenderFrameHost will have already |
| 474 | // been chosen. See https://crbug.com/817881. |
Mohamed Abdelhalim | ba02067 | 2019-10-31 16:18:53 | [diff] [blame] | 475 | TEST_F(NavigationRequestTest, WillFailRequestCanAccessRenderFrameHost) { |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 476 | std::unique_ptr<ContentBrowserClient> client( |
| 477 | new ThrottleTestContentBrowserClient); |
| 478 | ContentBrowserClient* old_browser_client = |
| 479 | SetBrowserClientForTesting(client.get()); |
| 480 | |
| 481 | const GURL kUrl = GURL("http://chromium.org"); |
| 482 | auto navigation = |
| 483 | NavigationSimulatorImpl::CreateRendererInitiated(kUrl, main_rfh()); |
| 484 | navigation->SetAutoAdvance(false); |
| 485 | navigation->Start(); |
| 486 | navigation->Fail(net::ERR_CERT_DATE_INVALID); |
Mohamed Abdelhalim | 3b23527 | 2019-11-05 15:06:07 | [diff] [blame] | 487 | EXPECT_EQ( |
| 488 | NavigationRequest::WILL_FAIL_REQUEST, |
| 489 | NavigationRequest::From(navigation->GetNavigationHandle())->state()); |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 490 | EXPECT_TRUE(navigation->GetNavigationHandle()->GetRenderFrameHost()); |
Mohamed Abdelhalim | 40c35d2 | 2019-09-19 15:59:05 | [diff] [blame] | 491 | NavigationRequest::From(navigation->GetNavigationHandle()) |
| 492 | ->CallResumeForTesting(); |
Camille Lamy | 62b82601 | 2019-02-26 09:15:47 | [diff] [blame] | 493 | EXPECT_TRUE(navigation->GetNavigationHandle()->GetRenderFrameHost()); |
| 494 | |
| 495 | SetBrowserClientForTesting(old_browser_client); |
Alex Moshchuk | 1a66b1d | 2018-05-15 21:18:26 | [diff] [blame] | 496 | } |
| 497 | |
clamy | 4967831 | 2015-10-22 21:59:00 | [diff] [blame] | 498 | } // namespace content |