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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 7093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7104 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 7104 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
7105 EXPECT_TRUE(rvh->is_swapped_out_); | 7105 EXPECT_TRUE(rvh->is_swapped_out_); |
7106 | 7106 |
7107 // Have the child frame navigate its parent to its SiteInstance. | 7107 // Have the child frame navigate its parent to its SiteInstance. |
7108 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 7108 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
7109 std::string script = base::StringPrintf( | 7109 std::string script = base::StringPrintf( |
7110 "window.domAutomationController.send(" | 7110 "window.domAutomationController.send(" |
7111 "parent.location = '%s');", | 7111 "parent.location = '%s');", |
7112 b_url.spec().c_str()); | 7112 b_url.spec().c_str()); |
7113 | 7113 |
| 7114 // Ensure the child has received a user gesture, so that it has permission |
| 7115 // to framebust. |
| 7116 SimulateMouseClick( |
| 7117 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), 1, 1); |
7114 TestFrameNavigationObserver frame_observer(root); | 7118 TestFrameNavigationObserver frame_observer(root); |
7115 EXPECT_TRUE(ExecuteScript(root->child_at(0), script)); | 7119 EXPECT_TRUE(ExecuteScript(root->child_at(0), script)); |
7116 frame_observer.Wait(); | 7120 frame_observer.Wait(); |
7117 EXPECT_EQ(b_url, root->current_url()); | 7121 EXPECT_EQ(b_url, root->current_url()); |
7118 | 7122 |
7119 // Verify that the same RenderViewHost is preserved and that it is no longer | 7123 // Verify that the same RenderViewHost is preserved and that it is no longer |
7120 // in swapped out state. | 7124 // in swapped out state. |
7121 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 7125 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
7122 root->current_frame_host()->GetSiteInstance())); | 7126 root->current_frame_host()->GetSiteInstance())); |
7123 EXPECT_FALSE(rvh->is_swapped_out_); | 7127 EXPECT_FALSE(rvh->is_swapped_out_); |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8516 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | 8520 EXPECT_TRUE(NavigateToURL(shell(), b_url)); |
8517 | 8521 |
8518 base::string16 expected_title(base::UTF8ToUTF16("foo")); | 8522 base::string16 expected_title(base::UTF8ToUTF16("foo")); |
8519 TitleWatcher title_watcher(popup2->web_contents(), expected_title); | 8523 TitleWatcher title_watcher(popup2->web_contents(), expected_title); |
8520 EXPECT_TRUE(ExecuteScript( | 8524 EXPECT_TRUE(ExecuteScript( |
8521 shell(), "window.open('','popup2').postMessage('foo', '*');")); | 8525 shell(), "window.open('','popup2').postMessage('foo', '*');")); |
8522 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 8526 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
8523 } | 8527 } |
8524 | 8528 |
8525 } // namespace content | 8529 } // namespace content |
OLD | NEW |