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 7013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 7024 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
7025 EXPECT_TRUE(rvh->is_swapped_out_); | 7025 EXPECT_TRUE(rvh->is_swapped_out_); |
7026 | 7026 |
7027 // Have the child frame navigate its parent to its SiteInstance. | 7027 // Have the child frame navigate its parent to its SiteInstance. |
7028 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 7028 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
7029 std::string script = base::StringPrintf( | 7029 std::string script = base::StringPrintf( |
7030 "window.domAutomationController.send(" | 7030 "window.domAutomationController.send(" |
7031 "parent.location = '%s');", | 7031 "parent.location = '%s');", |
7032 b_url.spec().c_str()); | 7032 b_url.spec().c_str()); |
7033 | 7033 |
| 7034 // Ensure the child has received a user gesture, so that it has permission |
| 7035 // to framebust. |
| 7036 SimulateMouseClick( |
| 7037 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), 1, 1); |
7034 TestFrameNavigationObserver frame_observer(root); | 7038 TestFrameNavigationObserver frame_observer(root); |
7035 EXPECT_TRUE(ExecuteScript(root->child_at(0), script)); | 7039 EXPECT_TRUE(ExecuteScript(root->child_at(0), script)); |
7036 frame_observer.Wait(); | 7040 frame_observer.Wait(); |
7037 EXPECT_EQ(b_url, root->current_url()); | 7041 EXPECT_EQ(b_url, root->current_url()); |
7038 | 7042 |
7039 // Verify that the same RenderViewHost is preserved and that it is no longer | 7043 // Verify that the same RenderViewHost is preserved and that it is no longer |
7040 // in swapped out state. | 7044 // in swapped out state. |
7041 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 7045 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
7042 root->current_frame_host()->GetSiteInstance())); | 7046 root->current_frame_host()->GetSiteInstance())); |
7043 EXPECT_FALSE(rvh->is_swapped_out_); | 7047 EXPECT_FALSE(rvh->is_swapped_out_); |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8262 // Now have the cross-process navigation commit and mark the current RFH as | 8266 // Now have the cross-process navigation commit and mark the current RFH as |
8263 // pending deletion. | 8267 // pending deletion. |
8264 cross_site_manager.WaitForNavigationFinished(); | 8268 cross_site_manager.WaitForNavigationFinished(); |
8265 | 8269 |
8266 // Resume the navigation in the previous RFH that has just been marked as | 8270 // Resume the navigation in the previous RFH that has just been marked as |
8267 // pending deletion. We should not crash. | 8271 // pending deletion. We should not crash. |
8268 transfer_manager.WaitForNavigationFinished(); | 8272 transfer_manager.WaitForNavigationFinished(); |
8269 } | 8273 } |
8270 | 8274 |
8271 } // namespace content | 8275 } // namespace content |
OLD | NEW |