Chromium Code Reviews| 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 079902d6041b44b7db2351bb032e40ad9f45f36e..864adbbdc289ff6d6857b5cf1d125d44692ef634 100644 |
| --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| @@ -3349,8 +3349,6 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| back_load_observer.Wait(); |
| } |
| ASSERT_EQ(1U, root->child_count()); |
| - // TODO(creis): This line is unexpectedly failing in PlzNavigate, so the test |
| - // is disabled there for now. |
| ASSERT_EQ(1U, root->child_at(0)->child_count()); |
| ASSERT_EQ(0U, root->child_at(0)->child_at(0)->child_count()); |
| EXPECT_EQ(main_url, root->current_url()); |
| @@ -6788,6 +6786,48 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| } |
| } |
| +// Verifies that FrameNavigationEntry's srcdoc attribute is valid. |
|
alexmos
2016/11/07 22:51:46
nit: might be useful to include a reference to htt
arthursonzogni
2016/11/08 12:21:30
Yes, this CL is related to this bug. But this test
|
| +IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| + FrameNavigationEntry_Srcdoc) { |
| + // This test only makes sense when subframe FrameNavigationEntries are in use. |
| + if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| + return; |
| + |
| + const NavigationControllerImpl& controller = |
| + static_cast<const NavigationControllerImpl&>( |
| + shell()->web_contents()->GetController()); |
| + |
| + // Navigate to a page with two iframes, one with the srcdoc attribute and one |
| + // without it. |
| + GURL url(embedded_test_server()->GetURL( |
| + "/navigation_controller/page_with_srcdoc.html")); |
| + ASSERT_TRUE(NavigateToURL(shell(), url)); |
| + |
| + // Check that there is two iframes. |
| + ASSERT_EQ(1, controller.GetEntryCount()); |
| + NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); |
| + ASSERT_EQ(2U, entry->root_node()->children.size()); |
| + FrameNavigationEntry* frame_entry_1 = |
| + entry->root_node()->children[0]->frame_entry.get(); |
| + FrameNavigationEntry* frame_entry_2 = |
| + entry->root_node()->children[1]->frame_entry.get(); |
| + |
| + // The FrameNavigationEntry's order is not guaranteed to be preserved. Swap |
| + // the entries if there is an inversion. |
|
alexmos
2016/11/07 22:51:45
Instead of reordering, can you get the FNEs via Fr
arthursonzogni
2016/11/08 12:21:30
Thanks! It is better now.
|
| + GURL iframe_2_url(embedded_test_server()->GetURL( |
| + "/navigation_controller/simple_page_1.html")); |
| + if (frame_entry_2->url() != iframe_2_url) |
| + std::swap(frame_entry_1,frame_entry_2); |
| + |
| + // Check the is_srcdoc() method returns the right value. |
| + EXPECT_EQ(frame_entry_1->is_srcdoc(), true); |
| + EXPECT_EQ(frame_entry_2->is_srcdoc(), false); |
| + |
| + // Check the iframe URL has been converted from about::srcdoc to about::blank. |
| + EXPECT_EQ(frame_entry_1->url(), GURL(url::kAboutBlankURL)); |
| + EXPECT_EQ(frame_entry_2->url(), iframe_2_url); |
|
alexmos
2016/11/07 22:51:46
Is the part with restoring a srcdoc iframe after a
arthursonzogni
2016/11/08 12:21:30
I am not sure I fully understand the question. The
|
| +} |
| + |
| namespace { |
| class RequestMonitoringNavigationBrowserTest : public ContentBrowserTest { |