| 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_chrome_user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 15 #include "chrome/browser/prefs/pref_service_syncable.h" | 15 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 16 #include "chrome/browser/profiles/avatar_menu.h" | 16 #include "chrome/browser/profiles/avatar_menu.h" |
| 17 #include "chrome/browser/profiles/avatar_menu_observer.h" | 17 #include "chrome/browser/profiles/avatar_menu_observer.h" |
| 18 #include "chrome/browser/profiles/profile_info_cache.h" | 18 #include "chrome/browser/profiles/profile_info_cache.h" |
| 19 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" | 19 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
| 23 #include "chrome/test/base/testing_profile_manager.h" | 23 #include "chrome/test/base/testing_profile_manager.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 26 |
| 26 using base::ASCIIToUTF16; | 27 using base::ASCIIToUTF16; |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 class MockObserver : public AvatarMenuObserver { | 31 class MockObserver : public AvatarMenuObserver { |
| 31 public: | 32 public: |
| 32 MockObserver() : count_(0) {} | 33 MockObserver() : count_(0) {} |
| 33 ~MockObserver() override {} | 34 ~MockObserver() override {} |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void ActiveUserChanged(const base::string16& name) { | 100 void ActiveUserChanged(const base::string16& name) { |
| 100 std::string email_string = base::UTF16ToASCII(name) + "@example.com"; | 101 std::string email_string = base::UTF16ToASCII(name) + "@example.com"; |
| 101 GetFakeChromeUserManager()->SwitchActiveUser(email_string); | 102 GetFakeChromeUserManager()->SwitchActiveUser(email_string); |
| 102 } | 103 } |
| 103 | 104 |
| 104 TestingProfileManager* manager() { return &manager_; } | 105 TestingProfileManager* manager() { return &manager_; } |
| 105 | 106 |
| 106 int change_count() const { return mock_observer_->change_count(); } | 107 int change_count() const { return mock_observer_->change_count(); } |
| 107 | 108 |
| 108 private: | 109 private: |
| 110 content::TestBrowserThreadBundle thread_bundle_; |
| 109 TestingProfileManager manager_; | 111 TestingProfileManager manager_; |
| 110 scoped_ptr<MockObserver> mock_observer_; | 112 scoped_ptr<MockObserver> mock_observer_; |
| 111 scoped_ptr<ScopedUserManagerEnabler> user_manager_enabler_; | 113 scoped_ptr<ScopedUserManagerEnabler> user_manager_enabler_; |
| 112 scoped_ptr<AvatarMenu> avatar_menu_; | 114 scoped_ptr<AvatarMenu> avatar_menu_; |
| 113 ChromeShellDelegate chrome_shell_delegate_; | 115 ChromeShellDelegate chrome_shell_delegate_; |
| 114 | 116 |
| 115 DISALLOW_COPY_AND_ASSIGN(ProfileListChromeOSTest); | 117 DISALLOW_COPY_AND_ASSIGN(ProfileListChromeOSTest); |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 TEST_F(ProfileListChromeOSTest, InitialCreation) { | 120 TEST_F(ProfileListChromeOSTest, InitialCreation) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 298 |
| 297 // Should only show avatar menu with multiple users. | 299 // Should only show avatar menu with multiple users. |
| 298 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 300 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 299 | 301 |
| 300 AddProfile(name2, false); | 302 AddProfile(name2, false); |
| 301 | 303 |
| 302 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 304 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 303 } | 305 } |
| 304 | 306 |
| 305 } // namespace chromeos | 307 } // namespace chromeos |
| OLD | NEW |