InstantExtended: add a switch for enabling the AppCache NTP.
Adds a new --instant-new-tab-url switch that triggers the following changes:
1. An NTP is no longer prerendered
2. Requests to chrome://newtab are rewritten to --instant-new-tab-url using the
existing browser-side URL rewrite mechanism.
Note that this change itself doesn't actually do anything in particular with
AppCache; it just makes it so we also load the (potentially cached) NTP on-demand
for each new tab.
BUG=none
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/19964007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213723 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chrome_content_browser_client_browsertest.cc b/chrome/browser/chrome_content_browser_client_browsertest.cc
index de24691..9d4b4946 100644
--- a/chrome/browser/chrome_content_browser_client_browsertest.cc
+++ b/chrome/browser/chrome_content_browser_client_browsertest.cc
@@ -3,8 +3,10 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/navigation_controller.h"
@@ -75,6 +77,37 @@
EXPECT_EQ(url, entry->GetVirtualURL());
}
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
+ UberURLHandler_InstantExtendedNewTabPage) {
+ const GURL url_original("chrome://newtab");
+ const GURL url_rewritten("http://example.com/newtab");
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kInstantNewTabURL, url_rewritten.spec());
+ chrome::EnableInstantExtendedAPIForTesting();
+
+ ui_test_utils::NavigateToURL(browser(), url_original);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url_rewritten, entry->GetURL());
+ EXPECT_EQ(url_original, entry->GetVirtualURL());
+}
+
+IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
+ UberURLHandler_InstantExtendedNewTabPageDisabled) {
+ const GURL url_original("chrome://newtab");
+ const GURL url_rewritten("http://example.com/newtab");
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kInstantNewTabURL, url_rewritten.spec());
+
+ ui_test_utils::NavigateToURL(browser(), url_original);
+ NavigationEntry* entry = GetLastCommittedEntry();
+
+ ASSERT_TRUE(entry != NULL);
+ EXPECT_EQ(url_original, entry->GetURL());
+ EXPECT_EQ(url_original, entry->GetVirtualURL());
+}
+
// Test that a basic navigation works in --site-per-process mode. This prevents
// regressions when that mode calls out into the ChromeContentBrowserClient,
// such as http://crbug.com/164223.