| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/notifications/message_center_settings_controller.h" | 9 #include "chrome/browser/notifications/message_center_settings_controller.h" |
| 10 #include "chrome/browser/prefs/pref_service_syncable.h" | 10 #include "chrome/browser/prefs/pref_service_syncable.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 protected: | 25 protected: |
| 26 MessageCenterSettingsControllerTest() | 26 MessageCenterSettingsControllerTest() |
| 27 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {}; | 27 : testing_profile_manager_(TestingBrowserProcess::GetGlobal()) {}; |
| 28 virtual ~MessageCenterSettingsControllerTest() {}; | 28 virtual ~MessageCenterSettingsControllerTest() {}; |
| 29 | 29 |
| 30 base::FilePath GetProfilePath(const std::string& base_name) { | 30 base::FilePath GetProfilePath(const std::string& base_name) { |
| 31 return testing_profile_manager_.profile_manager()->user_data_dir() | 31 return testing_profile_manager_.profile_manager()->user_data_dir() |
| 32 .AppendASCII(base_name); | 32 .AppendASCII(base_name); |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() override { |
| 36 ASSERT_TRUE(testing_profile_manager_.SetUp()); | 36 ASSERT_TRUE(testing_profile_manager_.SetUp()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void CreateProfile(const std::string& name) { | 39 virtual void CreateProfile(const std::string& name) { |
| 40 testing_profile_manager_.CreateTestingProfile(name); | 40 testing_profile_manager_.CreateTestingProfile(name); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void CreateController() { | 43 void CreateController() { |
| 44 controller_.reset(new MessageCenterSettingsController( | 44 controller_.reset(new MessageCenterSettingsController( |
| 45 testing_profile_manager_.profile_info_cache())); | 45 testing_profile_manager_.profile_info_cache())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
| 63 | 63 |
| 64 class MessageCenterSettingsControllerChromeOSTest | 64 class MessageCenterSettingsControllerChromeOSTest |
| 65 : public MessageCenterSettingsControllerTest { | 65 : public MessageCenterSettingsControllerTest { |
| 66 protected: | 66 protected: |
| 67 MessageCenterSettingsControllerChromeOSTest() {} | 67 MessageCenterSettingsControllerChromeOSTest() {} |
| 68 virtual ~MessageCenterSettingsControllerChromeOSTest() {} | 68 virtual ~MessageCenterSettingsControllerChromeOSTest() {} |
| 69 | 69 |
| 70 virtual void SetUp() OVERRIDE { | 70 virtual void SetUp() override { |
| 71 MessageCenterSettingsControllerTest::SetUp(); | 71 MessageCenterSettingsControllerTest::SetUp(); |
| 72 | 72 |
| 73 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 73 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
| 74 user_manager_enabler_.reset( | 74 user_manager_enabler_.reset( |
| 75 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); | 75 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 virtual void TearDown() OVERRIDE { | 78 virtual void TearDown() override { |
| 79 ResetController(); | 79 ResetController(); |
| 80 MessageCenterSettingsControllerTest::TearDown(); | 80 MessageCenterSettingsControllerTest::TearDown(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void CreateProfile(const std::string& name) OVERRIDE { | 83 virtual void CreateProfile(const std::string& name) override { |
| 84 MessageCenterSettingsControllerTest::CreateProfile(name); | 84 MessageCenterSettingsControllerTest::CreateProfile(name); |
| 85 | 85 |
| 86 GetFakeUserManager()->AddUser(name); | 86 GetFakeUserManager()->AddUser(name); |
| 87 GetFakeUserManager()->LoginUser(name); | 87 GetFakeUserManager()->LoginUser(name); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SwitchActiveUser(const std::string& name) { | 90 void SwitchActiveUser(const std::string& name) { |
| 91 GetFakeUserManager()->SwitchActiveUser(name); | 91 GetFakeUserManager()->SwitchActiveUser(name); |
| 92 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser()); | 92 controller()->ActiveUserChanged(GetFakeUserManager()->GetActiveUser()); |
| 93 } | 93 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 SwitchActiveUser("Profile-1"); | 154 SwitchActiveUser("Profile-1"); |
| 155 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); | 155 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); |
| 156 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, | 156 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, |
| 157 base::UTF8ToUTF16("Profile-1")); | 157 base::UTF8ToUTF16("Profile-1")); |
| 158 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); | 158 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); |
| 159 } | 159 } |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 // TODO(mukai): write a test case to reproduce the actual guest session scenario | 162 // TODO(mukai): write a test case to reproduce the actual guest session scenario |
| 163 // in ChromeOS -- no profiles in the profile_info_cache. | 163 // in ChromeOS -- no profiles in the profile_info_cache. |
| OLD | NEW |