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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
9 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 9 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); | 66 shell->web_contents()->GetRenderViewHost()->GetRoutingID()); |
67 | 67 |
68 // Now, simulate a link click coming from the renderer. | 68 // Now, simulate a link click coming from the renderer. |
69 GURL extension_url("https://bar.com/simple_page.html"); | 69 GURL extension_url("https://bar.com/simple_page.html"); |
70 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); | 70 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents()); |
71 wc->GetFrameTree()->root()->navigator()->RequestOpenURL( | 71 wc->GetFrameTree()->root()->navigator()->RequestOpenURL( |
72 wc->GetFrameTree()->root()->current_frame_host(), extension_url, nullptr, | 72 wc->GetFrameTree()->root()->current_frame_host(), extension_url, nullptr, |
73 Referrer(), CURRENT_TAB, false, true); | 73 Referrer(), CURRENT_TAB, false, true); |
74 | 74 |
75 // Since the navigation above requires a cross-process swap, there will be a | 75 // Since the navigation above requires a cross-process swap, there will be a |
76 // pending RenderViewHost. Ensure it exists and is in a different process | 76 // speculative/pending RenderViewHost. Ensure it exists and is in a different |
77 // than the initial page. | 77 // process than the initial page. |
78 RenderViewHostImpl* pending_rvh = | 78 RenderViewHostImpl* pending_rvh = nullptr; |
79 wc->GetRenderManagerForTesting()->pending_render_view_host(); | 79 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
80 switches::kEnableBrowserSideNavigation)) { | |
81 RenderFrameHostImpl* speculative_rfh = | |
82 wc->GetRenderManagerForTesting()->speculative_frame_host_for_testing(); | |
83 if (speculative_rfh) | |
84 pending_rvh = speculative_rfh->render_view_host(); | |
85 } else { | |
86 pending_rvh = wc->GetRenderManagerForTesting()->pending_render_view_host(); | |
carlosk
2015/06/08 18:32:43
I didn't create an equivalent RFHM::speculative_re
| |
87 } | |
88 | |
80 EXPECT_TRUE(pending_rvh != NULL); | 89 EXPECT_TRUE(pending_rvh != NULL); |
81 EXPECT_NE(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), | 90 EXPECT_NE(shell->web_contents()->GetRenderViewHost()->GetProcess()->GetID(), |
82 pending_rvh->GetProcess()->GetID()); | 91 pending_rvh->GetProcess()->GetID()); |
83 | 92 |
84 return pending_rvh; | 93 return pending_rvh; |
85 } | 94 } |
86 | 95 |
87 } // namespace | 96 } // namespace |
88 | 97 |
89 | 98 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 // "evil" message doesn't arrive in the intervening period. | 317 // "evil" message doesn't arrive in the intervening period. |
309 ASSERT_TRUE(content::ExecuteScript( | 318 ASSERT_TRUE(content::ExecuteScript( |
310 interstitial_page->GetMainFrame(), | 319 interstitial_page->GetMainFrame(), |
311 "window.domAutomationController.send(\"okay2\");")); | 320 "window.domAutomationController.send(\"okay2\");")); |
312 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 321 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
313 ASSERT_EQ("\"okay2\"", message); | 322 ASSERT_EQ("\"okay2\"", message); |
314 ASSERT_EQ("\"okay2\"", interstitial->last_command()); | 323 ASSERT_EQ("\"okay2\"", interstitial->last_command()); |
315 } | 324 } |
316 | 325 |
317 } // namespace content | 326 } // namespace content |
OLD | NEW |