OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/test_render_frame_host.h" | 5 #include "content/test/test_render_frame_host.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/navigation_handle_impl.h" | 10 #include "content/browser/frame_host/navigation_handle_impl.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // will be no NavigationRequest, nor is it necessary to simulate the network | 260 // will be no NavigationRequest, nor is it necessary to simulate the network |
261 // stack commit. | 261 // stack commit. |
262 if (frame_tree_node()->navigation_request()) | 262 if (frame_tree_node()->navigation_request()) |
263 PrepareForCommit(); | 263 PrepareForCommit(); |
264 bool browser_side_navigation = IsBrowserSideNavigationEnabled(); | 264 bool browser_side_navigation = IsBrowserSideNavigationEnabled(); |
265 CHECK(!browser_side_navigation || is_loading()); | 265 CHECK(!browser_side_navigation || is_loading()); |
266 CHECK(!browser_side_navigation || !frame_tree_node()->navigation_request()); | 266 CHECK(!browser_side_navigation || !frame_tree_node()->navigation_request()); |
267 SendNavigate(0, did_create_new_entry, url); | 267 SendNavigate(0, did_create_new_entry, url); |
268 } | 268 } |
269 | 269 |
| 270 void TestRenderFrameHost::SimulateFeaturePolicyHeader( |
| 271 blink::WebFeaturePolicyFeature feature, |
| 272 const std::vector<url::Origin>& whitelist) { |
| 273 content::ParsedFeaturePolicyHeader header(1); |
| 274 header[0].feature = feature; |
| 275 header[0].matches_all_origins = false; |
| 276 header[0].origins = whitelist; |
| 277 OnDidSetFeaturePolicyHeader(header); |
| 278 } |
| 279 |
270 void TestRenderFrameHost::SendNavigate(int nav_entry_id, | 280 void TestRenderFrameHost::SendNavigate(int nav_entry_id, |
271 bool did_create_new_entry, | 281 bool did_create_new_entry, |
272 const GURL& url) { | 282 const GURL& url) { |
273 SendNavigateWithParameters(nav_entry_id, did_create_new_entry, false, | 283 SendNavigateWithParameters(nav_entry_id, did_create_new_entry, false, |
274 url, ui::PAGE_TRANSITION_LINK, 200, | 284 url, ui::PAGE_TRANSITION_LINK, 200, |
275 ModificationCallback()); | 285 ModificationCallback()); |
276 } | 286 } |
277 | 287 |
278 void TestRenderFrameHost::SendFailedNavigate(int nav_entry_id, | 288 void TestRenderFrameHost::SendFailedNavigate(int nav_entry_id, |
279 bool did_create_new_entry, | 289 bool did_create_new_entry, |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at | 531 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at |
522 // this point. | 532 // this point. |
523 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) | 533 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) |
524 return; | 534 return; |
525 navigation_handle()->CallWillStartRequestForTesting( | 535 navigation_handle()->CallWillStartRequestForTesting( |
526 false /* is_post */, Referrer(GURL(), blink::kWebReferrerPolicyDefault), | 536 false /* is_post */, Referrer(GURL(), blink::kWebReferrerPolicyDefault), |
527 true /* user_gesture */, transition, false /* is_external_protocol */); | 537 true /* user_gesture */, transition, false /* is_external_protocol */); |
528 } | 538 } |
529 | 539 |
530 } // namespace content | 540 } // namespace content |
OLD | NEW |