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 "components/policy/core/common/mock_configuration_policy_provider.h" | 5 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
12 #include "components/policy/core/common/policy_bundle.h" | 13 #include "components/policy/core/common/policy_bundle.h" |
13 | 14 |
14 using testing::Invoke; | 15 using testing::Invoke; |
15 | 16 |
16 namespace policy { | 17 namespace policy { |
17 | 18 |
18 MockConfigurationPolicyProvider::MockConfigurationPolicyProvider() {} | 19 MockConfigurationPolicyProvider::MockConfigurationPolicyProvider() {} |
19 | 20 |
20 MockConfigurationPolicyProvider::~MockConfigurationPolicyProvider() {} | 21 MockConfigurationPolicyProvider::~MockConfigurationPolicyProvider() {} |
21 | 22 |
22 void MockConfigurationPolicyProvider::UpdateChromePolicy( | 23 void MockConfigurationPolicyProvider::UpdateChromePolicy( |
23 const PolicyMap& policy) { | 24 const PolicyMap& policy) { |
24 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 25 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
25 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 26 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
26 .CopyFrom(policy); | 27 .CopyFrom(policy); |
27 UpdatePolicy(bundle.Pass()); | 28 UpdatePolicy(std::move(bundle)); |
28 if (base::MessageLoop::current()) | 29 if (base::MessageLoop::current()) |
29 base::RunLoop().RunUntilIdle(); | 30 base::RunLoop().RunUntilIdle(); |
30 } | 31 } |
31 | 32 |
32 void MockConfigurationPolicyProvider::SetAutoRefresh() { | 33 void MockConfigurationPolicyProvider::SetAutoRefresh() { |
33 EXPECT_CALL(*this, RefreshPolicies()).WillRepeatedly( | 34 EXPECT_CALL(*this, RefreshPolicies()).WillRepeatedly( |
34 Invoke(this, &MockConfigurationPolicyProvider::RefreshWithSamePolicies)); | 35 Invoke(this, &MockConfigurationPolicyProvider::RefreshWithSamePolicies)); |
35 } | 36 } |
36 | 37 |
37 void MockConfigurationPolicyProvider::RefreshWithSamePolicies() { | 38 void MockConfigurationPolicyProvider::RefreshWithSamePolicies() { |
38 scoped_ptr<PolicyBundle> bundle(new PolicyBundle); | 39 scoped_ptr<PolicyBundle> bundle(new PolicyBundle); |
39 bundle->CopyFrom(policies()); | 40 bundle->CopyFrom(policies()); |
40 UpdatePolicy(bundle.Pass()); | 41 UpdatePolicy(std::move(bundle)); |
41 } | 42 } |
42 | 43 |
43 MockConfigurationPolicyObserver::MockConfigurationPolicyObserver() {} | 44 MockConfigurationPolicyObserver::MockConfigurationPolicyObserver() {} |
44 | 45 |
45 MockConfigurationPolicyObserver::~MockConfigurationPolicyObserver() {} | 46 MockConfigurationPolicyObserver::~MockConfigurationPolicyObserver() {} |
46 | 47 |
47 } // namespace policy | 48 } // namespace policy |
OLD | NEW |