| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/users/avatar/user_image_manager.h" | 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/chromeos/login/startup_utils.h" | 30 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
| 32 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti
l.h" | 32 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_test_uti
l.h" |
| 33 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 33 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 34 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.h" | 34 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.h" |
| 35 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 35 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
| 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 38 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" | 38 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" |
| 39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 40 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 40 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
| 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 42 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" | 42 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" |
| 43 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" |
| 44 #include "chrome/browser/profiles/profile_downloader.h" | 44 #include "chrome/browser/profiles/profile_downloader.h" |
| 45 #include "chrome/browser/signin/account_tracker_service_factory.h" | 45 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 46 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
| 47 #include "chrome/test/base/in_process_browser_test.h" | 47 #include "chrome/test/base/in_process_browser_test.h" |
| 48 #include "chrome/test/base/testing_browser_process.h" | 48 #include "chrome/test/base/testing_browser_process.h" |
| 49 #include "chromeos/chromeos_paths.h" | 49 #include "chromeos/chromeos_paths.h" |
| 50 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const char kTestUser1[] = "test-user@gmail.com"; | 86 const char kTestUser1[] = "test-user@gmail.com"; |
| 87 const char kTestUser2[] = "test-user2@gmail.com"; | 87 const char kTestUser2[] = "test-user2@gmail.com"; |
| 88 | 88 |
| 89 policy::CloudPolicyStore* GetStoreForUser(const user_manager::User* user) { | 89 policy::CloudPolicyStore* GetStoreForUser(const user_manager::User* user) { |
| 90 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 90 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 91 if (!profile) { | 91 if (!profile) { |
| 92 ADD_FAILURE(); | 92 ADD_FAILURE(); |
| 93 return NULL; | 93 return NULL; |
| 94 } | 94 } |
| 95 policy::UserCloudPolicyManagerChromeOS* policy_manager = | 95 policy::UserCloudPolicyManagerChromeOS* policy_manager = |
| 96 policy::UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); | 96 policy::UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( |
| 97 profile); |
| 97 if (!policy_manager) { | 98 if (!policy_manager) { |
| 98 ADD_FAILURE(); | 99 ADD_FAILURE(); |
| 99 return NULL; | 100 return NULL; |
| 100 } | 101 } |
| 101 return policy_manager->core()->store(); | 102 return policy_manager->core()->store(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 class UserImageChangeWaiter : public user_manager::UserManager::Observer { | 105 class UserImageChangeWaiter : public user_manager::UserManager::Observer { |
| 105 public: | 106 public: |
| 106 UserImageChangeWaiter() {} | 107 UserImageChangeWaiter() {} |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 saved_image = | 873 saved_image = |
| 873 test::ImageLoader(GetUserImagePath(enterprise_account_id_, "jpg")).Load(); | 874 test::ImageLoader(GetUserImagePath(enterprise_account_id_, "jpg")).Load(); |
| 874 ASSERT_TRUE(saved_image); | 875 ASSERT_TRUE(saved_image); |
| 875 | 876 |
| 876 // Check image dimensions. Images can't be compared since JPEG is lossy. | 877 // Check image dimensions. Images can't be compared since JPEG is lossy. |
| 877 EXPECT_EQ(policy_image_->width(), saved_image->width()); | 878 EXPECT_EQ(policy_image_->width(), saved_image->width()); |
| 878 EXPECT_EQ(policy_image_->height(), saved_image->height()); | 879 EXPECT_EQ(policy_image_->height(), saved_image->height()); |
| 879 } | 880 } |
| 880 | 881 |
| 881 } // namespace chromeos | 882 } // namespace chromeos |
| OLD | NEW |