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 5516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5527 WebContents* contents = shell()->web_contents(); | 5527 WebContents* contents = shell()->web_contents(); |
5528 FrameTreeNode* root = | 5528 FrameTreeNode* root = |
5529 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); | 5529 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); |
5530 | 5530 |
5531 // Simulate subframe B creating a new child frame in parallel to main frame A | 5531 // Simulate subframe B creating a new child frame in parallel to main frame A |
5532 // detaching subframe B. We can't use ExecuteScript in both A and B to do | 5532 // detaching subframe B. We can't use ExecuteScript in both A and B to do |
5533 // this simultaneously, as that won't guarantee the timing that we want. | 5533 // this simultaneously, as that won't guarantee the timing that we want. |
5534 // Instead, tell A to detach B and then send a fake proxy creation IPC to A | 5534 // Instead, tell A to detach B and then send a fake proxy creation IPC to A |
5535 // that would've come from create-child-frame code in B. Prepare parameters | 5535 // that would've come from create-child-frame code in B. Prepare parameters |
5536 // for that IPC ahead of the detach, while B's FrameTreeNode still exists. | 5536 // for that IPC ahead of the detach, while B's FrameTreeNode still exists. |
5537 SiteInstance* site_instance_a = root->current_frame_host()->GetSiteInstance(); | 5537 SiteInstanceImpl* site_instance_a = |
| 5538 root->current_frame_host()->GetSiteInstance(); |
5538 RenderProcessHost* process_a = | 5539 RenderProcessHost* process_a = |
5539 root->render_manager()->current_frame_host()->GetProcess(); | 5540 root->render_manager()->current_frame_host()->GetProcess(); |
5540 int new_routing_id = process_a->GetNextRoutingID(); | 5541 int new_routing_id = process_a->GetNextRoutingID(); |
5541 int view_routing_id = | 5542 int view_routing_id = |
5542 root->frame_tree()->GetRenderViewHost(site_instance_a)->GetRoutingID(); | 5543 root->frame_tree()->GetRenderViewHost(site_instance_a)->GetRoutingID(); |
5543 int parent_routing_id = | 5544 int parent_routing_id = |
5544 root->child_at(0)->render_manager()->GetProxyToParent()->GetRoutingID(); | 5545 root->child_at(0)->render_manager()->GetProxyToParent()->GetRoutingID(); |
5545 | 5546 |
5546 // Tell main frame A to delete its subframe B. | 5547 // Tell main frame A to delete its subframe B. |
5547 FrameDeletedObserver observer(root->child_at(0)); | 5548 FrameDeletedObserver observer(root->child_at(0)); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6310 EXPECT_EQ(b_url, root->current_url()); | 6311 EXPECT_EQ(b_url, root->current_url()); |
6311 | 6312 |
6312 // Verify that the same RenderViewHost is preserved and that it is no longer | 6313 // Verify that the same RenderViewHost is preserved and that it is no longer |
6313 // in swapped out state. | 6314 // in swapped out state. |
6314 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 6315 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
6315 root->current_frame_host()->GetSiteInstance())); | 6316 root->current_frame_host()->GetSiteInstance())); |
6316 EXPECT_FALSE(rvh->is_swapped_out_); | 6317 EXPECT_FALSE(rvh->is_swapped_out_); |
6317 } | 6318 } |
6318 | 6319 |
6319 } // namespace content | 6320 } // namespace content |
OLD | NEW |