| Index: chrome/browser/prerender/prerender_browsertest.cc
|
| diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
|
| index 7239181c9037cdbaa5a1ca74ec0cd72a95a5a4f5..cc4854b7dddf06de3a75f60978bb7bb724b7a7d2 100644
|
| --- a/chrome/browser/prerender/prerender_browsertest.cc
|
| +++ b/chrome/browser/prerender/prerender_browsertest.cc
|
| @@ -54,6 +54,8 @@
|
| #include "content/public/browser/devtools_agent_host.h"
|
| #include "content/public/browser/devtools_client_host.h"
|
| #include "content/public/browser/devtools_manager.h"
|
| +#include "content/public/browser/navigation_controller.h"
|
| +#include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/browser/render_view_host.h"
|
| @@ -101,8 +103,8 @@ namespace prerender {
|
| namespace {
|
|
|
| // Constants used in the test HTML files.
|
| -static const char* kReadyTitle = "READY";
|
| -static const char* kPassTitle = "PASS";
|
| +const char* kReadyTitle = "READY";
|
| +const char* kPassTitle = "PASS";
|
|
|
| std::string CreateClientRedirect(const std::string& dest_url) {
|
| const char* const kClientRedirectBase = "client-redirect?";
|
| @@ -829,7 +831,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest {
|
| void NavigateToDestURLInNewTab() const {
|
| // First, open a new tab.
|
| current_browser()->OpenURL(
|
| - content::OpenURLParams(GURL("chrome://blank"), Referrer(),
|
| + content::OpenURLParams(GURL(content::kAboutBlankURL), Referrer(),
|
| NEW_FOREGROUND_TAB,
|
| content::PAGE_TRANSITION_TYPED, false));
|
| // Next, navigate to the destination URL. The swap-in will not succeed,
|
| @@ -3348,4 +3350,24 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageNewTab) {
|
| NavigateToDestURLInNewTab();
|
| }
|
|
|
| +// Checks that prerenders honor |should_replace_current_entry|.
|
| +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReplaceCurrentEntry) {
|
| + PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
|
| +
|
| + content::OpenURLParams params(dest_url(), Referrer(), CURRENT_TAB,
|
| + content::PAGE_TRANSITION_TYPED, false);
|
| + params.should_replace_current_entry = true;
|
| + NavigateToURLWithParams(params, false);
|
| +
|
| + WebContents* web_contents =
|
| + current_browser()->tab_strip_model()->GetActiveWebContents();
|
| + const NavigationController& controller = web_contents->GetController();
|
| + // First entry is about:blank, second is prerender_page.html.
|
| + EXPECT_TRUE(controller.GetPendingEntry() == NULL);
|
| + EXPECT_EQ(2, controller.GetEntryCount());
|
| + EXPECT_EQ(GURL(content::kAboutBlankURL),
|
| + controller.GetEntryAtIndex(0)->GetURL());
|
| + EXPECT_EQ(dest_url(), controller.GetEntryAtIndex(1)->GetURL());
|
| +}
|
| +
|
| } // namespace prerender
|
|
|