| 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/background/background_mode_manager.h" | 8 #include "chrome/browser/background/background_mode_manager.h" |
| 9 #include "chrome/browser/lifetime/application_lifetime.h" | 9 #include "chrome/browser/lifetime/application_lifetime.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| 11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/test/base/testing_browser_process.h" | 12 #include "chrome/test/base/testing_browser_process.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "chrome/test/base/testing_profile_manager.h" | 14 #include "chrome/test/base/testing_profile_manager.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 17 #include "ui/gfx/image/image_unittest_util.h" | 17 #include "ui/gfx/image/image_unittest_util.h" |
| 18 | 18 |
| 19 class BackgroundModeManagerTest : public testing::Test { | 19 class BackgroundModeManagerTest : public testing::Test { |
| 20 public: | 20 public: |
| 21 BackgroundModeManagerTest() | 21 BackgroundModeManagerTest() |
| 22 : profile_manager_(TestingBrowserProcess::GetGlobal()) {} | 22 : profile_manager_(TestingBrowserProcess::GetGlobal()) {} |
| 23 ~BackgroundModeManagerTest() {} | 23 virtual ~BackgroundModeManagerTest() {} |
| 24 void SetUp() { | 24 virtual void SetUp() { |
| 25 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 25 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 26 ASSERT_TRUE(profile_manager_.SetUp()); | 26 ASSERT_TRUE(profile_manager_.SetUp()); |
| 27 } | 27 } |
| 28 scoped_ptr<CommandLine> command_line_; | 28 scoped_ptr<CommandLine> command_line_; |
| 29 TestingProfileManager profile_manager_; | 29 TestingProfileManager profile_manager_; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 class TestBackgroundModeManager : public BackgroundModeManager { | 32 class TestBackgroundModeManager : public BackgroundModeManager { |
| 33 public: | 33 public: |
| 34 TestBackgroundModeManager( | 34 TestBackgroundModeManager( |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 TEST_F(BackgroundModeManagerTest, | 304 TEST_F(BackgroundModeManagerTest, |
| 305 BackgroundModeDisabledPreventsKeepAliveOnStartup) { | 305 BackgroundModeDisabledPreventsKeepAliveOnStartup) { |
| 306 TestingProfile* profile1 = profile_manager_.CreateTestingProfile("p1"); | 306 TestingProfile* profile1 = profile_manager_.CreateTestingProfile("p1"); |
| 307 command_line_->AppendSwitch(switches::kKeepAliveForTest); | 307 command_line_->AppendSwitch(switches::kKeepAliveForTest); |
| 308 TestBackgroundModeManager manager( | 308 TestBackgroundModeManager manager( |
| 309 command_line_.get(), profile_manager_.profile_info_cache(), false); | 309 command_line_.get(), profile_manager_.profile_info_cache(), false); |
| 310 manager.RegisterProfile(profile1); | 310 manager.RegisterProfile(profile1); |
| 311 EXPECT_FALSE(manager.ShouldBeInBackgroundMode()); | 311 EXPECT_FALSE(manager.ShouldBeInBackgroundMode()); |
| 312 } | 312 } |
| OLD | NEW |