| 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 d0c797accff73530650ccb7b55f8132b3edaa7e2..e527e4f5995469eb4ae8353b13a20639a881710b 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
|
| @@ -950,7 +950,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
|
|
|
| // Verify the tree of FrameNavigationEntries after NAVIGATION_TYPE_AUTO_SUBFRAME
|
| // commits.
|
| -// TODO(creis): Test cross-site and nested iframes.
|
| +// TODO(creis): Test cross-site iframes.
|
| // TODO(creis): Test updating entries for history auto subframe navigations.
|
| IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
|
| FrameNavigationEntry_AutoSubframe) {
|
| @@ -996,6 +996,70 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
|
| // There are no subframe FrameNavigationEntries by default.
|
| EXPECT_EQ(0U, entry->root_node()->children.size());
|
| }
|
| +
|
| + // Create a second iframe.
|
| + {
|
| + LoadCommittedCapturer capturer(shell()->web_contents());
|
| + std::string script = "var iframe = document.createElement('iframe');"
|
| + "iframe.src = '" + frame_url.spec() + "';"
|
| + "document.body.appendChild(iframe);";
|
| + EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
|
| + capturer.Wait();
|
| + EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
|
| + }
|
| +
|
| + // The last committed NavigationEntry shouldn't have changed.
|
| + EXPECT_EQ(1, controller.GetEntryCount());
|
| + entry = controller.GetLastCommittedEntry();
|
| + EXPECT_EQ(main_url, entry->GetURL());
|
| + root_entry = entry->root_node()->frame_entry.get();
|
| + 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)) {
|
| + // The entry should now have 2 subframe FrameNavigationEntries.
|
| + ASSERT_EQ(2U, entry->root_node()->children.size());
|
| + FrameNavigationEntry* frame_entry =
|
| + entry->root_node()->children[1]->frame_entry.get();
|
| + EXPECT_EQ(frame_url, frame_entry->url());
|
| + } else {
|
| + // There are no subframe FrameNavigationEntries by default.
|
| + EXPECT_EQ(0U, entry->root_node()->children.size());
|
| + }
|
| +
|
| + // Create a nested iframe in the second subframe.
|
| + {
|
| + LoadCommittedCapturer capturer(shell()->web_contents());
|
| + std::string script = "var iframe = document.createElement('iframe');"
|
| + "iframe.src = '" + frame_url.spec() + "';"
|
| + "document.body.appendChild(iframe);";
|
| + EXPECT_TRUE(content::ExecuteScript(root->child_at(1)->current_frame_host(),
|
| + script));
|
| + capturer.Wait();
|
| + EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
|
| + }
|
| +
|
| + // The last committed NavigationEntry shouldn't have changed.
|
| + EXPECT_EQ(1, controller.GetEntryCount());
|
| + entry = controller.GetLastCommittedEntry();
|
| + EXPECT_EQ(main_url, entry->GetURL());
|
| + root_entry = entry->root_node()->frame_entry.get();
|
| + 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)) {
|
| + // 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());
|
| + FrameNavigationEntry* frame_entry =
|
| + entry->root_node()->children[1]->children[0]->frame_entry.get();
|
| + EXPECT_EQ(frame_url, frame_entry->url());
|
| + } else {
|
| + // There are no subframe FrameNavigationEntries by default.
|
| + EXPECT_EQ(0U, entry->root_node()->children.size());
|
| + }
|
| }
|
|
|
| namespace {
|
|
|