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/async_policy_provider.h" | 5 #include "components/policy/core/common/async_policy_provider.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 namespace policy { | 23 namespace policy { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Helper to write a policy in |bundle| with less code. | 27 // Helper to write a policy in |bundle| with less code. |
28 void SetPolicy(PolicyBundle* bundle, | 28 void SetPolicy(PolicyBundle* bundle, |
29 const std::string& name, | 29 const std::string& name, |
30 const std::string& value) { | 30 const std::string& value) { |
31 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 31 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
32 .Set(name, | 32 .SetWithSource(name, |
33 POLICY_LEVEL_MANDATORY, | 33 POLICY_LEVEL_MANDATORY, |
34 POLICY_SCOPE_USER, | 34 POLICY_SCOPE_USER, |
35 new base::StringValue(value), | 35 new base::StringValue(value), |
36 NULL); | 36 NULL, |
bartfab (slow)
2015/09/14 14:42:26
Nit: s/NULL/nullptr/
fhorschig
2015/09/16 13:52:04
Done.
| |
37 POLICY_SOURCE_PLATFORM); | |
bartfab (slow)
2015/09/14 14:42:26
Nit: #include "components/policy/core/common/polic
fhorschig
2015/09/16 13:52:04
Done.
| |
37 } | 38 } |
38 | 39 |
39 class MockPolicyLoader : public AsyncPolicyLoader { | 40 class MockPolicyLoader : public AsyncPolicyLoader { |
40 public: | 41 public: |
41 explicit MockPolicyLoader( | 42 explicit MockPolicyLoader( |
42 scoped_refptr<base::SequencedTaskRunner> task_runner); | 43 scoped_refptr<base::SequencedTaskRunner> task_runner); |
43 ~MockPolicyLoader() override; | 44 ~MockPolicyLoader() override; |
44 | 45 |
45 // Load() returns a scoped_ptr<PolicyBundle> but it can't be mocked because | 46 // Load() returns a scoped_ptr<PolicyBundle> but it can't be mocked because |
46 // scoped_ptr is moveable but not copyable. This override forwards the | 47 // scoped_ptr is moveable but not copyable. This override forwards the |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 EXPECT_CALL(observer, OnUpdatePolicy(provider_.get())).Times(0); | 218 EXPECT_CALL(observer, OnUpdatePolicy(provider_.get())).Times(0); |
218 provider_->Shutdown(); | 219 provider_->Shutdown(); |
219 loop_.RunUntilIdle(); | 220 loop_.RunUntilIdle(); |
220 Mock::VerifyAndClearExpectations(&observer); | 221 Mock::VerifyAndClearExpectations(&observer); |
221 | 222 |
222 provider_->RemoveObserver(&observer); | 223 provider_->RemoveObserver(&observer); |
223 provider_.reset(); | 224 provider_.reset(); |
224 } | 225 } |
225 | 226 |
226 } // namespace policy | 227 } // namespace policy |
OLD | NEW |