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

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: Rebase and one more round of CR work. 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
Index: content/test/test_web_contents.cc
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc
index e4f4846f67b1e909fa6168de59350f80d62a87f6..9412ab1f059251e87c8009f1dbec5d097bf08b19 100644
--- a/content/test/test_web_contents.cc
+++ b/content/test/test_web_contents.cc
@@ -62,6 +62,11 @@ TestRenderFrameHost* TestWebContents::GetPendingMainFrame() const {
GetRenderManager()->pending_frame_host());
}
+TestRenderFrameHost* TestWebContents::GetSpeculativeMainFrame() const {
+ return static_cast<TestRenderFrameHost*>(
+ GetRenderManager()->speculative_render_frame_host_.get());
+}
+
void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host,
int page_id,
const GURL& url,
@@ -171,7 +176,14 @@ void TestWebContents::CommitPendingNavigation() {
// navigate.
ProceedWithCrossSiteNavigation();
TestRenderFrameHost* old_rfh = GetMainFrame();
- TestRenderFrameHost* rfh = GetPendingMainFrame();
+ TestRenderFrameHost* rfh;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ rfh = GetSpeculativeMainFrame();
clamy 2014/12/19 13:35:57 This is one of the cases where having a method tha
carlosk 2014/12/29 16:40:16 Done.
+ } else {
+ rfh = GetPendingMainFrame();
+ }
+
if (!rfh)
rfh = old_rfh;
@@ -191,7 +203,11 @@ void TestWebContents::CommitPendingNavigation() {
}
void TestWebContents::ProceedWithCrossSiteNavigation() {
- if (!GetPendingMainFrame())
+ // Note: At the moment in the navigation process when this method is called
nasko 2014/12/20 00:09:09 nit: s/process/progress/
carlosk 2014/12/29 16:40:17 (comment was removed)
+ // (after the RenderFrameHost committed), the speculative RenderFrameHost, if
nasko 2014/12/20 00:09:09 "(after the RenderFrameHost committed)" Is this ac
carlosk 2014/12/29 16:40:17 What I meant was that the call to RFH::CommitNavig
clamy 2014/12/29 17:36:21 In the current code path this function is called b
carlosk 2014/12/30 15:54:50 Acknowledged. What I said before was wrong...
+ // any, is already guaranteed to be the one that will be made active. That's
+ // why this works.
+ if (!GetPendingMainFrame() && !GetSpeculativeMainFrame())
clamy 2014/12/19 13:35:57 This function should only be called at the beginni
carlosk 2014/12/29 16:40:17 Done the 1st option as it eases things.
return;
GetMainFrame()->SendBeforeUnloadACK(true);
}
« content/public/test/web_contents_tester.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