| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow"); | 278 base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow"); |
| 279 | 279 |
| 280 #if defined(OS_CHROMEOS) | 280 #if defined(OS_CHROMEOS) |
| 281 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 281 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 282 #else | 282 #else |
| 283 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); | 283 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); |
| 284 #endif | 284 #endif |
| 285 } | 285 } |
| 286 | 286 |
| 287 TEST_F(ProfileListDesktopTest, DontShowOldAvatarMenuForSingleProfile) { | 287 TEST_F(ProfileListDesktopTest, DontShowOldAvatarMenuForSingleProfile) { |
| 288 switches::DisableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 288 switches::DisableNewAvatarMenuForTesting( |
| 289 base::CommandLine::ForCurrentProcess()); |
| 289 | 290 |
| 290 manager()->CreateTestingProfile("Test 1"); | 291 manager()->CreateTestingProfile("Test 1"); |
| 291 | 292 |
| 292 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 293 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 293 | 294 |
| 294 // If multiprofile mode is enabled, there are no other cases when we wouldn't | 295 // If multiprofile mode is enabled, there are no other cases when we wouldn't |
| 295 // show the menu. | 296 // show the menu. |
| 296 if (profiles::IsMultipleProfilesEnabled()) | 297 if (profiles::IsMultipleProfilesEnabled()) |
| 297 return; | 298 return; |
| 298 | 299 |
| 299 manager()->CreateTestingProfile("Test 2"); | 300 manager()->CreateTestingProfile("Test 2"); |
| 300 | 301 |
| 301 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); | 302 EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu()); |
| 302 } | 303 } |
| 303 | 304 |
| 304 TEST_F(ProfileListDesktopTest, AlwaysShowNewAvatarMenu) { | 305 TEST_F(ProfileListDesktopTest, AlwaysShowNewAvatarMenu) { |
| 305 // If multiprofile mode is not enabled then the menu is never shown. | 306 // If multiprofile mode is not enabled then the menu is never shown. |
| 306 if (!profiles::IsMultipleProfilesEnabled()) | 307 if (!profiles::IsMultipleProfilesEnabled()) |
| 307 return; | 308 return; |
| 308 | 309 |
| 309 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 310 switches::EnableNewAvatarMenuForTesting( |
| 311 base::CommandLine::ForCurrentProcess()); |
| 310 | 312 |
| 311 manager()->CreateTestingProfile("Test 1"); | 313 manager()->CreateTestingProfile("Test 1"); |
| 312 | 314 |
| 313 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); | 315 EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu()); |
| 314 } | 316 } |
| 315 | 317 |
| 316 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) { | 318 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) { |
| 317 // If multiprofile mode is not enabled then the menu is never shown. | 319 // If multiprofile mode is not enabled then the menu is never shown. |
| 318 if (!profiles::IsMultipleProfilesEnabled()) | 320 if (!profiles::IsMultipleProfilesEnabled()) |
| 319 return; | 321 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 base::string16 supervised_user_label = | 354 base::string16 supervised_user_label = |
| 353 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); | 355 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); |
| 354 const AvatarMenu::Item& item1 = model->GetItemAt(0); | 356 const AvatarMenu::Item& item1 = model->GetItemAt(0); |
| 355 EXPECT_NE(item1.sync_state, supervised_user_label); | 357 EXPECT_NE(item1.sync_state, supervised_user_label); |
| 356 | 358 |
| 357 const AvatarMenu::Item& item2 = model->GetItemAt(1); | 359 const AvatarMenu::Item& item2 = model->GetItemAt(1); |
| 358 EXPECT_EQ(item2.sync_state, supervised_user_label); | 360 EXPECT_EQ(item2.sync_state, supervised_user_label); |
| 359 } | 361 } |
| 360 | 362 |
| 361 } // namespace | 363 } // namespace |
| OLD | NEW |