OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "chrome/browser/background/background_mode_manager.h" | 7 #include "chrome/browser/background/background_mode_manager.h" |
8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
11 #include "chrome/test/base/testing_browser_process_test.h" | |
12 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 | 13 |
15 class BackgroundModeManagerTest : public TestingBrowserProcessTest { | 14 class BackgroundModeManagerTest : public testing::Test { |
16 public: | 15 public: |
17 BackgroundModeManagerTest() {} | 16 BackgroundModeManagerTest() {} |
18 ~BackgroundModeManagerTest() {} | 17 ~BackgroundModeManagerTest() {} |
19 void SetUp() { | 18 void SetUp() { |
20 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 19 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
21 } | 20 } |
22 scoped_ptr<CommandLine> command_line_; | 21 scoped_ptr<CommandLine> command_line_; |
23 }; | 22 }; |
24 | 23 |
25 class TestBackgroundModeManager : public BackgroundModeManager { | 24 class TestBackgroundModeManager : public BackgroundModeManager { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 174 |
176 manager.SetBackgroundAppCount(1); | 175 manager.SetBackgroundAppCount(1); |
177 manager.OnApplicationListChanged(&profile2); | 176 manager.OnApplicationListChanged(&profile2); |
178 // There is still one background app alive | 177 // There is still one background app alive |
179 AssertBackgroundModeActive(manager); | 178 AssertBackgroundModeActive(manager); |
180 | 179 |
181 manager.SetBackgroundAppCount(0); | 180 manager.SetBackgroundAppCount(0); |
182 manager.OnApplicationListChanged(&profile1); | 181 manager.OnApplicationListChanged(&profile1); |
183 AssertBackgroundModeInactive(manager); | 182 AssertBackgroundModeInactive(manager); |
184 } | 183 } |
OLD | NEW |