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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates for tests Created 8 years, 1 month 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
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index 0c60aa129ed95ce13a5ed45bb739eec8c656b249..20ebc15bc739ec359d55a611ac78ca9298aad9db 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -124,7 +124,7 @@ class LauncherAppBrowserTest : public ExtensionBrowserTest {
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
ash::Launcher* launcher = ash::Launcher::ForPrimaryDisplay();
int item_count = launcher->model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadPlatformApp("launch");
ShellWindow* window = CreateShellWindow(extension);
++item_count;
ASSERT_EQ(item_count, launcher->model()->item_count());
@@ -135,6 +135,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
CloseShellWindow(window);
--item_count;
EXPECT_EQ(item_count, launcher->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
// Test that we can launch a platform app that already has a shortcut.
@@ -142,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
int item_count = launcher_->model()->item_count();
// First get app_id.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadPlatformApp("launch");
const std::string app_id = extension->id();
// Then create a shortcut.
@@ -167,12 +168,13 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPinned) {
item = *launcher_->model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
EXPECT_EQ(ash::STATUS_CLOSED, item.status);
+ CloseShellWindowsAndWaitForAppToExit();
}
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) {
// Run.
int item_count = launcher_->model()->item_count();
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadPlatformApp("launch");
ShellWindow* window = CreateShellWindow(extension);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -206,13 +208,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, PinRunning) {
// Then close it, make sure the item remains.
CloseShellWindow(window);
ASSERT_EQ(item_count, launcher_->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
int item_count = launcher_->model()->item_count();
// First get app_id.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadPlatformApp("launch");
const std::string app_id = extension->id();
// Then create a shortcut.
@@ -253,6 +256,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, UnpinRunning) {
CloseShellWindow(window);
--item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
// Test that we can launch a platform app with more than one window.
@@ -260,7 +264,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
int item_count = launcher_->model()->item_count();
// First run app.
- const Extension* extension = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension = LoadPlatformApp("launch");
ShellWindow* window1 = CreateShellWindow(extension);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -289,6 +293,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
// Confirm item is removed.
--item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
// Times out on ChromeOS: http://crbug.com/159394
@@ -301,7 +306,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_MultipleApps) {
int item_count = launcher_->model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadPlatformApp("launch");
ShellWindow* window1 = CreateShellWindow(extension1);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -312,7 +317,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_MultipleApps) {
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
- const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
+ const Extension* extension2 = LoadPlatformApp("launch_2");
ShellWindow* window2 = CreateShellWindow(extension2);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -338,7 +343,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_MultipleApps) {
CloseShellWindow(window1);
--item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
-
+ CloseShellWindowsAndWaitForAppToExit();
}
// Confirm that app windows can be reactivated by clicking their icons and that
@@ -353,7 +358,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_WindowActivation) {
int item_count = launcher_->model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadPlatformApp("launch");
ShellWindow* window1 = CreateShellWindow(extension1);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -364,7 +369,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_WindowActivation) {
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
- const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
+ const Extension* extension2 = LoadPlatformApp("launch_2");
ShellWindow* window2 = CreateShellWindow(extension2);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -433,13 +438,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MAYBE_WindowActivation) {
CloseShellWindow(window1);
--item_count;
EXPECT_EQ(item_count, launcher_->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
int item_count = launcher_->model()->item_count();
// First run app.
- const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
+ const Extension* extension1 = LoadPlatformApp("launch");
CreateShellWindow(extension1);
++item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
@@ -452,6 +458,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, BrowserActivation) {
ash::wm::ActivateWindow(browser()->window()->GetNativeWindow());
EXPECT_EQ(ash::STATUS_RUNNING,
launcher_->model()->ItemByID(item_id1)->status);
+ CloseShellWindowsAndWaitForAppToExit();
}
// Test that we can launch an app with a shortcut.

Powered by Google App Engine
This is Rietveld 408576698