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" | |
14 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
15 #include "chrome/test/base/testing_profile_manager.h" | 14 #include "chrome/test/base/testing_profile_manager.h" |
16 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/message_center/notifier_settings.h" | 17 #include "ui/message_center/notifier_settings.h" |
19 | 18 |
20 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
21 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
22 #endif | 21 #endif |
23 | 22 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 63 |
65 class MessageCenterSettingsControllerChromeOSTest | 64 class MessageCenterSettingsControllerChromeOSTest |
66 : public MessageCenterSettingsControllerTest { | 65 : public MessageCenterSettingsControllerTest { |
67 protected: | 66 protected: |
68 MessageCenterSettingsControllerChromeOSTest() {} | 67 MessageCenterSettingsControllerChromeOSTest() {} |
69 virtual ~MessageCenterSettingsControllerChromeOSTest() {} | 68 virtual ~MessageCenterSettingsControllerChromeOSTest() {} |
70 | 69 |
71 virtual void SetUp() OVERRIDE { | 70 virtual void SetUp() OVERRIDE { |
72 MessageCenterSettingsControllerTest::SetUp(); | 71 MessageCenterSettingsControllerTest::SetUp(); |
73 | 72 |
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. | 73 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
78 user_manager_enabler_.reset( | 74 user_manager_enabler_.reset( |
79 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); | 75 new chromeos::ScopedUserManagerEnabler(new chromeos::FakeUserManager)); |
80 } | 76 } |
81 | 77 |
82 virtual void TearDown() OVERRIDE { | 78 virtual void TearDown() OVERRIDE { |
83 ResetController(); | 79 ResetController(); |
84 MessageCenterSettingsControllerTest::TearDown(); | 80 MessageCenterSettingsControllerTest::TearDown(); |
85 } | 81 } |
86 | 82 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 SwitchActiveUser("Profile-1"); | 154 SwitchActiveUser("Profile-1"); |
159 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); | 155 EXPECT_EQ(controller()->GetNotifierGroupCount(), 1u); |
160 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, | 156 EXPECT_EQ(controller()->GetNotifierGroupAt(0).name, |
161 base::UTF8ToUTF16("Profile-1")); | 157 base::UTF8ToUTF16("Profile-1")); |
162 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); | 158 EXPECT_EQ(controller()->GetNotifierGroupAt(0).index, 0u); |
163 } | 159 } |
164 #endif | 160 #endif |
165 | 161 |
166 // 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 |
167 // in ChromeOS -- no profiles in the profile_info_cache. | 163 // in ChromeOS -- no profiles in the profile_info_cache. |
OLD | NEW |