| 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_info_cache_unittest.h" | 5 #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); | 445 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); |
| 446 EXPECT_TRUE(gfx::test::IsEqual( | 446 EXPECT_TRUE(gfx::test::IsEqual( |
| 447 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); | 447 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); |
| 448 } | 448 } |
| 449 | 449 |
| 450 TEST_F(ProfileInfoCacheTest, CreateManagedTestingProfile) { | 450 TEST_F(ProfileInfoCacheTest, CreateManagedTestingProfile) { |
| 451 testing_profile_manager_.CreateTestingProfile("default"); | 451 testing_profile_manager_.CreateTestingProfile("default"); |
| 452 string16 managed_user_name = ASCIIToUTF16("Supervised User"); | 452 string16 managed_user_name = ASCIIToUTF16("Supervised User"); |
| 453 testing_profile_manager_.CreateTestingProfile( | 453 testing_profile_manager_.CreateTestingProfile( |
| 454 "test1", scoped_ptr<PrefServiceSyncable>(), | 454 "test1", scoped_ptr<PrefServiceSyncable>(), |
| 455 managed_user_name, 0, "TEST_ID"); | 455 managed_user_name, 0, "TEST_ID", TestingProfile::TestingFactories()); |
| 456 for (size_t i = 0; i < GetCache()->GetNumberOfProfiles(); i++) { | 456 for (size_t i = 0; i < GetCache()->GetNumberOfProfiles(); i++) { |
| 457 bool is_managed = | 457 bool is_managed = |
| 458 GetCache()->GetNameOfProfileAtIndex(i) == managed_user_name; | 458 GetCache()->GetNameOfProfileAtIndex(i) == managed_user_name; |
| 459 EXPECT_EQ(is_managed, GetCache()->ProfileIsManagedAtIndex(i)); | 459 EXPECT_EQ(is_managed, GetCache()->ProfileIsManagedAtIndex(i)); |
| 460 std::string managed_user_id = is_managed ? "TEST_ID" : ""; | 460 std::string managed_user_id = is_managed ? "TEST_ID" : ""; |
| 461 EXPECT_EQ(managed_user_id, GetCache()->GetManagedUserIdOfProfileAtIndex(i)); | 461 EXPECT_EQ(managed_user_id, GetCache()->GetManagedUserIdOfProfileAtIndex(i)); |
| 462 } | 462 } |
| 463 | 463 |
| 464 // Managed profiles have a custom theme, which needs to be deleted on the FILE | 464 // Managed profiles have a custom theme, which needs to be deleted on the FILE |
| 465 // thread. Reset the profile manager now so everything is deleted while we | 465 // thread. Reset the profile manager now so everything is deleted while we |
| (...skipping 28 matching lines...) Expand all Loading... |
| 494 | 494 |
| 495 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); | 495 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); |
| 496 | 496 |
| 497 // Check that the profiles can be extracted from the local state. | 497 // Check that the profiles can be extracted from the local state. |
| 498 std::vector<string16> names = ProfileInfoCache::GetProfileNames(); | 498 std::vector<string16> names = ProfileInfoCache::GetProfileNames(); |
| 499 for (size_t i = 0; i < 4; i++) | 499 for (size_t i = 0; i < 4; i++) |
| 500 ASSERT_FALSE(names[i].empty()); | 500 ASSERT_FALSE(names[i].empty()); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace | 503 } // namespace |
| OLD | NEW |