OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_list_desktop.h" | 5 #include "chrome/browser/profiles/profile_list_desktop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 base::FieldTrialList field_trial_list_(NULL); | 275 base::FieldTrialList field_trial_list_(NULL); |
276 base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow"); | 276 base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow"); |
277 | 277 |
278 #if defined(OS_CHROMEOS) | 278 #if defined(OS_CHROMEOS) |
279 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 279 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
280 #else | 280 #else |
281 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); | 281 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); |
282 #endif | 282 #endif |
283 } | 283 } |
284 | 284 |
285 #if defined(OS_CHROMEOS) | |
Mike Lerman
2015/09/28 15:23:01
ChromeOS doesn't have an old avatar menu anyways,
anthonyvd
2015/09/29 20:23:15
True, it can show the icon but never the menu.
| |
285 TEST_F(ProfileListDesktopTest, DontShowOldAvatarMenuForSingleProfile) { | 286 TEST_F(ProfileListDesktopTest, DontShowOldAvatarMenuForSingleProfile) { |
286 switches::DisableNewAvatarMenuForTesting( | |
287 base::CommandLine::ForCurrentProcess()); | |
288 | |
289 manager()->CreateTestingProfile("Test 1"); | 287 manager()->CreateTestingProfile("Test 1"); |
290 | 288 |
291 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 289 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
292 | 290 |
293 // If multiprofile mode is enabled, there are no other cases when we wouldn't | 291 // If multiprofile mode is enabled, there are no other cases when we wouldn't |
294 // show the menu. | 292 // show the menu. |
295 if (profiles::IsMultipleProfilesEnabled()) | 293 if (profiles::IsMultipleProfilesEnabled()) |
296 return; | 294 return; |
297 | 295 |
298 manager()->CreateTestingProfile("Test 2"); | 296 manager()->CreateTestingProfile("Test 2"); |
299 | 297 |
300 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 298 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
301 } | 299 } |
300 #endif | |
302 | 301 |
303 TEST_F(ProfileListDesktopTest, AlwaysShowNewAvatarMenu) { | 302 TEST_F(ProfileListDesktopTest, AlwaysShowNewAvatarMenu) { |
304 // If multiprofile mode is not enabled then the menu is never shown. | 303 // If multiprofile mode is not enabled then the menu is never shown. |
305 if (!profiles::IsMultipleProfilesEnabled()) | 304 if (!profiles::IsMultipleProfilesEnabled()) |
306 return; | 305 return; |
307 | 306 |
308 switches::EnableNewAvatarMenuForTesting( | |
309 base::CommandLine::ForCurrentProcess()); | |
310 | |
311 manager()->CreateTestingProfile("Test 1"); | 307 manager()->CreateTestingProfile("Test 1"); |
312 | 308 |
313 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); | 309 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); |
Mike Lerman
2015/09/28 15:23:01
Given this method implementation just does an OS c
anthonyvd
2015/09/29 20:23:15
Done.
| |
314 } | 310 } |
315 | 311 |
316 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) { | 312 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) { |
317 // If multiprofile mode is not enabled then the menu is never shown. | 313 // If multiprofile mode is not enabled then the menu is never shown. |
318 if (!profiles::IsMultipleProfilesEnabled()) | 314 if (!profiles::IsMultipleProfilesEnabled()) |
319 return; | 315 return; |
320 | 316 |
321 manager()->CreateTestingProfile("Test 1"); | 317 manager()->CreateTestingProfile("Test 1"); |
322 manager()->CreateTestingProfile("Test 2"); | 318 manager()->CreateTestingProfile("Test 2"); |
323 | 319 |
(...skipping 28 matching lines...) Expand all Loading... | |
352 base::string16 supervised_user_label = | 348 base::string16 supervised_user_label = |
353 l10n_util::GetStringUTF16(IDS_LEGACY_SUPERVISED_USER_AVATAR_LABEL); | 349 l10n_util::GetStringUTF16(IDS_LEGACY_SUPERVISED_USER_AVATAR_LABEL); |
354 const AvatarMenu::Item& item1 = model->GetItemAt(0); | 350 const AvatarMenu::Item& item1 = model->GetItemAt(0); |
355 EXPECT_NE(item1.username, supervised_user_label); | 351 EXPECT_NE(item1.username, supervised_user_label); |
356 | 352 |
357 const AvatarMenu::Item& item2 = model->GetItemAt(1); | 353 const AvatarMenu::Item& item2 = model->GetItemAt(1); |
358 EXPECT_EQ(item2.username, supervised_user_label); | 354 EXPECT_EQ(item2.username, supervised_user_label); |
359 } | 355 } |
360 | 356 |
361 } // namespace | 357 } // namespace |
OLD | NEW |