| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/policy/cloud_external_data_policy_observer.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 content::NotificationService::current()->Notify( | 345 content::NotificationService::current()->Notify( |
| 346 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 346 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 347 content::NotificationService::AllSources(), | 347 content::NotificationService::AllSources(), |
| 348 content::Details<Profile>(profile_.get())); | 348 content::Details<Profile>(profile_.get())); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void CloudExternalDataPolicyObserverTest::SetRegularUserAvatarPolicy( | 351 void CloudExternalDataPolicyObserverTest::SetRegularUserAvatarPolicy( |
| 352 const std::string& value) { | 352 const std::string& value) { |
| 353 PolicyMap policy_map; | 353 PolicyMap policy_map; |
| 354 if (!value.empty()) { | 354 if (!value.empty()) { |
| 355 policy_map.Set( | 355 policy_map.Set(key::kUserAvatarImage, POLICY_LEVEL_MANDATORY, |
| 356 key::kUserAvatarImage, | 356 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 357 POLICY_LEVEL_MANDATORY, | 357 base::WrapUnique(new base::StringValue(value)), |
| 358 POLICY_SCOPE_USER, | 358 external_data_manager_.CreateExternalDataFetcher( |
| 359 POLICY_SOURCE_CLOUD, | 359 key::kUserAvatarImage)); |
| 360 new base::StringValue(value), | |
| 361 external_data_manager_.CreateExternalDataFetcher( | |
| 362 key::kUserAvatarImage).release()); | |
| 363 } | 360 } |
| 364 user_policy_provider_.UpdateChromePolicy(policy_map); | 361 user_policy_provider_.UpdateChromePolicy(policy_map); |
| 365 } | 362 } |
| 366 | 363 |
| 367 void CloudExternalDataPolicyObserverTest::LogInAsRegularUser() { | 364 void CloudExternalDataPolicyObserverTest::LogInAsRegularUser() { |
| 368 user_manager_->AddUser(AccountId::FromUserEmail(kRegularUserID)); | 365 user_manager_->AddUser(AccountId::FromUserEmail(kRegularUserID)); |
| 369 | 366 |
| 370 PolicyServiceImpl::Providers providers; | 367 PolicyServiceImpl::Providers providers; |
| 371 providers.push_back(&user_policy_provider_); | 368 providers.push_back(&user_policy_provider_); |
| 372 TestingProfile::Builder builder; | 369 TestingProfile::Builder builder; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 949 |
| 953 EXPECT_TRUE(set_calls_.empty()); | 950 EXPECT_TRUE(set_calls_.empty()); |
| 954 EXPECT_TRUE(cleared_calls_.empty()); | 951 EXPECT_TRUE(cleared_calls_.empty()); |
| 955 ASSERT_EQ(1u, fetched_calls_.size()); | 952 ASSERT_EQ(1u, fetched_calls_.size()); |
| 956 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); | 953 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); |
| 957 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); | 954 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); |
| 958 ClearObservations(); | 955 ClearObservations(); |
| 959 } | 956 } |
| 960 | 957 |
| 961 } // namespace policy | 958 } // namespace policy |
| OLD | NEW |