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 3938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3949 RenderProcessHostWatcher process_exit_observer( | 3949 RenderProcessHostWatcher process_exit_observer( |
3950 rvh->GetProcess(), | 3950 rvh->GetProcess(), |
3951 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 3951 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
3952 process_exit_observer.Wait(); | 3952 process_exit_observer.Wait(); |
3953 | 3953 |
3954 // Start a navigation back to A and check that the RenderViewHost wasn't | 3954 // Start a navigation back to A and check that the RenderViewHost wasn't |
3955 // reused. | 3955 // reused. |
3956 TestNavigationObserver navigation_observer(shell()->web_contents()); | 3956 TestNavigationObserver navigation_observer(shell()->web_contents()); |
3957 shell()->LoadURL(a_url); | 3957 shell()->LoadURL(a_url); |
3958 RenderViewHostImpl* pending_rvh = | 3958 RenderViewHostImpl* pending_rvh = |
3959 root->render_manager()->pending_render_view_host(); | 3959 IsBrowserSideNavigationEnabled() |
| 3960 ? root->render_manager()->speculative_frame_host()->render_view_host() |
| 3961 : root->render_manager()->pending_render_view_host(); |
3960 EXPECT_EQ(rvh->GetSiteInstance(), pending_rvh->GetSiteInstance()); | 3962 EXPECT_EQ(rvh->GetSiteInstance(), pending_rvh->GetSiteInstance()); |
3961 EXPECT_NE(rvh, pending_rvh); | 3963 EXPECT_NE(rvh, pending_rvh); |
3962 | 3964 |
3963 // Simulate that the dropped SwapOut ACK message arrives now on the original | 3965 // Simulate that the dropped SwapOut ACK message arrives now on the original |
3964 // RenderFrameHost, which should now get deleted. | 3966 // RenderFrameHost, which should now get deleted. |
3965 rfh->OnSwappedOut(); | 3967 rfh->OnSwappedOut(); |
3966 EXPECT_TRUE(deleted_observer.deleted()); | 3968 EXPECT_TRUE(deleted_observer.deleted()); |
3967 | 3969 |
3968 // Make sure the last navigation finishes without crashing. | 3970 // Make sure the last navigation finishes without crashing. |
3969 navigation_observer.Wait(); | 3971 navigation_observer.Wait(); |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4778 NavigationController::LoadURLParams params(same_site_url); | 4780 NavigationController::LoadURLParams params(same_site_url); |
4779 params.transition_type = ui::PAGE_TRANSITION_LINK; | 4781 params.transition_type = ui::PAGE_TRANSITION_LINK; |
4780 params.frame_tree_node_id = node->frame_tree_node_id(); | 4782 params.frame_tree_node_id = node->frame_tree_node_id(); |
4781 node->navigator()->GetController()->LoadURLWithParams(params); | 4783 node->navigator()->GetController()->LoadURLWithParams(params); |
4782 } | 4784 } |
4783 | 4785 |
4784 // Grab the routing id of the pending RenderFrameHost and set up a process | 4786 // Grab the routing id of the pending RenderFrameHost and set up a process |
4785 // observer to ensure there is no crash when a new RenderFrame creation is | 4787 // observer to ensure there is no crash when a new RenderFrame creation is |
4786 // attempted. | 4788 // attempted. |
4787 RenderProcessHost* process = | 4789 RenderProcessHost* process = |
4788 node->render_manager()->pending_frame_host()->GetProcess(); | 4790 IsBrowserSideNavigationEnabled() |
| 4791 ? node->render_manager()->speculative_frame_host()->GetProcess() |
| 4792 : node->render_manager()->pending_frame_host()->GetProcess(); |
4789 RenderProcessHostWatcher watcher( | 4793 RenderProcessHostWatcher watcher( |
4790 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 4794 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
4791 int frame_routing_id = | 4795 int frame_routing_id = |
4792 node->render_manager()->pending_frame_host()->GetRoutingID(); | 4796 IsBrowserSideNavigationEnabled() |
| 4797 ? node->render_manager()->speculative_frame_host()->GetRoutingID() |
| 4798 : node->render_manager()->pending_frame_host()->GetRoutingID(); |
4793 int proxy_routing_id = | 4799 int proxy_routing_id = |
4794 node->render_manager()->GetProxyToParent()->GetRoutingID(); | 4800 node->render_manager()->GetProxyToParent()->GetRoutingID(); |
4795 | 4801 |
4796 // Now go to c.com so the navigation to a.com is cancelled and send an IPC | 4802 // Now go to c.com so the navigation to a.com is cancelled and send an IPC |
4797 // to create a new RenderFrame with the routing id of the previously pending | 4803 // to create a new RenderFrame with the routing id of the previously pending |
4798 // one. | 4804 // one. |
4799 NavigateFrameToURL(node, | 4805 NavigateFrameToURL(node, |
4800 embedded_test_server()->GetURL("c.com", "/title2.html")); | 4806 embedded_test_server()->GetURL("c.com", "/title2.html")); |
4801 { | 4807 { |
4802 FrameMsg_NewFrame_Params params; | 4808 FrameMsg_NewFrame_Params params; |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5295 | 5301 |
5296 // Force the renderer to generate a new frame. | 5302 // Force the renderer to generate a new frame. |
5297 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5303 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
5298 "document.body.style.background = 'black'")); | 5304 "document.body.style.background = 'black'")); |
5299 | 5305 |
5300 // Waits for the next frame. | 5306 // Waits for the next frame. |
5301 observer->Wait(); | 5307 observer->Wait(); |
5302 } | 5308 } |
5303 | 5309 |
5304 } // namespace content | 5310 } // namespace content |
OLD | NEW |