summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/app_process_apitest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/app_process_apitest.cc')
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc53
1 files changed, 45 insertions, 8 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index dece83c..c812b1a 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -61,14 +61,7 @@ static void NavigateTabHelper(TabContents* contents, const GURL& url) {
EXPECT_EQ(url, contents->controller().GetLastCommittedEntry()->url());
}
-#if defined(OS_WIN)
-// AppProcess sometimes hangs on Windows
-// http://crbug.com/58810
-#define MAYBE_AppProcess DISABLED_AppProcess
-#else
-#define MAYBE_AppProcess AppProcess
-#endif
-IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) {
+IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisablePopupBlocking);
@@ -145,3 +138,47 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) {
&windowOpenerValid));
ASSERT_TRUE(windowOpenerValid);
}
+
+// Tests that app process switching works properly in the following scenario:
+// 1. navigate to a page1 in the app
+// 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect")
+// 3. page2 redirects back to a page in the app
+// The final navigation should end up in the app process.
+// See http://crbug.com/61757
+IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kDisablePopupBlocking);
+
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process")));
+
+ // Open two tabs in the app.
+ GURL base_url = test_server()->GetURL(
+ "files/extensions/api_test/app_process/");
+
+ // The app under test acts on URLs whose host is "localhost",
+ // so the URLs we navigate to must have host "localhost".
+ GURL::Replacements replace_host;
+ std::string host_str("localhost"); // must stay in scope with replace_host
+ replace_host.SetHostStr(host_str);
+ base_url = base_url.ReplaceComponents(replace_host);
+
+ browser()->NewTab();
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ browser()->NewTab();
+ // Wait until the second tab finishes its redirect train (2 hops).
+ ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
+ browser(), base_url.Resolve("path1/redirect.html"), 2);
+
+ // 3 tabs, including the initial about:blank. The last 2 should be the same
+ // process.
+ ASSERT_EQ(3, browser()->tab_count());
+ EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html",
+ browser()->GetTabContentsAt(2)->controller().
+ GetLastCommittedEntry()->url().path());
+ RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
+ EXPECT_EQ(host->process(),
+ browser()->GetTabContentsAt(2)->render_view_host()->process());
+}