| 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" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 const AvatarMenu::Item& item1 = menu->GetItemAt(0); | 159 const AvatarMenu::Item& item1 = menu->GetItemAt(0); |
| 160 EXPECT_EQ(0U, item1.menu_index); | 160 EXPECT_EQ(0U, item1.menu_index); |
| 161 EXPECT_EQ(name1, item1.name); | 161 EXPECT_EQ(name1, item1.name); |
| 162 | 162 |
| 163 const AvatarMenu::Item& item3 = menu->GetItemAt(1); | 163 const AvatarMenu::Item& item3 = menu->GetItemAt(1); |
| 164 EXPECT_EQ(1U, item3.menu_index); | 164 EXPECT_EQ(1U, item3.menu_index); |
| 165 EXPECT_EQ(name3, item3.name); | 165 EXPECT_EQ(name3, item3.name); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TEST_F(ProfileListChromeOSTest, DontShowManagedUsers) { | 168 TEST_F(ProfileListChromeOSTest, DontShowSupervisedUsers) { |
| 169 base::string16 name1(ASCIIToUTF16("p1")); | 169 base::string16 name1(ASCIIToUTF16("p1")); |
| 170 base::string16 managed_name(ASCIIToUTF16("p2@example.com")); | 170 base::string16 supervised_name(ASCIIToUTF16("p2@example.com")); |
| 171 | 171 |
| 172 AddProfile(name1, true); | 172 AddProfile(name1, true); |
| 173 | 173 |
| 174 // Add a managed user profile. | 174 // Add a managed user profile. |
| 175 ProfileInfoCache* cache = manager()->profile_info_cache(); | 175 ProfileInfoCache* cache = manager()->profile_info_cache(); |
| 176 manager()->profile_info_cache()->AddProfileToCache( | 176 manager()->profile_info_cache()->AddProfileToCache( |
| 177 cache->GetUserDataDir().AppendASCII("p2"), managed_name, | 177 cache->GetUserDataDir().AppendASCII("p2"), supervised_name, |
| 178 base::string16(), 0, "TEST_ID"); | 178 base::string16(), 0, "TEST_ID"); |
| 179 | 179 |
| 180 GetFakeUserManager()->AddUser(base::UTF16ToASCII(managed_name)); | 180 GetFakeUserManager()->AddUser(base::UTF16ToASCII(supervised_name)); |
| 181 | 181 |
| 182 AvatarMenu* menu = GetAvatarMenu(); | 182 AvatarMenu* menu = GetAvatarMenu(); |
| 183 ASSERT_EQ(1U, menu->GetNumberOfItems()); | 183 ASSERT_EQ(1U, menu->GetNumberOfItems()); |
| 184 | 184 |
| 185 const AvatarMenu::Item& item1 = menu->GetItemAt(0); | 185 const AvatarMenu::Item& item1 = menu->GetItemAt(0); |
| 186 EXPECT_EQ(0U, item1.menu_index); | 186 EXPECT_EQ(0U, item1.menu_index); |
| 187 EXPECT_EQ(name1, item1.name); | 187 EXPECT_EQ(name1, item1.name); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST_F(ProfileListChromeOSTest, ShowAddProfileLink) { | 190 TEST_F(ProfileListChromeOSTest, ShowAddProfileLink) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 // Should only show avatar menu with multiple users. | 312 // Should only show avatar menu with multiple users. |
| 313 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 313 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 314 | 314 |
| 315 AddProfile(name2, false); | 315 AddProfile(name2, false); |
| 316 | 316 |
| 317 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 317 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace chromeos | 320 } // namespace chromeos |
| OLD | NEW |