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

Unified Diff: chrome/browser/background/background_mode_manager_unittest.cc

Issue 25603004: Leave apps running on Windows and Linux when quitting Chrome from the wrench menu. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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/background/background_mode_manager_unittest.cc
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index 2f222f1c78345474de3680b6115a39dfbb21e28a..1bdc99a5285e0dfeceb7fde5f23fae1efcde3a6e 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -84,6 +84,13 @@ static void AssertBackgroundModeInactive(
EXPECT_FALSE(manager.IsLaunchOnStartup());
}
+static void AssertBackgroundModeSuspended(
+ const TestBackgroundModeManager& manager) {
+ EXPECT_FALSE(chrome::WillKeepAlive());
+ EXPECT_FALSE(manager.HaveStatusTray());
+ EXPECT_TRUE(manager.IsLaunchOnStartup());
+}
+
TEST_F(BackgroundModeManagerTest, BackgroundAppLoadUnload) {
TestingProfile* profile = profile_manager_.CreateTestingProfile("p1");
TestBackgroundModeManager manager(
@@ -97,10 +104,24 @@ TEST_F(BackgroundModeManagerTest, BackgroundAppLoadUnload) {
manager.OnApplicationListChanged(profile);
AssertBackgroundModeActive(manager);
+ manager.SuspendBackgroundMode();
+ AssertBackgroundModeSuspended(manager);
+ manager.ResumeBackgroundMode();
+
// Mimic app unload.
manager.SetBackgroundAppCount(0);
manager.OnApplicationListChanged(profile);
AssertBackgroundModeInactive(manager);
+
+ manager.SuspendBackgroundMode();
+ AssertBackgroundModeInactive(manager);
+
+ // Mimic app load while suspended.
+ manager.OnBackgroundAppInstalled(NULL);
+ manager.SetBackgroundAppCount(1);
+ manager.OnApplicationListChanged(profile);
+ AssertBackgroundModeSuspended(manager);
+
}
// App installs while background mode is disabled should do nothing.

Powered by Google App Engine
This is Rietveld 408576698