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

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..42281facb141f0d028fea9e98285e4715e3258b2 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -38,7 +38,9 @@ class TestBackgroundModeManager : public BackgroundModeManager {
app_count_(0),
profile_app_count_(0),
have_status_tray_(false),
- launch_on_startup_(false) {}
+ launch_on_startup_(false) {
+ ResumeBackgroundMode();
+ }
virtual void EnableLaunchOnStartup(bool launch) OVERRIDE {
launch_on_startup_ = launch;
}
@@ -84,6 +86,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 +106,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, e.g. from sync. This should enable and
+ // resume background mode.
+ manager.OnBackgroundAppInstalled(NULL);
+ manager.SetBackgroundAppCount(1);
+ manager.OnApplicationListChanged(profile);
+ AssertBackgroundModeActive(manager);
}
// App installs while background mode is disabled should do nothing.
« no previous file with comments | « chrome/browser/background/background_mode_manager.cc ('k') | chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698