Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2689 " Site A\n" | 2689 " Site A\n" |
| 2690 " |--Site A\n" | 2690 " |--Site A\n" |
| 2691 " +--Site A\n" | 2691 " +--Site A\n" |
| 2692 " |--Site A\n" | 2692 " |--Site A\n" |
| 2693 " +--Site A\n" | 2693 " +--Site A\n" |
| 2694 " +--Site A\n" | 2694 " +--Site A\n" |
| 2695 "Where A = http://127.0.0.1/", | 2695 "Where A = http://127.0.0.1/", |
| 2696 DepictFrameTree(root)); | 2696 DepictFrameTree(root)); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { | |
| 2700 GURL main_url( | |
| 2701 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | |
| 2702 NavigateToURL(shell(), main_url); | |
| 2703 | |
| 2704 // It is safe to obtain the root frame tree node here, as it doesn't change. | |
| 2705 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 2706 ->GetFrameTree() | |
| 2707 ->root(); | |
| 2708 | |
| 2709 // Navigate first child cross-site. | |
| 2710 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title3.html")); | |
| 2711 NavigateFrameToURL(root->child_at(0), frame_url); | |
| 2712 | |
| 2713 // Open a popup from the first child. | |
| 2714 ShellAddedObserver new_shell_observer; | |
| 2715 bool success = false; | |
| 2716 EXPECT_TRUE(ExecuteScriptAndExtractBool( | |
| 2717 root->child_at(0)->current_frame_host(), | |
| 2718 "window.domAutomationController.send(!!window.open('about:blank'));", | |
|
Charlie Reis
2015/07/09 23:42:51
Can you also add a test for window.open to a cross
alexmos
2015/07/10 18:35:00
Done. It works as-is. :)
I factored out the po
Charlie Reis
2015/07/10 21:44:49
Yes, content_browser_test_utils_internal.h is prob
| |
| 2719 &success)); | |
| 2720 EXPECT_TRUE(success); | |
| 2721 Shell* new_shell = new_shell_observer.GetShell(); | |
| 2722 | |
| 2723 // Check that the popup's opener is correct on both the browser and renderer | |
| 2724 // sides. | |
| 2725 FrameTreeNode* popup_root = | |
| 2726 static_cast<WebContentsImpl*>(new_shell->web_contents()) | |
| 2727 ->GetFrameTree() | |
| 2728 ->root(); | |
| 2729 EXPECT_EQ(root->child_at(0), popup_root->opener()); | |
| 2730 | |
| 2731 std::string opener_url; | |
| 2732 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
| 2733 popup_root->current_frame_host(), | |
| 2734 "window.domAutomationController.send(window.opener.location.href);", | |
| 2735 &opener_url)); | |
| 2736 EXPECT_EQ(frame_url.spec(), opener_url); | |
| 2737 } | |
| 2738 | |
| 2699 } // namespace content | 2739 } // namespace content |
| OLD | NEW |