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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/profiles/profile_avatar_downloader.h" | 21 #include "chrome/browser/profiles/profile_avatar_downloader.h" |
22 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 22 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/test/base/testing_browser_process.h" | 28 #include "chrome/test/base/testing_browser_process.h" |
29 #include "components/prefs/testing_pref_service.h" | 29 #include "components/prefs/testing_pref_service.h" |
30 #include "components/signin/core/common/profile_management_switches.h" | 30 #include "components/signin/core/common/profile_management_switches.h" |
31 #include "components/syncable_prefs/pref_service_syncable.h" | 31 #include "components/sync_preferences/pref_service_syncable.h" |
32 #include "content/public/test/test_browser_thread_bundle.h" | 32 #include "content/public/test/test_browser_thread_bundle.h" |
33 #include "content/public/test/test_utils.h" | 33 #include "content/public/test/test_utils.h" |
34 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
35 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
36 #include "ui/gfx/image/image.h" | 36 #include "ui/gfx/image/image.h" |
37 #include "ui/gfx/image/image_unittest_util.h" | 37 #include "ui/gfx/image/image_unittest_util.h" |
38 | 38 |
39 using base::ASCIIToUTF16; | 39 using base::ASCIIToUTF16; |
40 using base::UTF8ToUTF16; | 40 using base::UTF8ToUTF16; |
41 using content::BrowserThread; | 41 using content::BrowserThread; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // Verify that the profile name and picture are not empty. | 485 // Verify that the profile name and picture are not empty. |
486 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); | 486 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); |
487 EXPECT_TRUE(gfx::test::AreImagesEqual( | 487 EXPECT_TRUE(gfx::test::AreImagesEqual( |
488 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); | 488 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); |
489 } | 489 } |
490 | 490 |
491 TEST_F(ProfileInfoCacheTest, CreateSupervisedTestingProfile) { | 491 TEST_F(ProfileInfoCacheTest, CreateSupervisedTestingProfile) { |
492 testing_profile_manager_.CreateTestingProfile("default"); | 492 testing_profile_manager_.CreateTestingProfile("default"); |
493 base::string16 supervised_user_name = ASCIIToUTF16("Supervised User"); | 493 base::string16 supervised_user_name = ASCIIToUTF16("Supervised User"); |
494 testing_profile_manager_.CreateTestingProfile( | 494 testing_profile_manager_.CreateTestingProfile( |
495 "test1", std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), | 495 "test1", std::unique_ptr<sync_preferences::PrefServiceSyncable>(), |
496 supervised_user_name, 0, "TEST_ID", TestingProfile::TestingFactories()); | 496 supervised_user_name, 0, "TEST_ID", TestingProfile::TestingFactories()); |
497 for (size_t i = 0; i < GetCache()->GetNumberOfProfiles(); i++) { | 497 for (size_t i = 0; i < GetCache()->GetNumberOfProfiles(); i++) { |
498 bool is_supervised = | 498 bool is_supervised = |
499 GetCache()->GetNameOfProfileAtIndex(i) == supervised_user_name; | 499 GetCache()->GetNameOfProfileAtIndex(i) == supervised_user_name; |
500 EXPECT_EQ(is_supervised, GetCache()->ProfileIsSupervisedAtIndex(i)); | 500 EXPECT_EQ(is_supervised, GetCache()->ProfileIsSupervisedAtIndex(i)); |
501 std::string supervised_user_id = is_supervised ? "TEST_ID" : ""; | 501 std::string supervised_user_id = is_supervised ? "TEST_ID" : ""; |
502 EXPECT_EQ(supervised_user_id, | 502 EXPECT_EQ(supervised_user_id, |
503 GetCache()->GetSupervisedUserIdOfProfileAtIndex(i)); | 503 GetCache()->GetSupervisedUserIdOfProfileAtIndex(i)); |
504 } | 504 } |
505 | 505 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( | 803 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( |
804 GetCache()->GetIndexOfProfileWithPath(path_1))); | 804 GetCache()->GetIndexOfProfileWithPath(path_1))); |
805 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( | 805 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( |
806 GetCache()->GetIndexOfProfileWithPath(path_2))); | 806 GetCache()->GetIndexOfProfileWithPath(path_2))); |
807 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( | 807 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( |
808 GetCache()->GetIndexOfProfileWithPath(path_3))); | 808 GetCache()->GetIndexOfProfileWithPath(path_3))); |
809 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( | 809 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( |
810 GetCache()->GetIndexOfProfileWithPath(path_4))); | 810 GetCache()->GetIndexOfProfileWithPath(path_4))); |
811 } | 811 } |
812 #endif | 812 #endif |
OLD | NEW |