Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: content/test/test_web_contents.cc

Issue 701953006: PlzNavigate: Speculatively spawns a renderer process for navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed missing references to |base| namespace. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« content/test/test_web_contents.h ('K') | « content/test/test_web_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_web_contents.cc
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc
index 6a2e05e2b9cc805bcd8109b20f72f186841f8c35..572f2bbdfea493729fa3fd85654df78325e97163 100644
--- a/content/test/test_web_contents.cc
+++ b/content/test/test_web_contents.cc
@@ -154,7 +154,8 @@ void TestWebContents::CommitPendingNavigation() {
// proper renderer.
old_rfh->PrepareForCommit(entry->GetURL());
- TestRenderFrameHost* rfh = GetPendingMainFrame();
+ TestRenderFrameHost* rfh = GetFutureMainFrame();
+
if (!rfh)
rfh = old_rfh;
@@ -172,8 +173,11 @@ void TestWebContents::CommitPendingNavigation() {
}
void TestWebContents::ProceedWithCrossSiteNavigation() {
- if (!GetPendingMainFrame())
+ if (!GetPendingMainFrame() ||
clamy 2014/12/29 17:36:22 This return is no longer necessary, as following t
carlosk 2014/12/30 15:54:50 Done.
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
return;
+ }
GetMainFrame()->SendBeforeUnloadACK(true);
}
@@ -257,4 +261,17 @@ void TestWebContents::ShowCreatedWidget(int route_id,
void TestWebContents::ShowCreatedFullscreenWidget(int route_id) {
}
+TestRenderFrameHost* TestWebContents::GetSpeculativeMainFrame() const {
+ return static_cast<TestRenderFrameHost*>(
+ GetRenderManager()->speculative_render_frame_host_.get());
+}
+
+TestRenderFrameHost* TestWebContents::GetFutureMainFrame() const {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ return GetSpeculativeMainFrame();
+ }
+ return GetPendingMainFrame();
+}
+
} // namespace content
« content/test/test_web_contents.h ('K') | « content/test/test_web_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698