summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 10:10:51 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 10:10:51 +0000
commitaaef47579ed642bbf8ac1980a2a622fb48563e68 (patch)
treeecf1564a27bdc31f42b69a4ff02906d62a127a0b
parent0ef2384244cf06f323555b194ad45df14cc59236 (diff)
downloadchromium_src-aaef47579ed642bbf8ac1980a2a622fb48563e68.zip
chromium_src-aaef47579ed642bbf8ac1980a2a622fb48563e68.tar.gz
chromium_src-aaef47579ed642bbf8ac1980a2a622fb48563e68.tar.bz2
Split ReloadIntoAppProcessTest into three shorter tests.
1. Test navigating after app enable/disable. 2. Test reload after app enable/disable. 3. Test reload & navigate by JS after app enable/disable. BUG=179545 TBR=aa Review URL: https://chromiumcodereview.appspot.com/12380077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185696 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc65
1 files changed, 53 insertions, 12 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 759a46c..70034c1 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -397,16 +397,9 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) {
GetRenderProcessHost());
}
-// Ensure that reloading a URL after installing or uninstalling it as an app
-// correctly swaps the process. (http://crbug.com/80621)
-//
-// The test times out under AddressSanitizer, see http://crbug.com/103371
-#if defined(ADDRESS_SANITIZER)
-#define MAYBE_ReloadIntoAppProcess DISABLED_ReloadIntoAppProcess
-#else
-#define MAYBE_ReloadIntoAppProcess ReloadIntoAppProcess
-#endif
-IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) {
+// Ensure that re-navigating to a URL after installing or uninstalling it as an
+// app correctly swaps the tab to the app process. (http://crbug.com/80621)
+IN_PROC_BROWSER_TEST_F(AppApiTest, NavigateIntoAppProcess) {
extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service()->process_map();
@@ -423,7 +416,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) {
EXPECT_FALSE(process_map->Contains(
contents->GetRenderProcessHost()->GetID()));
- // Load app and navigate to the page.
+ // Load app and re-navigate to the page.
const Extension* app =
LoadExtension(test_data_dir_.AppendASCII("app_process"));
ASSERT_TRUE(app);
@@ -431,9 +424,33 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) {
EXPECT_TRUE(process_map->Contains(
contents->GetRenderProcessHost()->GetID()));
- // Disable app and navigate to the page.
+ // Disable app and re-navigate to the page.
+ DisableExtension(app->id());
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ EXPECT_FALSE(process_map->Contains(
+ contents->GetRenderProcessHost()->GetID()));
+}
+
+// Ensure that reloading a URL after installing or uninstalling it as an app
+// correctly swaps the tab to the app process. (http://crbug.com/80621)
+IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) {
+ extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get(
+ browser()->profile())->extension_service()->process_map();
+
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ // The app under test acts on URLs whose host is "localhost",
+ // so the URLs we navigate to must have host "localhost".
+ GURL base_url = GetTestBaseURL("app_process");
+
+ // Load app, disable it, and navigate to the page.
+ const Extension* app =
+ LoadExtension(test_data_dir_.AppendASCII("app_process"));
+ ASSERT_TRUE(app);
DisableExtension(app->id());
ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0);
EXPECT_FALSE(process_map->Contains(
contents->GetRenderProcessHost()->GetID()));
@@ -460,6 +477,30 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_ReloadIntoAppProcess) {
reload_observer2.Wait();
EXPECT_FALSE(process_map->Contains(
contents->GetRenderProcessHost()->GetID()));
+}
+
+// Ensure that reloading a URL with JavaScript after installing or uninstalling
+// it as an app correctly swaps the process. (http://crbug.com/80621)
+IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcessWithJavaScript) {
+ extensions::ProcessMap* process_map = extensions::ExtensionSystem::Get(
+ browser()->profile())->extension_service()->process_map();
+
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ // The app under test acts on URLs whose host is "localhost",
+ // so the URLs we navigate to must have host "localhost".
+ GURL base_url = GetTestBaseURL("app_process");
+
+ // Load app, disable it, and navigate to the page.
+ const Extension* app =
+ LoadExtension(test_data_dir_.AppendASCII("app_process"));
+ ASSERT_TRUE(app);
+ DisableExtension(app->id());
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ WebContents* contents = browser()->tab_strip_model()->GetWebContentsAt(0);
+ EXPECT_FALSE(process_map->Contains(
+ contents->GetRenderProcessHost()->GetID()));
// Enable app and reload via JavaScript.
EnableExtension(app->id());