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