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

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: 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698