| Index: content/browser/renderer_host/render_view_host_manager_browsertest.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/render_view_host_manager_browsertest.cc (revision 145001)
|
| +++ content/browser/renderer_host/render_view_host_manager_browsertest.cc (working copy)
|
| @@ -8,6 +8,7 @@
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| +#include "chrome/browser/ui/browser_tabstrip.h"
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/browser/renderer_host/render_view_host_impl.h"
|
| @@ -66,7 +67,7 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Open a same-site link in a new tab.
|
| @@ -74,7 +75,7 @@
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -85,38 +86,38 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, blank_site_instance);
|
|
|
| // We should have access to the opened tab's location.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(testScriptAccessToWindow());",
|
| &success));
|
| EXPECT_TRUE(success);
|
|
|
| // Now navigate the new tab to a different site.
|
| - browser()->ActivateTabAt(1, true);
|
| + chrome::ActivateTabAt(browser(), 1, true);
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
| scoped_refptr<SiteInstance> new_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_NE(orig_site_instance, new_site_instance);
|
|
|
| // We should no longer have script access to the opened tab's location.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(testScriptAccessToWindow());",
|
| &success));
|
| EXPECT_FALSE(success);
|
| @@ -145,13 +146,13 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a rel=noreferrer + target=blank link.
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickNoRefTargetBlankLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -164,18 +165,18 @@
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ("/files/title2.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Wait for the cross-site transition in the new tab to finish.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
|
| - browser()->GetActiveWebContents());
|
| + chrome::GetActiveWebContents(browser()));
|
| EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->
|
| pending_render_view_host());
|
|
|
| // Should have a new SiteInstance.
|
| scoped_refptr<SiteInstance> noref_blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_NE(orig_site_instance, noref_blank_site_instance);
|
| }
|
|
|
| @@ -203,13 +204,13 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a same-site rel=noreferrer + target=foo link.
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteNoRefTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -222,18 +223,18 @@
|
| EXPECT_EQ(2, browser()->tab_count());
|
| EXPECT_EQ(1, browser()->active_index());
|
| EXPECT_EQ("/files/title2.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Wait for the cross-site transition in the new tab to finish.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
|
| - browser()->GetActiveWebContents());
|
| + chrome::GetActiveWebContents(browser()));
|
| EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->
|
| pending_render_view_host());
|
|
|
| // Should have a new SiteInstance (in a new BrowsingInstance).
|
| scoped_refptr<SiteInstance> noref_blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_NE(orig_site_instance, noref_blank_site_instance);
|
| }
|
|
|
| @@ -260,13 +261,13 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a target=blank link.
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickTargetBlankLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -280,13 +281,13 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the cross-site transition in the new tab to finish.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/title2.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, blank_site_instance);
|
| }
|
|
|
| @@ -313,29 +314,29 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a rel=noreferrer link.
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickNoRefLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
|
|
| // Wait for the cross-site transition in the current tab to finish.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
|
|
| // Opens in same tab.
|
| EXPECT_EQ(1, browser()->tab_count());
|
| EXPECT_EQ(0, browser()->active_index());
|
| EXPECT_EQ("/files/title2.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> noref_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, noref_site_instance);
|
| }
|
|
|
| @@ -362,7 +363,7 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a target=foo link.
|
| @@ -370,7 +371,7 @@
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -381,18 +382,18 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, blank_site_instance);
|
|
|
| // Now navigate the new tab to a different site.
|
| - content::WebContents* new_contents = browser()->GetActiveWebContents();
|
| + content::WebContents* new_contents = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
| scoped_refptr<SiteInstance> new_site_instance(
|
| @@ -400,13 +401,13 @@
|
| EXPECT_NE(orig_site_instance, new_site_instance);
|
|
|
| // Clicking the original link in the first tab should cause us to swap back.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| ui_test_utils::WindowedNotificationObserver navigation_observer(
|
| content::NOTIFICATION_NAV_ENTRY_COMMITTED,
|
| content::Source<content::NavigationController>(
|
| &new_contents->GetController()));
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -415,7 +416,7 @@
|
| // Should have swapped back and shown the new tab again.
|
| EXPECT_EQ(1, browser()->active_index());
|
| scoped_refptr<SiteInstance> revisit_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, revisit_site_instance);
|
|
|
| // If it navigates away to another process, the original window should
|
| @@ -423,13 +424,13 @@
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
| EXPECT_EQ(new_site_instance,
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| ui_test_utils::WindowedNotificationObserver close_observer(
|
| content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| content::Source<content::WebContents>(new_contents));
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(testCloseWindow());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -463,7 +464,8 @@
|
| test_server()->GetURL(replacement_path));
|
|
|
| // Get the original SiteInstance and RVHM for later comparison.
|
| - content::WebContents* opener_contents = browser()->GetActiveWebContents();
|
| + content::WebContents* opener_contents =
|
| + chrome::GetActiveWebContents(browser());
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| opener_contents->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
| @@ -487,7 +489,7 @@
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't, then
|
| // send it to post_message.html on a different site.
|
| - content::WebContents* foo_contents = browser()->GetActiveWebContents();
|
| + content::WebContents* foo_contents = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::WaitForLoadStop(foo_contents);
|
| EXPECT_EQ("/files/navigate_opener.html", foo_contents->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
| @@ -498,11 +500,11 @@
|
| EXPECT_NE(orig_site_instance, foo_site_instance);
|
|
|
| // Second, a target=_blank window.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| ui_test_utils::WindowedTabAddedNotificationObserver new_tab_observer2((
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetBlankLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -510,7 +512,7 @@
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't, then
|
| // send it to post_message.html on the original site.
|
| - content::WebContents* new_contents = browser()->GetActiveWebContents();
|
| + content::WebContents* new_contents = chrome::GetActiveWebContents(browser());
|
| ui_test_utils::WaitForLoadStop(new_contents);
|
| EXPECT_EQ("/files/title2.html", new_contents->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
| @@ -604,9 +606,9 @@
|
| test_server()->GetURL(replacement_path));
|
|
|
| // Get the original tab and SiteInstance for later comparison.
|
| - content::WebContents* orig_contents = browser()->GetActiveWebContents();
|
| + content::WebContents* orig_contents = chrome::GetActiveWebContents(browser());
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a target=foo link.
|
| @@ -614,7 +616,7 @@
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -625,32 +627,32 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> blank_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, blank_site_instance);
|
|
|
| // Now navigate the original (opener) tab to a different site.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
| scoped_refptr<SiteInstance> new_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_NE(orig_site_instance, new_site_instance);
|
|
|
| // The opened tab should be able to navigate the opener back to its process.
|
| - browser()->ActivateTabAt(1, true);
|
| + chrome::ActivateTabAt(browser(), 1, true);
|
| ui_test_utils::WindowedNotificationObserver navigation_observer(
|
| content::NOTIFICATION_NAV_ENTRY_COMMITTED,
|
| content::Source<content::NavigationController>(
|
| &orig_contents->GetController()));
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(navigateOpener());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -660,9 +662,9 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Should have swapped back into this process.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| scoped_refptr<SiteInstance> revisit_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, revisit_site_instance);
|
| }
|
|
|
| @@ -690,7 +692,7 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Test clicking a target=foo link.
|
| @@ -698,7 +700,7 @@
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -709,21 +711,21 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> opened_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, opened_site_instance);
|
|
|
| // Now navigate the opened tab to a different site.
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
| scoped_refptr<SiteInstance> new_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_NE(orig_site_instance, new_site_instance);
|
|
|
| // The original process should still be alive, since it is still used in the
|
| @@ -733,7 +735,7 @@
|
|
|
| // Navigate the first tab to a different site as well. The original process
|
| // should exit, since all of its views are now swapped out.
|
| - browser()->ActivateTabAt(0, true);
|
| + chrome::ActivateTabAt(browser(), 0, true);
|
| ui_test_utils::WindowedNotificationObserver exit_observer(
|
| content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
|
| content::Source<content::RenderProcessHost>(orig_process));
|
| @@ -741,7 +743,7 @@
|
| https_server.GetURL("files/title1.html"));
|
| exit_observer.Wait();
|
| scoped_refptr<SiteInstance> new_site_instance2(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(new_site_instance, new_site_instance2);
|
| }
|
|
|
| @@ -768,7 +770,7 @@
|
|
|
| // Get the original SiteInstance for later comparison.
|
| scoped_refptr<SiteInstance> orig_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_TRUE(orig_site_instance != NULL);
|
|
|
| // Load a cross-site page that fails with a 204 error.
|
| @@ -776,31 +778,31 @@
|
|
|
| // We should still be looking at the normal page.
|
| scoped_refptr<SiteInstance> post_nav_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, post_nav_site_instance);
|
| EXPECT_EQ("/files/click-noreferrer-links.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Renderer-initiated navigations should work.
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickNoRefLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
|
|
| // Wait for the cross-site transition in the current tab to finish.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
|
|
| // Opens in same tab.
|
| EXPECT_EQ(1, browser()->tab_count());
|
| EXPECT_EQ(0, browser()->active_index());
|
| EXPECT_EQ("/files/title2.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| // Should have the same SiteInstance.
|
| scoped_refptr<SiteInstance> noref_site_instance(
|
| - browser()->GetActiveWebContents()->GetSiteInstance());
|
| + chrome::GetActiveWebContents(browser())->GetSiteInstance());
|
| EXPECT_EQ(orig_site_instance, noref_site_instance);
|
| }
|
|
|
| @@ -849,7 +851,7 @@
|
| https_server.GetURL(replacement_path_b3));
|
|
|
| // History is now [blank, A1, B1, B2, *B3].
|
| - content::WebContents* contents = browser()->GetActiveWebContents();
|
| + content::WebContents* contents = chrome::GetActiveWebContents(browser());
|
| EXPECT_EQ(5, contents->GetController().GetEntryCount());
|
|
|
| // Open another tab in same process to keep this process alive.
|
| @@ -956,7 +958,7 @@
|
| content::Source<content::WebContentsDelegate>(browser())));
|
| bool success = false;
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| - browser()->GetActiveWebContents()->GetRenderViewHost(), L"",
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
|
| L"window.domAutomationController.send(clickSameSiteTargetedLink());",
|
| &success));
|
| EXPECT_TRUE(success);
|
| @@ -967,13 +969,13 @@
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| // Wait for the navigation in the new tab to finish, if it hasn't.
|
| - ui_test_utils::WaitForLoadStop(browser()->GetActiveWebContents());
|
| + ui_test_utils::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
| EXPECT_EQ(1, browser()->active_index());
|
|
|
| RenderViewHost* rvh =
|
| - browser()->GetActiveWebContents()->GetRenderViewHost();
|
| + chrome::GetActiveWebContents(browser())->GetRenderViewHost();
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| rvh, L"",
|
| L"window.domAutomationController.send("
|
| @@ -983,7 +985,7 @@
|
|
|
| // Now navigate the new tab to a different site. This should swap out the
|
| // tab's existing RenderView, causing it become hidden.
|
| - browser()->ActivateTabAt(1, true);
|
| + chrome::ActivateTabAt(browser(), 1, true);
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title1.html"));
|
|
|
| @@ -1000,16 +1002,16 @@
|
| ui_test_utils::WindowedNotificationObserver back_nav_load_observer(
|
| content::NOTIFICATION_NAV_ENTRY_COMMITTED,
|
| content::Source<content::NavigationController>(
|
| - &browser()->GetActiveWebContents()->GetController()));
|
| + &chrome::GetActiveWebContents(browser())->GetController()));
|
| chrome::GoBack(browser(), CURRENT_TAB);
|
| back_nav_load_observer.Wait();
|
| }
|
|
|
|
|
| EXPECT_EQ("/files/navigate_opener.html",
|
| - browser()->GetActiveWebContents()->GetURL().path());
|
| + chrome::GetActiveWebContents(browser())->GetURL().path());
|
|
|
| - EXPECT_EQ(rvh, browser()->GetActiveWebContents()->GetRenderViewHost());
|
| + EXPECT_EQ(rvh, chrome::GetActiveWebContents(browser())->GetRenderViewHost());
|
|
|
| EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| rvh, L"",
|
| @@ -1084,20 +1086,20 @@
|
| // was a problem. This is no longer the case.
|
| GURL navigated_url(test_server()->GetURL("files/title2.html"));
|
| ui_test_utils::NavigateToURL(browser(), navigated_url);
|
| - SiteInstance* site_instance1 = browser()->GetActiveWebContents()->
|
| + SiteInstance* site_instance1 = chrome::GetActiveWebContents(browser())->
|
| GetRenderViewHost()->GetSiteInstance();
|
|
|
| // Observe the newly created render_view_host to make sure it will not leak.
|
| RenderViewHostObserverArray rvh_observers;
|
| - rvh_observers.AddObserverToRVH(browser()->GetActiveWebContents()->
|
| + rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())->
|
| GetRenderViewHost());
|
|
|
| GURL view_source_url(chrome::kViewSourceScheme + std::string(":") +
|
| navigated_url.spec());
|
| ui_test_utils::NavigateToURL(browser(), view_source_url);
|
| - rvh_observers.AddObserverToRVH(browser()->GetActiveWebContents()->
|
| + rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())->
|
| GetRenderViewHost());
|
| - SiteInstance* site_instance2 = browser()->GetActiveWebContents()->
|
| + SiteInstance* site_instance2 = chrome::GetActiveWebContents(browser())->
|
| GetRenderViewHost()->GetSiteInstance();
|
|
|
| // Ensure that view-source navigations force a new SiteInstance.
|
| @@ -1106,10 +1108,10 @@
|
| // Now navigate to a different instance so that we swap out again.
|
| ui_test_utils::NavigateToURL(browser(),
|
| https_server.GetURL("files/title2.html"));
|
| - rvh_observers.AddObserverToRVH(browser()->GetActiveWebContents()->
|
| + rvh_observers.AddObserverToRVH(chrome::GetActiveWebContents(browser())->
|
| GetRenderViewHost());
|
|
|
| // This used to leak a render view host.
|
| - browser()->CloseTabContents(browser()->GetActiveWebContents());
|
| + chrome::CloseWebContents(browser(), chrome::GetActiveWebContents(browser()));
|
| EXPECT_EQ(0U, rvh_observers.GetNumObservers());
|
| }
|
|
|