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

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: Test Created 8 years, 2 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
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 c5bba2cd561803450ace42799bf118dada89c8df..c4eb2b3f5d67d424ace9f6572ac98c541c394117 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,13 +293,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, MultipleWindows) {
// Confirm item is removed.
--item_count;
ASSERT_EQ(item_count, launcher_->model()->item_count());
+ CloseShellWindowsAndWaitForAppToExit();
}
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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());
@@ -306,7 +311,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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());
@@ -332,7 +337,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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
@@ -341,7 +346,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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());
@@ -352,7 +357,7 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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());
@@ -421,13 +426,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, 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());
@@ -440,6 +446,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