Avoids the extension check in ShouldFork for server-redirects.
These are already handled by the transfer navigation logic in the browser.
This is a first step towards moving the transfer navigation logic.
Also tests that the is_redirect value refers to server redirects and not
client redirects, by making sure we still swap processes for a client redirect
to an app.
BUG=238331
TEST=No behavior change.
Review URL: https://chromiumcodereview.appspot.com/16116006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203255 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index bcc8c64..b09c107 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -661,9 +661,9 @@
}
// Tests that if an extension launches an app via chrome.tabs.create with an URL
-// that's not in the app's extent but that redirects to it, we still end up with
-// an app process. See http://crbug.com/99349 for more details.
-IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromExtension) {
+// that's not in the app's extent but that server redirects to it, we still end
+// up with an app process. See http://crbug.com/99349 for more details.
+IN_PROC_BROWSER_TEST_F(AppApiTest, ServerRedirectToAppFromExtension) {
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(StartTestServer());
@@ -682,7 +682,48 @@
// Load the launcher extension, which should launch the app.
ui_test_utils::NavigateToURLWithDisposition(
browser(),
- launcher->GetResourceURL("main.html"),
+ launcher->GetResourceURL("server_redirect.html"),
+ CURRENT_TAB,
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+
+ // Wait for app tab to be created and loaded.
+ test_navigation_observer.WaitForObservation(
+ base::Bind(&content::RunMessageLoop),
+ base::Bind(&MessageLoop::Quit,
+ base::Unretained(MessageLoopForUI::current())));
+
+ // App has loaded, and chrome.app.isInstalled should be true.
+ bool is_installed = false;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ "window.domAutomationController.send(chrome.app.isInstalled)",
+ &is_installed));
+ ASSERT_TRUE(is_installed);
+}
+
+// Tests that if an extension launches an app via chrome.tabs.create with an URL
+// that's not in the app's extent but that client redirects to it, we still end
+// up with an app process.
+IN_PROC_BROWSER_TEST_F(AppApiTest, ClientRedirectToAppFromExtension) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(StartTestServer());
+
+ LoadExtension(test_data_dir_.AppendASCII("app_process"));
+ const Extension* launcher =
+ LoadExtension(test_data_dir_.AppendASCII("app_launcher"));
+
+ // There should be three navigations by the time the app page is loaded.
+ // 1. The extension launcher page.
+ // 2. The URL that the extension launches, which client redirects.
+ // 3. The app's URL.
+ content::TestNavigationObserver test_navigation_observer(
+ content::NotificationService::AllSources(),
+ 3);
+
+ // Load the launcher extension, which should launch the app.
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(),
+ launcher->GetResourceURL("client_redirect.html"),
CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);