Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc |
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
index d676d4504475ba7db098c54adf46a622294a95ec..e44882f3ffabfabf44c04a72fad0aeeebddbb175 100644 |
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
@@ -3,7 +3,6 @@ |
// found in the LICENSE file. |
#include "base/bind.h" |
-#include "base/command_line.h" |
#include "base/strings/stringprintf.h" |
#include "content/browser/frame_host/frame_navigation_entry.h" |
#include "content/browser/frame_host/frame_tree.h" |
@@ -18,7 +17,7 @@ |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/common/bindings_policy.h" |
-#include "content/public/common/content_switches.h" |
+#include "content/public/common/site_isolation_policy.h" |
#include "content/public/common/url_constants.h" |
#include "content/public/test/browser_test_utils.h" |
#include "content/public/test/content_browser_test.h" |
@@ -63,8 +62,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, LoadCrossSiteSubframe) { |
// We should only have swapped processes in --site-per-process. |
bool cross_process = root->current_frame_host()->GetProcess() != |
root->child_at(0)->current_frame_host()->GetProcess(); |
- EXPECT_EQ(base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess), |
+ EXPECT_EQ(SiteIsolationPolicy::AreAllSitesIsolatedForTesting(), |
cross_process); |
} |
@@ -1185,8 +1183,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should now have one subframe FrameNavigationEntry. |
ASSERT_EQ(1U, entry->root_node()->children.size()); |
FrameNavigationEntry* frame_entry = |
@@ -1216,8 +1213,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should now have two subframe FrameNavigationEntries. |
ASSERT_EQ(2U, entry->root_node()->children.size()); |
FrameNavigationEntry* frame_entry = |
@@ -1230,8 +1226,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
} |
// Check the end result of the frame tree. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
FrameTreeVisualizer visualizer; |
EXPECT_EQ( |
" Site A ------------ proxies for B\n" |
@@ -1280,8 +1275,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_FALSE(controller.GetPendingEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should now have a subframe FrameNavigationEntry. |
ASSERT_EQ(1U, entry->root_node()->children.size()); |
FrameNavigationEntry* frame_entry = |
@@ -1315,8 +1309,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_FALSE(controller.GetPendingEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should now have 2 subframe FrameNavigationEntries. |
ASSERT_EQ(2U, entry->root_node()->children.size()); |
FrameNavigationEntry* frame_entry = |
@@ -1348,8 +1341,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(main_url, root_entry->url()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should now have 2 subframe FrameNavigationEntries. |
ASSERT_EQ(2U, entry->root_node()->children.size()); |
ASSERT_EQ(1U, entry->root_node()->children[1]->children.size()); |
@@ -1365,8 +1357,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
// within it. Both are currently broken. |
// Check the end result of the frame tree. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
FrameTreeVisualizer visualizer; |
EXPECT_EQ( |
" Site A ------------ proxies for B\n" |
@@ -1428,8 +1419,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(main_url, root_entry2->url()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should have a new FrameNavigationEntries for the subframe. |
ASSERT_EQ(1U, entry2->root_node()->children.size()); |
EXPECT_EQ(frame_url2, entry2->root_node()->children[0]->frame_entry->url()); |
@@ -1482,8 +1472,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(main_url, root_entry3->url()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should still have FrameNavigationEntries for all 3 subframes. |
ASSERT_EQ(2U, entry3->root_node()->children.size()); |
EXPECT_EQ(frame_url2, entry3->root_node()->children[0]->frame_entry->url()); |
@@ -1521,8 +1510,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(main_url, root_entry4->url()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should still have FrameNavigationEntries for all 3 subframes. |
ASSERT_EQ(2U, entry4->root_node()->children.size()); |
EXPECT_EQ(frame_url2, entry4->root_node()->children[0]->frame_entry->url()); |
@@ -1534,8 +1522,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
} |
// Check the end result of the frame tree. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
FrameTreeVisualizer visualizer; |
EXPECT_EQ( |
" Site A ------------ proxies for B\n" |
@@ -1611,8 +1598,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry2, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should have a new FrameNavigationEntries for the subframe. |
ASSERT_EQ(1U, entry2->root_node()->children.size()); |
EXPECT_EQ(frame_url2, entry2->root_node()->children[0]->frame_entry->url()); |
@@ -1634,8 +1620,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry1, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should have a new FrameNavigationEntries for the subframe. |
ASSERT_EQ(1U, entry1->root_node()->children.size()); |
EXPECT_EQ(frame_url, entry1->root_node()->children[0]->frame_entry->url()); |
@@ -1657,8 +1642,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry2, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should have a new FrameNavigationEntries for the subframe. |
ASSERT_EQ(1U, entry2->root_node()->children.size()); |
EXPECT_EQ(frame_url2, entry2->root_node()->children[0]->frame_entry->url()); |
@@ -1680,8 +1664,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
EXPECT_EQ(entry3, controller.GetLastCommittedEntry()); |
// Verify subframe entries if we're in --site-per-process mode. |
- if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) { |
+ if (SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) { |
// The entry should have a new FrameNavigationEntries for the subframe. |
ASSERT_EQ(1U, entry3->root_node()->children.size()); |
EXPECT_EQ(frame_url3, entry3->root_node()->children[0]->frame_entry->url()); |
@@ -1728,8 +1711,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
// Also test subframe sequence numbers, but only in --site-per-proces mode. |
// (We do not create subframe FrameNavigationEntries in default mode yet.) |
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kSitePerProcess)) |
+ if (!SiteIsolationPolicy::AreAllSitesIsolatedForTesting()) |
return; |
// 3. Add a subframe, which does an AUTO_SUBFRAME navigation. |