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

Unified Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 9416031: Prerendered pages are swapped in at browser::Navigate time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove TODO Created 8 years, 10 months 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: chrome/browser/prerender/prerender_browsertest.cc
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index c98d0bfe929fbb4f0ed7695350b44021af56d8a2..f1ab3949a7ecb7fa49de0a608db7eacb7d5dba03 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -170,8 +170,13 @@ class TestPrerenderContents : public PrerenderContents {
// When the PrerenderContents is destroyed, quit the UI message loop.
// This happens on navigation to used prerendered pages, and soon
// after cancellation of unused prerendered pages.
- if (quit_message_loop_on_destruction_)
- MessageLoopForUI::current()->Quit();
+ if (quit_message_loop_on_destruction_) {
+ // The message loop may not be running if this is swapped in
+ // synchronously on a Navigation.
+ MessageLoop* loop = MessageLoopForUI::current();
+ if (loop->is_running())
+ loop->Quit();
+ }
}
virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE {
@@ -786,17 +791,11 @@ class PrerenderBrowserTest : public InProcessBrowserTest {
}
}
- // ui_test_utils::NavigateToURL waits until DidStopLoading is called on
- // the current tab. As that tab is going to end up deleted, and may never
- // finish loading before that happens, exit the message loop on the deletion
- // of the used prerender contents instead.
- //
- // As PrerenderTestURL waits until the prerendered page has completely
- // loaded, there is no race between loading |dest_url| and swapping the
- // prerendered TabContents into the tab.
+ // Navigate to the prerendered URL, but don't run the message loop. Browser
+ // issued navigations to prerendered pages will synchronously swap in the
+ // prerendered page.
ui_test_utils::NavigateToURLWithDisposition(
browser(), dest_url, disposition, ui_test_utils::BROWSER_TEST_NONE);
- ui_test_utils::RunMessageLoop();
// Make sure the PrerenderContents found earlier was used or removed.
EXPECT_TRUE(GetPrerenderContents() == NULL);
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | chrome/browser/prerender/prerender_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698