OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/chromeos/login/login_manager_test.h" | 8 #include "chrome/browser/chromeos/login/login_manager_test.h" |
9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
10 #include "chrome/browser/chromeos/login/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/user_adding_screen.h" |
11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
12 #include "chrome/browser/chromeos/settings/cros_settings.h" | 12 #include "chrome/browser/chromeos/settings/cros_settings.h" |
13 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 13 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
19 #include "chromeos/chromeos_switches.h" | |
20 #include "chromeos/settings/cros_settings_names.h" | 19 #include "chromeos/settings/cros_settings_names.h" |
21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
22 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
23 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
24 | 23 |
25 namespace chromeos { | 24 namespace chromeos { |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 const char* kTestUsers[] = { "test-user1@gmail.com", "test-user2@gmail.com" }; | 28 const char* kTestUsers[] = { "test-user1@gmail.com", "test-user2@gmail.com" }; |
(...skipping 22 matching lines...) Expand all Loading... |
52 virtual void CleanUpOnMainThread() OVERRIDE { | 51 virtual void CleanUpOnMainThread() OVERRIDE { |
53 CrosSettings* settings = CrosSettings::Get(); | 52 CrosSettings* settings = CrosSettings::Get(); |
54 settings->RemoveSettingsProvider(&stub_settings_provider_); | 53 settings->RemoveSettingsProvider(&stub_settings_provider_); |
55 settings->AddSettingsProvider(device_settings_provider_); | 54 settings->AddSettingsProvider(device_settings_provider_); |
56 LoginManagerTest::CleanUpOnMainThread(); | 55 LoginManagerTest::CleanUpOnMainThread(); |
57 } | 56 } |
58 | 57 |
59 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 58 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
60 LoginManagerTest::SetUpCommandLine(command_line); | 59 LoginManagerTest::SetUpCommandLine(command_line); |
61 command_line->AppendSwitch(::switches::kMultiProfiles); | 60 command_line->AppendSwitch(::switches::kMultiProfiles); |
62 command_line->AppendSwitch(switches::kForceMultiProfileInTests); | |
63 } | 61 } |
64 | 62 |
65 protected: | 63 protected: |
66 void CheckOptionsUI(const User* user, bool is_primary) { | 64 void CheckOptionsUI(const User* user, bool is_primary) { |
67 Profile* profile = UserManager::Get()->GetProfileByUser(user); | 65 Profile* profile = UserManager::Get()->GetProfileByUser(user); |
68 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 66 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
69 user->email()); | 67 user->email()); |
70 | 68 |
71 ui_test_utils::BrowserAddedObserver observer; | 69 ui_test_utils::BrowserAddedObserver observer; |
72 Browser* browser = CreateBrowser(profile); | 70 Browser* browser = CreateBrowser(profile); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 AddUser(kTestUsers[1]); | 105 AddUser(kTestUsers[1]); |
108 | 106 |
109 UserManager* manager = UserManager::Get(); | 107 UserManager* manager = UserManager::Get(); |
110 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); | 108 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); |
111 | 109 |
112 CheckOptionsUI(manager->FindUser(kTestUsers[0]), true /* is_primary */); | 110 CheckOptionsUI(manager->FindUser(kTestUsers[0]), true /* is_primary */); |
113 CheckOptionsUI(manager->FindUser(kTestUsers[1]), false /* is_primary */); | 111 CheckOptionsUI(manager->FindUser(kTestUsers[1]), false /* is_primary */); |
114 } | 112 } |
115 | 113 |
116 } // namespace chromeos | 114 } // namespace chromeos |
OLD | NEW |