| Index: content/browser/site_per_process_browsertest.cc
|
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
|
| index 19f96d6a93448a19c60bdc20d14236fde6258d66..b078d8a67e2a6b51b968e39e00ac6f9c632d8b67 100644
|
| --- a/content/browser/site_per_process_browsertest.cc
|
| +++ b/content/browser/site_per_process_browsertest.cc
|
| @@ -51,10 +51,10 @@
|
| #include "content/public/common/url_constants.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/content_browser_test_utils.h"
|
| +#include "content/public/test/test_frame_navigation_observer.h"
|
| #include "content/public/test/test_navigation_observer.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "content/test/content_browser_test_utils_internal.h"
|
| -#include "content/test/test_frame_navigation_observer.h"
|
| #include "ipc/ipc.mojom.h"
|
| #include "ipc/ipc_security_test_util.h"
|
| #include "net/dns/mock_host_resolver.h"
|
| @@ -1930,7 +1930,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| std::string script(
|
| "window.domAutomationController.send("
|
| "window.location.href = 'about:blank');");
|
| - TestFrameNavigationObserver frame_observer(child);
|
| + TestFrameNavigationObserver frame_observer(child->current_frame_host());
|
| EXPECT_TRUE(ExecuteScript(child, script));
|
| frame_observer.Wait();
|
| EXPECT_EQ(about_blank_url, child->current_url());
|
| @@ -2900,7 +2900,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| browser_side_navigation ? "speculative" : "pending";
|
| {
|
| TestNavigationObserver observer(shell()->web_contents());
|
| - TestFrameNavigationObserver navigation_observer(child);
|
| + TestFrameNavigationObserver navigation_observer(
|
| + child->current_frame_host());
|
| NavigationController::LoadURLParams params(cross_site_url);
|
| params.transition_type = PageTransitionFromInt(ui::PAGE_TRANSITION_LINK);
|
| params.frame_tree_node_id = child->frame_tree_node_id();
|
| @@ -2953,7 +2954,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // verify that the intermediate SiteInstance/RenderFrameHost have been
|
| // properly cleaned up.
|
| TestNavigationObserver observer(shell()->web_contents());
|
| - TestFrameNavigationObserver navigation_observer(child);
|
| + TestFrameNavigationObserver navigation_observer(
|
| + child->current_frame_host());
|
| NavigationController::LoadURLParams params(cross_site_url);
|
| params.transition_type = PageTransitionFromInt(ui::PAGE_TRANSITION_LINK);
|
| params.frame_tree_node_id = child->frame_tree_node_id();
|
| @@ -3629,7 +3631,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|
| // Perform a renderer-initiated same-site navigation in the first frame. The
|
| // new sandbox flags should take effect.
|
| - TestFrameNavigationObserver frame_observer(root->child_at(0));
|
| + TestFrameNavigationObserver frame_observer(
|
| + root->child_at(0)->current_frame_host());
|
| ASSERT_TRUE(
|
| ExecuteScript(root->child_at(0), "window.location.href='/title2.html'"));
|
| frame_observer.Wait();
|
| @@ -3696,7 +3699,8 @@ IN_PROC_BROWSER_TEST_F(
|
|
|
| // Wait for the cross-site navigation to baz.com in the grandchild to finish.
|
| FrameTreeNode* bottom_child = root->child_at(1)->child_at(0);
|
| - TestFrameNavigationObserver navigation_observer(bottom_child);
|
| + TestFrameNavigationObserver navigation_observer(
|
| + bottom_child->current_frame_host());
|
| navigation_observer.Wait();
|
|
|
| EXPECT_EQ(
|
| @@ -3819,7 +3823,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicWindowName) {
|
| // TODO(alexmos): When blink::createWindow is refactored to handle
|
| // RemoteFrames, this should also be tested via window.open(url, frame_name)
|
| // and a more complicated frame hierarchy (https://crbug.com/463742)
|
| - TestFrameNavigationObserver frame_observer(root->child_at(0));
|
| + TestFrameNavigationObserver frame_observer(
|
| + root->child_at(0)->current_frame_host());
|
| GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html"));
|
| EXPECT_TRUE(ExecuteScript(
|
| shell(),
|
| @@ -4837,7 +4842,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // DidStopLoading, so that the SwapOut timer doesn't call OnSwappedOut and
|
| // destroy |rfh| and |rvh| before they are checked in the test.
|
| GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
|
| - TestFrameNavigationObserver commit_observer(root);
|
| + TestFrameNavigationObserver commit_observer(root->current_frame_host());
|
| shell()->LoadURL(b_url);
|
| commit_observer.WaitForCommit();
|
| EXPECT_FALSE(deleted_observer.deleted());
|
| @@ -6456,7 +6461,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|
| FrameTreeNode* grandchild = child->child_at(0);
|
| GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
|
| - TestFrameNavigationObserver navigation_observer(grandchild);
|
| + TestFrameNavigationObserver navigation_observer(
|
| + grandchild->current_frame_host());
|
| NavigateFrameToURL(grandchild, frame_url);
|
| navigation_observer.Wait();
|
|
|
| @@ -6499,7 +6505,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|
| // Navigate child frame cross-site. The sandbox flags should take effect.
|
| GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
|
| - TestFrameNavigationObserver frame_observer(root->child_at(0));
|
| + TestFrameNavigationObserver frame_observer(
|
| + root->child_at(0)->current_frame_host());
|
| NavigateFrameToURL(root->child_at(0), frame_url);
|
| frame_observer.Wait();
|
| EXPECT_EQ(expected_flags, root->child_at(0)->effective_sandbox_flags());
|
| @@ -6528,7 +6535,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // Navigate the popup cross-site. This should keep the unique origin and the
|
| // inherited sandbox flags.
|
| GURL c_url(embedded_test_server()->GetURL("c.com", "/title1.html"));
|
| - TestFrameNavigationObserver popup_observer(foo_root);
|
| + TestFrameNavigationObserver popup_observer(foo_root->current_frame_host());
|
| EXPECT_TRUE(
|
| ExecuteScript(foo_root, "location.href = '" + c_url.spec() + "';"));
|
| popup_observer.Wait();
|
| @@ -6571,7 +6578,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|
| // Navigate child frame cross-site. The sandbox flags should take effect.
|
| GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html"));
|
| - TestFrameNavigationObserver frame_observer(root->child_at(0));
|
| + TestFrameNavigationObserver frame_observer(
|
| + root->child_at(0)->current_frame_host());
|
| NavigateFrameToURL(root->child_at(0), frame_url);
|
| frame_observer.Wait();
|
| EXPECT_EQ(expected_flags, root->child_at(0)->effective_sandbox_flags());
|
| @@ -7151,7 +7159,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // to framebust.
|
| SimulateMouseClick(
|
| root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), 1, 1);
|
| - TestFrameNavigationObserver frame_observer(root);
|
| + TestFrameNavigationObserver frame_observer(root->current_frame_host());
|
| EXPECT_TRUE(ExecuteScript(root->child_at(0), script));
|
| frame_observer.Wait();
|
| EXPECT_EQ(b_url, root->current_url());
|
| @@ -7318,7 +7326,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // Go back and ensure the data: URL committed in the same SiteInstance as the
|
| // original navigation.
|
| EXPECT_TRUE(web_contents()->GetController().CanGoBack());
|
| - TestFrameNavigationObserver frame_observer(child);
|
| + TestFrameNavigationObserver frame_observer(child->current_frame_host());
|
| web_contents()->GetController().GoBack();
|
| frame_observer.WaitForCommit();
|
| EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance());
|
| @@ -7366,7 +7374,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // Go back and ensure the about:blank URL committed in the same SiteInstance
|
| // as the original navigation.
|
| EXPECT_TRUE(web_contents()->GetController().CanGoBack());
|
| - TestFrameNavigationObserver frame_observer(child);
|
| + TestFrameNavigationObserver frame_observer(child->current_frame_host());
|
| web_contents()->GetController().GoBack();
|
| frame_observer.WaitForCommit();
|
| EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance());
|
| @@ -8252,7 +8260,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| // Navigate subframe to b.com. Wait for commit but not full load.
|
| GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
|
| {
|
| - TestFrameNavigationObserver commit_observer(child);
|
| + TestFrameNavigationObserver commit_observer(child->current_frame_host());
|
| EXPECT_TRUE(
|
| ExecuteScript(child, "location.href = '" + b_url.spec() + "';"));
|
| commit_observer.WaitForCommit();
|
| @@ -8266,7 +8274,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|
| // Now, go back to a.com in the subframe and wait for commit.
|
| {
|
| - TestFrameNavigationObserver commit_observer(child);
|
| + TestFrameNavigationObserver commit_observer(child->current_frame_host());
|
| web_contents()->GetController().GoBack();
|
| commit_observer.WaitForCommit();
|
| }
|
|
|