| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/containers/hash_tables.h" | 6 #include "base/containers/hash_tables.h" |
| 7 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 7 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 8 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 8 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 9 #include "content/browser/renderer_host/render_view_host_factory.h" | 9 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), | 51 EXPECT_EQ(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), |
| 52 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID()); | 52 shell2->web_contents()->GetRenderViewHost()->GetProcess()->GetID()); |
| 53 *target_routing_id = | 53 *target_routing_id = |
| 54 shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); | 54 shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); |
| 55 EXPECT_NE(*target_routing_id, | 55 EXPECT_NE(*target_routing_id, |
| 56 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); | 56 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); |
| 57 | 57 |
| 58 // Now, simulate a link click coming from the renderer. | 58 // Now, simulate a link click coming from the renderer. |
| 59 GURL extension_url("https://bar.com/files/simple_page.html"); | 59 GURL extension_url("https://bar.com/files/simple_page.html"); |
| 60 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); | 60 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); |
| 61 RenderViewHostImpl* rvh = |
| 62 wc->GetRenderManagerForTesting()->current_host(); |
| 63 int64 frame_id = rvh->GetFrameIDForTesting( |
| 64 wc->GetFrameTree()->root()->frame_tree_node_id()); |
| 61 wc->RequestOpenURL( | 65 wc->RequestOpenURL( |
| 62 shell->web_contents()->GetRenderViewHost(), extension_url, | 66 rvh, extension_url, Referrer(), CURRENT_TAB, frame_id, false, true); |
| 63 Referrer(), CURRENT_TAB, wc->GetFrameTree()->root()->frame_id(), | |
| 64 false, true); | |
| 65 | 67 |
| 66 // Since the navigation above requires a cross-process swap, there will be a | 68 // Since the navigation above requires a cross-process swap, there will be a |
| 67 // pending RenderViewHost. Ensure it exists and is in a different process | 69 // pending RenderViewHost. Ensure it exists and is in a different process |
| 68 // than the initial page. | 70 // than the initial page. |
| 69 RenderViewHostImpl* pending_rvh = | 71 RenderViewHostImpl* pending_rvh = |
| 70 wc->GetRenderManagerForTesting()->pending_render_view_host(); | 72 wc->GetRenderManagerForTesting()->pending_render_view_host(); |
| 71 EXPECT_TRUE(pending_rvh != NULL); | 73 EXPECT_TRUE(pending_rvh != NULL); |
| 72 EXPECT_NE(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), | 74 EXPECT_NE(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), |
| 73 pending_rvh->GetProcess()->GetID()); | 75 pending_rvh->GetProcess()->GetID()); |
| 74 | 76 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Since this test executes on the UI thread and hopping threads might cause | 161 // Since this test executes on the UI thread and hopping threads might cause |
| 160 // different timing in the test, let's simulate a CreateNewWidget call coming | 162 // different timing in the test, let's simulate a CreateNewWidget call coming |
| 161 // from the IO thread. Use the existing window routing id to cause a | 163 // from the IO thread. Use the existing window routing id to cause a |
| 162 // deliberate collision. | 164 // deliberate collision. |
| 163 pending_rvh->CreateNewWidget(duplicate_routing_id, blink::WebPopupTypeSelect); | 165 pending_rvh->CreateNewWidget(duplicate_routing_id, blink::WebPopupTypeSelect); |
| 164 | 166 |
| 165 // If the above operation doesn't crash, the test has succeeded! | 167 // If the above operation doesn't crash, the test has succeeded! |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace content | 170 } // namespace content |
| OLD | NEW |