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 EXPECT_TRUE(NavigateToURL(shell(), url)); |
| 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()); |
| 709 |
| 710 bool success = false; |
| 711 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 712 new_shell->web_contents(), |
| 713 "window.domAutomationController.send(window.name == 'new_window');", |
| 714 &success)); |
| 715 EXPECT_TRUE(success); |
| 716 } |
| 717 |
| 718 { |
| 719 ShellAddedObserver new_shell_observer; |
| 720 |
| 721 // Test clicking a target=foo link. |
| 722 bool success = false; |
| 723 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 724 shell()->web_contents(), |
| 725 "window.domAutomationController.send(clickSameSiteTargetedLink());", |
| 726 &success)); |
| 727 EXPECT_TRUE(success); |
| 728 |
| 729 Shell* new_shell = new_shell_observer.GetShell(); |
| 730 WaitForLoadStop(new_shell->web_contents()); |
| 731 |
| 732 EXPECT_EQ("foo", |
| 733 static_cast<WebContentsImpl*>(new_shell->web_contents()) |
| 734 ->GetFrameTree()->root()->frame_name()); |
| 735 } |
| 736 } |
| 737 |
690 } // namespace content | 738 } // namespace content |
OLD | NEW |