Commit 1c3ab739 authored by creis's avatar creis Committed by Commit bot

Remove uses of UseSubframeNavigationEntries in unit tests.

This mode is always enabled now, so we can remove the code for handling
when it is disabled.

BUG=236848
TEST=Tests still pass
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2617893002
Cr-Commit-Position: refs/heads/master@{#442012}
parent ba936951
...@@ -2196,12 +2196,9 @@ TEST_F(NavigationControllerTest, NewSubframe) { ...@@ -2196,12 +2196,9 @@ TEST_F(NavigationControllerTest, NewSubframe) {
subframe->PrepareForCommit(); subframe->PrepareForCommit();
subframe->SendNavigateWithParams(&params); subframe->SendNavigateWithParams(&params);
// In UseSubframeNavigationEntries mode, we notify of a PageState update to // We notify of a PageState update here rather than during UpdateState for
// the entry here rather than during UpdateState. // auto subframe navigations.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
else
EXPECT_EQ(0U, notifications.size());
} }
// Now do a new navigation in the frame. // Now do a new navigation in the frame.
...@@ -2236,15 +2233,9 @@ TEST_F(NavigationControllerTest, NewSubframe) { ...@@ -2236,15 +2233,9 @@ TEST_F(NavigationControllerTest, NewSubframe) {
// reflect the toplevel URL). // reflect the toplevel URL).
EXPECT_EQ(url1, entry->GetURL()); EXPECT_EQ(url1, entry->GetURL());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should have a subframe FrameNavigationEntry.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { ASSERT_EQ(1U, entry->root_node()->children.size());
// The entry should have a subframe FrameNavigationEntry. EXPECT_EQ(url2, entry->root_node()->children[0]->frame_entry->url());
ASSERT_EQ(1U, entry->root_node()->children.size());
EXPECT_EQ(url2, entry->root_node()->children[0]->frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry->root_node()->children.size());
}
} }
// Auto subframes are ones the page loads automatically like ads. They should // Auto subframes are ones the page loads automatically like ads. They should
...@@ -2286,12 +2277,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2286,12 +2277,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
subframe->PrepareForCommit(); subframe->PrepareForCommit();
subframe->SendNavigateWithParams(&params); subframe->SendNavigateWithParams(&params);
// In UseSubframeNavigationEntries mode, we notify of a PageState update to // We notify of a PageState update here rather than during UpdateState for
// the entry here rather than during UpdateState. // auto subframe navigations.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
else
EXPECT_EQ(0U, notifications.size());
} }
// There should still be only one entry. // There should still be only one entry.
...@@ -2301,17 +2289,11 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2301,17 +2289,11 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get(); FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get();
EXPECT_EQ(url1, root_entry->url()); EXPECT_EQ(url1, root_entry->url());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should now have a subframe FrameNavigationEntry.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { ASSERT_EQ(1U, entry->root_node()->children.size());
// The entry should now have a subframe FrameNavigationEntry. FrameNavigationEntry* frame_entry =
ASSERT_EQ(1U, entry->root_node()->children.size()); entry->root_node()->children[0]->frame_entry.get();
FrameNavigationEntry* frame_entry = EXPECT_EQ(url2, frame_entry->url());
entry->root_node()->children[0]->frame_entry.get();
EXPECT_EQ(url2, frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry->root_node()->children.size());
}
// Add a second subframe and navigate. // Add a second subframe and navigate.
std::string unique_name1("uniqueName1"); std::string unique_name1("uniqueName1");
...@@ -2339,12 +2321,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2339,12 +2321,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
subframe2->PrepareForCommit(); subframe2->PrepareForCommit();
subframe2->SendNavigateWithParams(&params); subframe2->SendNavigateWithParams(&params);
// In UseSubframeNavigationEntries mode, we notify of a PageState update to // We notify of a PageState update here rather than during UpdateState for
// the entry here rather than during UpdateState. // auto subframe navigations.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
else
EXPECT_EQ(0U, notifications.size());
} }
// There should still be only one entry, mostly unchanged. // There should still be only one entry, mostly unchanged.
...@@ -2354,17 +2333,11 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2354,17 +2333,11 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get());
EXPECT_EQ(url1, root_entry->url()); EXPECT_EQ(url1, root_entry->url());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should now have 2 subframe FrameNavigationEntries.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { ASSERT_EQ(2U, entry->root_node()->children.size());
// The entry should now have 2 subframe FrameNavigationEntries. FrameNavigationEntry* new_frame_entry =
ASSERT_EQ(2U, entry->root_node()->children.size()); entry->root_node()->children[1]->frame_entry.get();
FrameNavigationEntry* new_frame_entry = EXPECT_EQ(url3, new_frame_entry->url());
entry->root_node()->children[1]->frame_entry.get();
EXPECT_EQ(url3, new_frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry->root_node()->children.size());
}
// Add a nested subframe and navigate. // Add a nested subframe and navigate.
std::string unique_name2("uniqueName2"); std::string unique_name2("uniqueName2");
...@@ -2397,12 +2370,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2397,12 +2370,9 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
subframe3->PrepareForCommit(); subframe3->PrepareForCommit();
subframe3->SendNavigateWithParams(&params); subframe3->SendNavigateWithParams(&params);
// In UseSubframeNavigationEntries mode, we notify of a PageState update to // We notify of a PageState update here rather than during UpdateState for
// the entry here rather than during UpdateState. // auto subframe navigations.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
else
EXPECT_EQ(0U, notifications.size());
} }
// There should still be only one entry, mostly unchanged. // There should still be only one entry, mostly unchanged.
...@@ -2412,18 +2382,12 @@ TEST_F(NavigationControllerTest, AutoSubframe) { ...@@ -2412,18 +2382,12 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get());
EXPECT_EQ(url1, root_entry->url()); EXPECT_EQ(url1, root_entry->url());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should now have a nested FrameNavigationEntry.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { EXPECT_EQ(2U, entry->root_node()->children.size());
// The entry should now have a nested FrameNavigationEntry. ASSERT_EQ(1U, entry->root_node()->children[0]->children.size());
EXPECT_EQ(2U, entry->root_node()->children.size()); new_frame_entry =
ASSERT_EQ(1U, entry->root_node()->children[0]->children.size()); entry->root_node()->children[0]->children[0]->frame_entry.get();
FrameNavigationEntry* new_frame_entry = EXPECT_EQ(url4, new_frame_entry->url());
entry->root_node()->children[0]->children[0]->frame_entry.get();
EXPECT_EQ(url4, new_frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry->root_node()->children.size());
}
} }
// Tests navigation and then going back to a subframe navigation. // Tests navigation and then going back to a subframe navigation.
...@@ -2473,12 +2437,9 @@ TEST_F(NavigationControllerTest, BackSubframe) { ...@@ -2473,12 +2437,9 @@ TEST_F(NavigationControllerTest, BackSubframe) {
subframe->PrepareForCommit(); subframe->PrepareForCommit();
subframe->SendNavigateWithParams(&params); subframe->SendNavigateWithParams(&params);
// In UseSubframeNavigationEntries mode, we notify of a PageState update to // We notify of a PageState update here rather than during UpdateState for
// the entry here rather than during UpdateState. // auto subframe navigations.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED));
else
EXPECT_EQ(0U, notifications.size());
} }
// First manual subframe navigation. // First manual subframe navigation.
...@@ -2508,16 +2469,9 @@ TEST_F(NavigationControllerTest, BackSubframe) { ...@@ -2508,16 +2469,9 @@ TEST_F(NavigationControllerTest, BackSubframe) {
navigation_entry_committed_counter_ = 0; navigation_entry_committed_counter_ = 0;
EXPECT_EQ(2, controller.GetEntryCount()); EXPECT_EQ(2, controller.GetEntryCount());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should have a subframe FrameNavigationEntry.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { ASSERT_EQ(1U, entry2->root_node()->children.size());
// The entry should have a subframe FrameNavigationEntry. EXPECT_EQ(url2, entry2->root_node()->children[0]->frame_entry->url());
ASSERT_EQ(1U, entry2->root_node()->children.size());
EXPECT_EQ(url2, entry2->root_node()->children[0]->frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry2->root_node()->children.size());
}
// Second manual subframe navigation should also make a new entry. // Second manual subframe navigation should also make a new entry.
const GURL url3("http://foo3"); const GURL url3("http://foo3");
...@@ -2541,15 +2495,9 @@ TEST_F(NavigationControllerTest, BackSubframe) { ...@@ -2541,15 +2495,9 @@ TEST_F(NavigationControllerTest, BackSubframe) {
EXPECT_EQ(3, controller.GetEntryCount()); EXPECT_EQ(3, controller.GetEntryCount());
EXPECT_EQ(2, controller.GetCurrentEntryIndex()); EXPECT_EQ(2, controller.GetCurrentEntryIndex());
// Verify subframe entries if they're enabled (e.g. in --site-per-process). // The entry should have a subframe FrameNavigationEntry.
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { ASSERT_EQ(1U, entry3->root_node()->children.size());
// The entry should have a subframe FrameNavigationEntry. EXPECT_EQ(url3, entry3->root_node()->children[0]->frame_entry->url());
ASSERT_EQ(1U, entry3->root_node()->children.size());
EXPECT_EQ(url3, entry3->root_node()->children[0]->frame_entry->url());
} else {
// There are no subframe FrameNavigationEntries by default.
EXPECT_EQ(0U, entry3->root_node()->children.size());
}
// Go back one. // Go back one.
controller.GoBack(); controller.GoBack();
......
...@@ -592,13 +592,8 @@ TEST_F(RenderViewImplTest, OnNavStateChanged) { ...@@ -592,13 +592,8 @@ TEST_F(RenderViewImplTest, OnNavStateChanged) {
"document.getElementById('elt_text').value = 'foo';"); "document.getElementById('elt_text').value = 'foo';");
ProcessPendingMessages(); ProcessPendingMessages();
if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching(
EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( FrameHostMsg_UpdateState::ID));
FrameHostMsg_UpdateState::ID));
} else {
EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching(
ViewHostMsg_UpdateState::ID));
}
} }
TEST_F(RenderViewImplTest, OnNavigationHttpPost) { TEST_F(RenderViewImplTest, OnNavigationHttpPost) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment