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. |