Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 1681973002: PlzNavigate: fix RenderFrameHostManagerTest.ConsecutiveNavigationsToSite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 17 matching lines...) Expand all
28 #include "content/common/content_constants_internal.h" 28 #include "content/common/content_constants_internal.h"
29 #include "content/common/input_messages.h" 29 #include "content/common/input_messages.h"
30 #include "content/common/site_isolation_policy.h" 30 #include "content/common/site_isolation_policy.h"
31 #include "content/public/browser/navigation_controller.h" 31 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
33 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/resource_dispatcher_host.h" 34 #include "content/public/browser/resource_dispatcher_host.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/browser/web_contents_observer.h" 36 #include "content/public/browser/web_contents_observer.h"
37 #include "content/public/common/bindings_policy.h" 37 #include "content/public/common/bindings_policy.h"
38 #include "content/public/common/browser_side_navigation_policy.h"
38 #include "content/public/common/content_switches.h" 39 #include "content/public/common/content_switches.h"
39 #include "content/public/common/file_chooser_file_info.h" 40 #include "content/public/common/file_chooser_file_info.h"
40 #include "content/public/common/file_chooser_params.h" 41 #include "content/public/common/file_chooser_params.h"
41 #include "content/public/common/page_state.h" 42 #include "content/public/common/page_state.h"
42 #include "content/public/common/url_constants.h" 43 #include "content/public/common/url_constants.h"
43 #include "content/public/test/browser_test_utils.h" 44 #include "content/public/test/browser_test_utils.h"
44 #include "content/public/test/content_browser_test.h" 45 #include "content/public/test/content_browser_test.h"
45 #include "content/public/test/content_browser_test_utils.h" 46 #include "content/public/test/content_browser_test_utils.h"
46 #include "content/public/test/test_navigation_observer.h" 47 #include "content/public/test/test_navigation_observer.h"
47 #include "content/public/test/test_utils.h" 48 #include "content/public/test/test_utils.h"
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 embedded_test_server()->GetURL("b.com", "/title3.html")); 2444 embedded_test_server()->GetURL("b.com", "/title3.html"));
2444 2445
2445 // Start a cross-site navigation to the same site but don't commit. 2446 // Start a cross-site navigation to the same site but don't commit.
2446 GURL cross_site_url(embedded_test_server()->GetURL("b.com", "/title1.html")); 2447 GURL cross_site_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
2447 NavigationStallDelegate stall_delegate(cross_site_url); 2448 NavigationStallDelegate stall_delegate(cross_site_url);
2448 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); 2449 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate);
2449 shell()->LoadURL(cross_site_url); 2450 shell()->LoadURL(cross_site_url);
2450 2451
2451 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 2452 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
2452 shell()->web_contents()); 2453 shell()->web_contents());
2453 RenderFrameHostImpl* pending_rfh = 2454 RenderFrameHostImpl* next_rfh =
2454 web_contents->GetRenderManagerForTesting()->pending_frame_host(); 2455 IsBrowserSideNavigationEnabled()
2455 ASSERT_TRUE(pending_rfh); 2456 ? web_contents->GetRenderManagerForTesting()->speculative_frame_host()
2457 : web_contents->GetRenderManagerForTesting()->pending_frame_host();
2458 ASSERT_TRUE(next_rfh);
2456 2459
2457 // Navigate to the same new site and verify that we commit in the same RFH. 2460 // Navigate to the same new site and verify that we commit in the same RFH.
2458 GURL cross_site_url2(embedded_test_server()->GetURL("b.com", "/title2.html")); 2461 GURL cross_site_url2(embedded_test_server()->GetURL("b.com", "/title2.html"));
2459 TestNavigationObserver navigation_observer(web_contents, 1); 2462 TestNavigationObserver navigation_observer(web_contents, 1);
2460 shell()->LoadURL(cross_site_url2); 2463 shell()->LoadURL(cross_site_url2);
2461 EXPECT_EQ(pending_rfh, 2464 if (IsBrowserSideNavigationEnabled()) {
2462 web_contents->GetRenderManagerForTesting()->pending_frame_host()); 2465 EXPECT_EQ(
2466 next_rfh,
2467 web_contents->GetRenderManagerForTesting()->speculative_frame_host());
2468 } else {
2469 EXPECT_EQ(next_rfh,
2470 web_contents->GetRenderManagerForTesting()->pending_frame_host());
2471 }
2463 navigation_observer.Wait(); 2472 navigation_observer.Wait();
2464 EXPECT_EQ(cross_site_url2, web_contents->GetLastCommittedURL()); 2473 EXPECT_EQ(cross_site_url2, web_contents->GetLastCommittedURL());
2465 EXPECT_EQ(pending_rfh, web_contents->GetMainFrame()); 2474 EXPECT_EQ(next_rfh, web_contents->GetMainFrame());
2466 EXPECT_FALSE( 2475 if (IsBrowserSideNavigationEnabled()) {
2467 web_contents->GetRenderManagerForTesting()->pending_frame_host()); 2476 EXPECT_FALSE(
2477 web_contents->GetRenderManagerForTesting()->speculative_frame_host());
2478 } else {
2479 EXPECT_FALSE(
2480 web_contents->GetRenderManagerForTesting()->pending_frame_host());
2481 }
2468 2482
2469 ResourceDispatcherHost::Get()->SetDelegate(nullptr); 2483 ResourceDispatcherHost::Get()->SetDelegate(nullptr);
2470 } 2484 }
2471 2485
2472 } // namespace content 2486 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | testing/buildbot/filters/browser-side-navigation.linux.content_browsertests.filter » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698