Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8774)

Unified Diff: chrome/browser/extensions/app_process_apitest.cc

Issue 7063015: Swap processes on reload if a hosted app has been installed/uninstalled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile on Windows Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/app_process_apitest.cc
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 7467c04881925c1976e9c832c6bf8a1e6e9ac039..381fd49b38441dadfe591550f1c8c1742e3f819a 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -189,3 +189,53 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) {
EXPECT_EQ(host->process(),
browser()->GetTabContentsAt(2)->render_view_host()->process());
}
+
+// Ensure that reloading a URL after installing or uninstalling it as an app
+// correctly swaps the process. (http://crbug.com/80621)
+IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadIntoAppProcess) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kDisablePopupBlocking);
+
+ 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::Replacements replace_host;
+ std::string host_str("localhost"); // must stay in scope with replace_host
+ replace_host.SetHostStr(host_str);
+ GURL base_url = test_server()->GetURL(
+ "files/extensions/api_test/app_process/");
+ base_url = base_url.ReplaceComponents(replace_host);
+
+ // Load an app URL before loading the app.
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ TabContents* contents = browser()->GetTabContentsAt(0);
+ EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
+
+ // Load app and reload page.
+ const Extension* app =
+ LoadExtension(test_data_dir_.AppendASCII("app_process"));
+ ASSERT_TRUE(app);
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process());
+
+ // Disable app and reload page.
+ DisableExtension(app->id());
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
+
+ // Enable app and reload via JavaScript.
+ EnableExtension(app->id());
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(),
+ L"", L"location.reload();"));
+ ui_test_utils::WaitForNavigation(&contents->controller());
+ EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process());
+
+ // Disable app and reload via JavaScript.
+ DisableExtension(app->id());
+ ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(contents->render_view_host(),
+ L"", L"location.reload();"));
+ ui_test_utils::WaitForNavigation(&contents->controller());
+ EXPECT_FALSE(contents->render_view_host()->process()->is_extension_process());
+}
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698