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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "chrome/browser/prefs/pref_service_syncable.h" | 14 #include "chrome/browser/prefs/pref_service_syncable.h" |
15 #include "chrome/browser/profiles/avatar_menu.h" | 15 #include "chrome/browser/profiles/avatar_menu.h" |
16 #include "chrome/browser/profiles/avatar_menu_observer.h" | 16 #include "chrome/browser/profiles/avatar_menu_observer.h" |
17 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
18 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 18 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
Nikita (slow)
2014/05/19 14:27:15
nit: not used
| |
21 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
22 #include "chrome/test/base/testing_profile_manager.h" | 22 #include "chrome/test/base/testing_profile_manager.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 | 25 |
26 using base::ASCIIToUTF16; | 26 using base::ASCIIToUTF16; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // As defined in /chromeos/dbus/cryptohome_client.cc. | 30 // As defined in /chromeos/dbus/cryptohome_client.cc. |
(...skipping 26 matching lines...) Expand all Loading... | |
57 ProfileListChromeOSTest() | 57 ProfileListChromeOSTest() |
58 : manager_(TestingBrowserProcess::GetGlobal()) { | 58 : manager_(TestingBrowserProcess::GetGlobal()) { |
59 } | 59 } |
60 | 60 |
61 virtual void SetUp() { | 61 virtual void SetUp() { |
62 ASSERT_TRUE(manager_.SetUp()); | 62 ASSERT_TRUE(manager_.SetUp()); |
63 | 63 |
64 // AvatarMenu and multiple profiles works after user logged in. | 64 // AvatarMenu and multiple profiles works after user logged in. |
65 manager_.SetLoggedIn(true); | 65 manager_.SetLoggedIn(true); |
66 | 66 |
67 // We only instantiate UserMenuModel if multi-profile mode is enabled. | |
68 CommandLine* cl = CommandLine::ForCurrentProcess(); | |
69 cl->AppendSwitch(switches::kMultiProfiles); | |
70 | |
71 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 67 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
72 user_manager_enabler_.reset( | 68 user_manager_enabler_.reset( |
73 new ScopedUserManagerEnabler(new FakeUserManager)); | 69 new ScopedUserManagerEnabler(new FakeUserManager)); |
74 } | 70 } |
75 | 71 |
76 FakeUserManager* GetFakeUserManager() { | 72 FakeUserManager* GetFakeUserManager() { |
77 return static_cast<FakeUserManager*>(UserManager::Get()); | 73 return static_cast<FakeUserManager*>(UserManager::Get()); |
78 } | 74 } |
79 | 75 |
80 void AddProfile(base::string16 name, bool log_in) { | 76 void AddProfile(base::string16 name, bool log_in) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 | 312 |
317 // Should only show avatar menu with multiple users. | 313 // Should only show avatar menu with multiple users. |
318 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 314 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
319 | 315 |
320 AddProfile(name2, false); | 316 AddProfile(name2, false); |
321 | 317 |
322 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 318 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
323 } | 319 } |
324 | 320 |
325 } // namespace chromeos | 321 } // namespace chromeos |
OLD | NEW |