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/login/users/scoped_user_manager_enabler.h" |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "chrome/browser/prefs/pref_service_syncable.h" | 15 #include "chrome/browser/prefs/pref_service_syncable.h" |
15 #include "chrome/browser/profiles/avatar_menu.h" | 16 #include "chrome/browser/profiles/avatar_menu.h" |
16 #include "chrome/browser/profiles/avatar_menu_observer.h" | 17 #include "chrome/browser/profiles/avatar_menu_observer.h" |
17 #include "chrome/browser/profiles/profile_info_cache.h" | 18 #include "chrome/browser/profiles/profile_info_cache.h" |
18 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 19 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
19 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
22 #include "chrome/test/base/testing_profile_manager.h" | 23 #include "chrome/test/base/testing_profile_manager.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 63 |
63 // AvatarMenu and multiple profiles works after user logged in. | 64 // AvatarMenu and multiple profiles works after user logged in. |
64 manager_.SetLoggedIn(true); | 65 manager_.SetLoggedIn(true); |
65 | 66 |
66 // Initialize the UserManager singleton to a fresh FakeUserManager instance. | 67 // Initialize the UserManager singleton to a fresh FakeUserManager instance. |
67 user_manager_enabler_.reset( | 68 user_manager_enabler_.reset( |
68 new ScopedUserManagerEnabler(new FakeUserManager)); | 69 new ScopedUserManagerEnabler(new FakeUserManager)); |
69 } | 70 } |
70 | 71 |
71 FakeUserManager* GetFakeUserManager() { | 72 FakeUserManager* GetFakeUserManager() { |
72 return static_cast<FakeUserManager*>(UserManager::Get()); | 73 return static_cast<FakeUserManager*>(user_manager::UserManager::Get()); |
73 } | 74 } |
74 | 75 |
75 void AddProfile(base::string16 name, bool log_in) { | 76 void AddProfile(base::string16 name, bool log_in) { |
76 std::string email_string = base::UTF16ToASCII(name) + "@example.com"; | 77 std::string email_string = base::UTF16ToASCII(name) + "@example.com"; |
77 | 78 |
78 // Add a user to the fake user manager. | 79 // Add a user to the fake user manager. |
79 GetFakeUserManager()->AddUser(email_string); | 80 GetFakeUserManager()->AddUser(email_string); |
80 if (log_in) { | 81 if (log_in) { |
81 GetFakeUserManager()->UserLoggedIn( | 82 GetFakeUserManager()->UserLoggedIn( |
82 email_string, | 83 email_string, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 // Should only show avatar menu with multiple users. | 312 // Should only show avatar menu with multiple users. |
312 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 313 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
313 | 314 |
314 AddProfile(name2, false); | 315 AddProfile(name2, false); |
315 | 316 |
316 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 317 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
317 } | 318 } |
318 | 319 |
319 } // namespace chromeos | 320 } // namespace chromeos |
OLD | NEW |