Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Unified Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 2482873002: Add is_srcdoc to FrameNavigationEntry and restore about::srcdoc URL. (Closed)
Patch Set: Addressed comments (@nasko) Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..dd0d46161d8a3dfa429c5441572d868fa2b1d0f8 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,41 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
}
+// Verifies that FrameNavigationEntry's srcdoc attribute is valid.
+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());
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+ FrameNavigationEntry* frame_entry_1 = entry->GetFrameEntry(root->child_at(0));
+ FrameNavigationEntry* frame_entry_2 = entry->GetFrameEntry(root->child_at(1));
+
+ // 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));
+}
+
namespace {
class RequestMonitoringNavigationBrowserTest : public ContentBrowserTest {
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/browser/frame_host/navigation_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698