| 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/policy/configuration_policy_pref_store_test.h" | 5 #include "chrome/browser/policy/configuration_policy_pref_store_test.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 10 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| 11 #include "components/policy/core/common/policy_details.h" | 11 #include "components/policy/core/common/policy_details.h" |
| 12 #include "components/policy/core/common/policy_map.h" | 12 #include "components/policy/core/common/policy_map.h" |
| 13 #include "components/policy/core/common/policy_service_impl.h" | 13 #include "components/policy/core/common/policy_service_impl.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 15 |
| 16 using testing::Return; | 16 using testing::Return; |
| 17 using testing::_; | 17 using testing::_; |
| 18 | 18 |
| 19 namespace policy { | 19 namespace policy { |
| 20 | 20 |
| 21 ConfigurationPolicyPrefStoreTest::ConfigurationPolicyPrefStoreTest() | 21 ConfigurationPolicyPrefStoreTest::ConfigurationPolicyPrefStoreTest() |
| 22 : handler_list_(GetChromePolicyDetailsCallback()) { | 22 : handler_list_(GetChromePolicyDetailsCallback()) { |
| 23 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 23 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 24 .WillRepeatedly(Return(false)); | 24 .WillRepeatedly(Return(false)); |
| 25 provider_.Init(); | 25 provider_.Init(); |
| 26 providers_.push_back(&provider_); | 26 providers_.push_back(&provider_); |
| 27 policy_service_.reset(new PolicyServiceImpl( | 27 policy_service_.reset(new PolicyServiceImpl(providers_)); |
| 28 providers_, PolicyServiceImpl::PreprocessCallback())); | |
| 29 store_ = new ConfigurationPolicyPrefStore( | 28 store_ = new ConfigurationPolicyPrefStore( |
| 30 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); | 29 policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY); |
| 31 } | 30 } |
| 32 | 31 |
| 33 ConfigurationPolicyPrefStoreTest::~ConfigurationPolicyPrefStoreTest() {} | 32 ConfigurationPolicyPrefStoreTest::~ConfigurationPolicyPrefStoreTest() {} |
| 34 | 33 |
| 35 void ConfigurationPolicyPrefStoreTest::TearDown() { | 34 void ConfigurationPolicyPrefStoreTest::TearDown() { |
| 36 provider_.Shutdown(); | 35 provider_.Shutdown(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 void ConfigurationPolicyPrefStoreTest::UpdateProviderPolicy( | 38 void ConfigurationPolicyPrefStoreTest::UpdateProviderPolicy( |
| 40 const PolicyMap& policy) { | 39 const PolicyMap& policy) { |
| 41 provider_.UpdateChromePolicy(policy); | 40 provider_.UpdateChromePolicy(policy); |
| 42 base::RunLoop loop; | 41 base::RunLoop loop; |
| 43 loop.RunUntilIdle(); | 42 loop.RunUntilIdle(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 } // namespace policy | 45 } // namespace policy |
| OLD | NEW |