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

Unified Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 1141453003: Fix setting the top-level FrameTreeNode name for named windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on Alex's review. Created 5 years, 7 months 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/web_contents/web_contents_impl_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index a9b2af954d89ead400a2ed2488c26c009e4c4c75..a343fa4fe27357ef2de66c7e8bf65b135a04efea 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -687,4 +687,52 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ChangeDisplayMode) {
EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle());
}
+IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, NewNamedWindow) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ GURL url = embedded_test_server()->GetURL("/click-noreferrer-links.html");
+ EXPECT_TRUE(NavigateToURL(shell(), url));
+
+ {
+ ShellAddedObserver new_shell_observer;
+
+ // Open a new, named window.
+ EXPECT_TRUE(ExecuteScript(shell()->web_contents(),
+ "window.open('about:blank','new_window');"));
+
+ Shell* new_shell = new_shell_observer.GetShell();
+ WaitForLoadStop(new_shell->web_contents());
+
+ EXPECT_EQ("new_window",
+ static_cast<WebContentsImpl*>(new_shell->web_contents())
+ ->GetFrameTree()->root()->frame_name());
+
+ bool success = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ new_shell->web_contents(),
+ "window.domAutomationController.send(window.name == 'new_window');",
+ &success));
+ EXPECT_TRUE(success);
+ }
+
+ {
+ ShellAddedObserver new_shell_observer;
+
+ // Test clicking a target=foo link.
+ bool success = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ shell()->web_contents(),
+ "window.domAutomationController.send(clickSameSiteTargetedLink());",
+ &success));
+ EXPECT_TRUE(success);
+
+ Shell* new_shell = new_shell_observer.GetShell();
+ WaitForLoadStop(new_shell->web_contents());
+
+ EXPECT_EQ("foo",
+ static_cast<WebContentsImpl*>(new_shell->web_contents())
+ ->GetFrameTree()->root()->frame_name());
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698