| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "chrome/browser/background_mode_manager.h" | 7 #include "chrome/browser/background_mode_manager.h" |
| 8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "chrome/test/testing_profile.h" | 12 #include "chrome/test/testing_profile.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using testing::InSequence; | 16 using testing::InSequence; |
| 17 | 17 |
| 18 class BackgroundModeManagerTest : public testing::Test { | 18 class BackgroundModeManagerTest : public testing::Test { |
| 19 public: | 19 public: |
| 20 BackgroundModeManagerTest() {} | 20 BackgroundModeManagerTest() {} |
| 21 ~BackgroundModeManagerTest() {} | 21 ~BackgroundModeManagerTest() {} |
| 22 void SetUp() { | 22 void SetUp() { |
| 23 command_line_.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY)); | 23 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 24 command_line_->AppendSwitch(switches::kEnableBackgroundMode); | 24 command_line_->AppendSwitch(switches::kEnableBackgroundMode); |
| 25 } | 25 } |
| 26 scoped_ptr<CommandLine> command_line_; | 26 scoped_ptr<CommandLine> command_line_; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 class TestBackgroundModeManager : public BackgroundModeManager { | 29 class TestBackgroundModeManager : public BackgroundModeManager { |
| 30 public: | 30 public: |
| 31 TestBackgroundModeManager(Profile* profile, CommandLine* cl) | 31 TestBackgroundModeManager(Profile* profile, CommandLine* cl) |
| 32 : BackgroundModeManager(profile, cl) { | 32 : BackgroundModeManager(profile, cl) { |
| 33 } | 33 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, false); | 108 profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, false); |
| 109 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); | 109 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); |
| 110 EXPECT_CALL(manager, CreateStatusTrayIcon()); | 110 EXPECT_CALL(manager, CreateStatusTrayIcon()); |
| 111 manager.OnBackgroundAppInstalled(); | 111 manager.OnBackgroundAppInstalled(); |
| 112 manager.OnBackgroundAppLoaded(); | 112 manager.OnBackgroundAppLoaded(); |
| 113 EXPECT_FALSE(BrowserList::WillKeepAlive()); | 113 EXPECT_FALSE(BrowserList::WillKeepAlive()); |
| 114 // Enable status on the fly. | 114 // Enable status on the fly. |
| 115 profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, true); | 115 profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, true); |
| 116 EXPECT_TRUE(BrowserList::WillKeepAlive()); | 116 EXPECT_TRUE(BrowserList::WillKeepAlive()); |
| 117 } | 117 } |
| OLD | NEW |