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..8ce57b4b0f4f341768627e2c67c2a05104e9689b 100644 |
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc |
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc |
@@ -687,4 +687,45 @@ 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"); |
+ NavigateToURL(shell(), url); |
alexmos
2015/05/12 21:22:30
nit: EXPECT_TRUE around NavigateToURL? (note to s
nasko
2015/05/12 21:58:21
Done.
|
+ |
+ { |
+ 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()); |
alexmos
2015/05/12 21:22:30
Does the name also make it over to the new window'
nasko
2015/05/12 21:58:21
The window.open with cross-site URL should be alre
alexmos
2015/05/12 23:04:30
Right, makes sense, thanks!
|
+ } |
+ |
+ { |
+ 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 |