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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void CloudExternalDataPolicyObserverTest::LogInAsDeviceLocalAccount( | 316 void CloudExternalDataPolicyObserverTest::LogInAsDeviceLocalAccount( |
317 const std::string& user_id) { | 317 const std::string& user_id) { |
318 device_local_account_policy_provider_.reset( | 318 device_local_account_policy_provider_.reset( |
319 new DeviceLocalAccountPolicyProvider( | 319 new DeviceLocalAccountPolicyProvider( |
320 user_id, | 320 user_id, |
321 device_local_account_policy_service_.get())); | 321 device_local_account_policy_service_.get())); |
322 | 322 |
323 PolicyServiceImpl::Providers providers; | 323 PolicyServiceImpl::Providers providers; |
324 providers.push_back(device_local_account_policy_provider_.get()); | 324 providers.push_back(device_local_account_policy_provider_.get()); |
325 TestingProfile::Builder builder; | 325 TestingProfile::Builder builder; |
326 builder.SetPolicyService(scoped_ptr<PolicyService>(new PolicyServiceImpl( | 326 builder.SetPolicyService( |
327 providers, | 327 scoped_ptr<PolicyService>(new PolicyServiceImpl(providers))); |
328 PolicyServiceImpl::PreprocessCallback()))); | |
329 | 328 |
330 profile_ = builder.Build(); | 329 profile_ = builder.Build(); |
331 profile_->set_profile_name(user_id); | 330 profile_->set_profile_name(user_id); |
332 | 331 |
333 user_manager_.AddUser(user_id); | 332 user_manager_.AddUser(user_id); |
334 content::NotificationService::current()->Notify( | 333 content::NotificationService::current()->Notify( |
335 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 334 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
336 content::NotificationService::AllSources(), | 335 content::NotificationService::AllSources(), |
337 content::Details<Profile>(profile_.get())); | 336 content::Details<Profile>(profile_.get())); |
338 } | 337 } |
(...skipping 10 matching lines...) Expand all Loading... |
349 external_data_manager_.CreateExternalDataFetcher( | 348 external_data_manager_.CreateExternalDataFetcher( |
350 key::kUserAvatarImage).release()); | 349 key::kUserAvatarImage).release()); |
351 } | 350 } |
352 user_policy_provider_.UpdateChromePolicy(policy_map); | 351 user_policy_provider_.UpdateChromePolicy(policy_map); |
353 } | 352 } |
354 | 353 |
355 void CloudExternalDataPolicyObserverTest::LogInAsRegularUser() { | 354 void CloudExternalDataPolicyObserverTest::LogInAsRegularUser() { |
356 PolicyServiceImpl::Providers providers; | 355 PolicyServiceImpl::Providers providers; |
357 providers.push_back(&user_policy_provider_); | 356 providers.push_back(&user_policy_provider_); |
358 TestingProfile::Builder builder; | 357 TestingProfile::Builder builder; |
359 builder.SetPolicyService(scoped_ptr<PolicyService>(new PolicyServiceImpl( | 358 builder.SetPolicyService( |
360 providers, | 359 scoped_ptr<PolicyService>(new PolicyServiceImpl(providers))); |
361 PolicyServiceImpl::PreprocessCallback()))); | |
362 | 360 |
363 profile_ = builder.Build(); | 361 profile_ = builder.Build(); |
364 profile_->set_profile_name(kRegularUserID); | 362 profile_->set_profile_name(kRegularUserID); |
365 | 363 |
366 user_manager_.AddUser(kRegularUserID); | 364 user_manager_.AddUser(kRegularUserID); |
367 content::NotificationService::current()->Notify( | 365 content::NotificationService::current()->Notify( |
368 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 366 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
369 content::NotificationService::AllSources(), | 367 content::NotificationService::AllSources(), |
370 content::Details<Profile>(profile_.get())); | 368 content::Details<Profile>(profile_.get())); |
371 } | 369 } |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 | 935 |
938 EXPECT_TRUE(set_calls_.empty()); | 936 EXPECT_TRUE(set_calls_.empty()); |
939 EXPECT_TRUE(cleared_calls_.empty()); | 937 EXPECT_TRUE(cleared_calls_.empty()); |
940 ASSERT_EQ(1u, fetched_calls_.size()); | 938 ASSERT_EQ(1u, fetched_calls_.size()); |
941 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); | 939 EXPECT_EQ(kRegularUserID, fetched_calls_.front().first); |
942 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); | 940 EXPECT_EQ(avatar_policy_2_data_, fetched_calls_.front().second); |
943 ClearObservations(); | 941 ClearObservations(); |
944 } | 942 } |
945 | 943 |
946 } // namespace policy | 944 } // namespace policy |
OLD | NEW |