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