Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/profiles/profile_info_cache.h" | 11 #include "chrome/browser/profiles/profile_info_cache.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
|
Nikita (slow)
2014/05/19 14:27:15
nit: not used
| |
| 14 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
| 15 #include "chrome/test/base/testing_profile_manager.h" | 15 #include "chrome/test/base/testing_profile_manager.h" |
| 16 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "ui/message_center/notifier_settings.h" | 18 #include "ui/message_center/notifier_settings.h" |
| 19 | 19 |
| 20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 21 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 21 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 | 64 |
| 65 class MessageCenterSettingsControllerChromeOSTest | 65 class MessageCenterSettingsControllerChromeOSTest |
| 66 : public MessageCenterSettingsControllerTest { | 66 : public MessageCenterSettingsControllerTest { |
| 67 protected: | 67 protected: |
| 68 MessageCenterSettingsControllerChromeOSTest() {} | 68 MessageCenterSettingsControllerChromeOSTest() {} |
| 69 virtual ~MessageCenterSettingsControllerChromeOSTest() {} | 69 virtual ~MessageCenterSettingsControllerChromeOSTest() {} |
| 70 | 70 |
| 71 virtual void SetUp() OVERRIDE { | 71 virtual void SetUp() OVERRIDE { |
| 72 MessageCenterSettingsControllerTest::SetUp(); | 72 MessageCenterSettingsControllerTest::SetUp(); |
| 73 | 73 |
| 74 // Enabling multi profile requires several flags to be set. | |
| 75 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kMultiProfiles); | |
| 76 | |
| 77 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 74 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
| 78 user_manager_enabler_.reset( | 75 user_manager_enabler_.reset( |
| 79 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); | 76 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); |
| 80 } | 77 } |
| 81 | 78 |
| 82 virtual void TearDown() OVERRIDE { | 79 virtual void TearDown() OVERRIDE { |
| 83 ResetController(); | 80 ResetController(); |
| 84 MessageCenterSettingsControllerTest::TearDown(); | 81 MessageCenterSettingsControllerTest::TearDown(); |
| 85 } | 82 } |
| 86 | 83 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 SwitchActiveUser("Profile-1"); | 155 SwitchActiveUser("Profile-1"); |
| 159 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); | 156 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); |
| 160 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, | 157 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, |
| 161 base::UTF8ToUTF16("Profile-1")); | 158 base::UTF8ToUTF16("Profile-1")); |
| 162 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); | 159 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); |
| 163 } | 160 } |
| 164 #endif | 161 #endif |
| 165 | 162 |
| 166 // TODO(mukai): write a test case to reproduce the actual guest session scenario | 163 // TODO(mukai): write a test case to reproduce the actual guest session scenario |
| 167 // in ChromeOS -- no profiles in the profile_info_cache. | 164 // in ChromeOS -- no profiles in the profile_info_cache. |
| OLD | NEW |