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/ui/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
11 #include "chrome/browser/chromeos/login/users/user_manager.h" | 11 #include "chrome/browser/chromeos/login/users/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" | |
17 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
19 #include "chromeos/settings/cros_settings_names.h" | 18 #include "chromeos/settings/cros_settings_names.h" |
20 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
22 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
23 | 22 |
24 namespace chromeos { | 23 namespace chromeos { |
25 | 24 |
26 namespace { | 25 namespace { |
(...skipping 21 matching lines...) Expand all Loading... |
48 settings->AddSettingsProvider(&stub_settings_provider_); | 47 settings->AddSettingsProvider(&stub_settings_provider_); |
49 } | 48 } |
50 | 49 |
51 virtual void CleanUpOnMainThread() OVERRIDE { | 50 virtual void CleanUpOnMainThread() OVERRIDE { |
52 CrosSettings* settings = CrosSettings::Get(); | 51 CrosSettings* settings = CrosSettings::Get(); |
53 settings->RemoveSettingsProvider(&stub_settings_provider_); | 52 settings->RemoveSettingsProvider(&stub_settings_provider_); |
54 settings->AddSettingsProvider(device_settings_provider_); | 53 settings->AddSettingsProvider(device_settings_provider_); |
55 LoginManagerTest::CleanUpOnMainThread(); | 54 LoginManagerTest::CleanUpOnMainThread(); |
56 } | 55 } |
57 | 56 |
58 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
59 LoginManagerTest::SetUpCommandLine(command_line); | |
60 command_line->AppendSwitch(::switches::kMultiProfiles); | |
61 } | |
62 | |
63 protected: | 57 protected: |
64 void CheckOptionsUI(const User* user, bool is_primary) { | 58 void CheckOptionsUI(const User* user, bool is_primary) { |
65 Profile* profile = UserManager::Get()->GetProfileByUser(user); | 59 Profile* profile = UserManager::Get()->GetProfileByUser(user); |
66 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 60 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
67 user->email()); | 61 user->email()); |
68 | 62 |
69 ui_test_utils::BrowserAddedObserver observer; | 63 ui_test_utils::BrowserAddedObserver observer; |
70 Browser* browser = CreateBrowser(profile); | 64 Browser* browser = CreateBrowser(profile); |
71 observer.WaitForSingleNewBrowser(); | 65 observer.WaitForSingleNewBrowser(); |
72 | 66 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 AddUser(kTestUsers[1]); | 99 AddUser(kTestUsers[1]); |
106 | 100 |
107 UserManager* manager = UserManager::Get(); | 101 UserManager* manager = UserManager::Get(); |
108 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); | 102 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); |
109 | 103 |
110 CheckOptionsUI(manager->FindUser(kTestUsers[0]), true /* is_primary */); | 104 CheckOptionsUI(manager->FindUser(kTestUsers[0]), true /* is_primary */); |
111 CheckOptionsUI(manager->FindUser(kTestUsers[1]), false /* is_primary */); | 105 CheckOptionsUI(manager->FindUser(kTestUsers[1]), false /* is_primary */); |
112 } | 106 } |
113 | 107 |
114 } // namespace chromeos | 108 } // namespace chromeos |
OLD | NEW |