OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/browser/web_contents/web_contents_view.h" | 10 #include "content/browser/web_contents/web_contents_view.h" |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 // Simulate widget is entering fullscreen (changing size is enough). | 680 // Simulate widget is entering fullscreen (changing size is enough). |
681 shell()->web_contents()->GetRenderViewHost()->WasResized(); | 681 shell()->web_contents()->GetRenderViewHost()->WasResized(); |
682 | 682 |
683 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), | 683 ASSERT_TRUE(ExecuteScript(shell()->web_contents(), |
684 "document.title = " | 684 "document.title = " |
685 " window.matchMedia('(display-mode:" | 685 " window.matchMedia('(display-mode:" |
686 " fullscreen)').matches")); | 686 " fullscreen)').matches")); |
687 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); | 687 EXPECT_EQ(base::ASCIIToUTF16("true"), shell()->web_contents()->GetTitle()); |
688 } | 688 } |
689 | 689 |
690 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, NewNamedWindow) { | |
691 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
692 | |
693 GURL url = embedded_test_server()->GetURL("/click-noreferrer-links.html"); | |
694 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.
| |
695 | |
696 { | |
697 ShellAddedObserver new_shell_observer; | |
698 | |
699 // Open a new, named window. | |
700 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | |
701 "window.open('about:blank','new_window');")); | |
702 | |
703 Shell* new_shell = new_shell_observer.GetShell(); | |
704 WaitForLoadStop(new_shell->web_contents()); | |
705 | |
706 EXPECT_EQ("new_window", | |
707 static_cast<WebContentsImpl*>(new_shell->web_contents()) | |
708 ->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!
| |
709 } | |
710 | |
711 { | |
712 ShellAddedObserver new_shell_observer; | |
713 | |
714 // Test clicking a target=foo link. | |
715 bool success = false; | |
716 EXPECT_TRUE(ExecuteScriptAndExtractBool( | |
717 shell()->web_contents(), | |
718 "window.domAutomationController.send(clickSameSiteTargetedLink());", | |
719 &success)); | |
720 EXPECT_TRUE(success); | |
721 | |
722 Shell* new_shell = new_shell_observer.GetShell(); | |
723 WaitForLoadStop(new_shell->web_contents()); | |
724 | |
725 EXPECT_EQ("foo", | |
726 static_cast<WebContentsImpl*>(new_shell->web_contents()) | |
727 ->GetFrameTree()->root()->frame_name()); | |
728 } | |
729 } | |
730 | |
690 } // namespace content | 731 } // namespace content |
OLD | NEW |