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