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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 EXPECT_EQ(0, change_count()); | 70 EXPECT_EQ(0, change_count()); |
71 return avatar_menu_.get(); | 71 return avatar_menu_.get(); |
72 } | 72 } |
73 | 73 |
74 TestingProfileManager* manager() { return &manager_; } | 74 TestingProfileManager* manager() { return &manager_; } |
75 | 75 |
76 void AddOmittedProfile(std::string name) { | 76 void AddOmittedProfile(std::string name) { |
77 ProfileInfoCache* cache = manager()->profile_info_cache(); | 77 ProfileInfoCache* cache = manager()->profile_info_cache(); |
78 cache->AddProfileToCache( | 78 cache->AddProfileToCache( |
79 cache->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), | 79 cache->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), |
80 base::string16(), 0, "TEST_ID"); | 80 std::string(), base::string16(), 0, "TEST_ID"); |
81 } | 81 } |
82 | 82 |
83 int change_count() const { return mock_observer_->change_count(); } | 83 int change_count() const { return mock_observer_->change_count(); } |
84 | 84 |
85 private: | 85 private: |
86 TestingProfileManager manager_; | 86 TestingProfileManager manager_; |
87 scoped_ptr<MockObserver> mock_observer_; | 87 scoped_ptr<MockObserver> mock_observer_; |
88 scoped_ptr<AvatarMenu> avatar_menu_; | 88 scoped_ptr<AvatarMenu> avatar_menu_; |
89 content::TestBrowserThreadBundle thread_bundle_; | 89 content::TestBrowserThreadBundle thread_bundle_; |
90 | 90 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 TEST_F(ProfileListDesktopTest, SyncState) { | 331 TEST_F(ProfileListDesktopTest, SyncState) { |
332 // If multiprofile mode is not enabled then the menu is never shown. | 332 // If multiprofile mode is not enabled then the menu is never shown. |
333 if (!profiles::IsMultipleProfilesEnabled()) | 333 if (!profiles::IsMultipleProfilesEnabled()) |
334 return; | 334 return; |
335 | 335 |
336 manager()->CreateTestingProfile("Test 1"); | 336 manager()->CreateTestingProfile("Test 1"); |
337 | 337 |
338 // Add a managed user profile. | 338 // Add a managed user profile. |
339 ProfileInfoCache* cache = manager()->profile_info_cache(); | 339 ProfileInfoCache* cache = manager()->profile_info_cache(); |
340 base::FilePath path = cache->GetUserDataDir().AppendASCII("p2"); | 340 base::FilePath path = cache->GetUserDataDir().AppendASCII("p2"); |
341 cache->AddProfileToCache(path, ASCIIToUTF16("Test 2"), base::string16(), 0, | 341 cache->AddProfileToCache(path, ASCIIToUTF16("Test 2"), std::string(), |
342 "TEST_ID"); | 342 base::string16(), 0, "TEST_ID"); |
343 cache->SetIsOmittedProfileAtIndex(cache->GetIndexOfProfileWithPath(path), | 343 cache->SetIsOmittedProfileAtIndex(cache->GetIndexOfProfileWithPath(path), |
344 false); | 344 false); |
345 | 345 |
346 AvatarMenu* model = GetAvatarMenu(); | 346 AvatarMenu* model = GetAvatarMenu(); |
347 model->RebuildMenu(); | 347 model->RebuildMenu(); |
348 EXPECT_EQ(2U, model->GetNumberOfItems()); | 348 EXPECT_EQ(2U, model->GetNumberOfItems()); |
349 | 349 |
350 // Now check that the sync_state of a supervised user shows the supervised | 350 // Now check that the username of a supervised user shows the supervised |
351 // user avatar label instead. | 351 // user avatar label instead. |
352 base::string16 supervised_user_label = | 352 base::string16 supervised_user_label = |
353 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); | 353 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); |
354 const AvatarMenu::Item& item1 = model->GetItemAt(0); | 354 const AvatarMenu::Item& item1 = model->GetItemAt(0); |
355 EXPECT_NE(item1.sync_state, supervised_user_label); | 355 EXPECT_NE(item1.username, supervised_user_label); |
356 | 356 |
357 const AvatarMenu::Item& item2 = model->GetItemAt(1); | 357 const AvatarMenu::Item& item2 = model->GetItemAt(1); |
358 EXPECT_EQ(item2.sync_state, supervised_user_label); | 358 EXPECT_EQ(item2.username, supervised_user_label); |
359 } | 359 } |
360 | 360 |
361 } // namespace | 361 } // namespace |
OLD | NEW |