Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: components/policy/core/common/fake_async_policy_loader.h

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "components/policy/core/common/async_policy_loader.h" 12 #include "components/policy/core/common/async_policy_loader.h"
12 #include "components/policy/core/common/policy_bundle.h" 13 #include "components/policy/core/common/policy_bundle.h"
13 14
14 namespace base { 15 namespace base {
15 class SequencedTaskRunner; 16 class SequencedTaskRunner;
16 } // namespace base 17 } // namespace base
17 18
18 namespace policy { 19 namespace policy {
19 20
20 // Fake AsyncPolicyLoader for testing with test-controlled policies. 21 // Fake AsyncPolicyLoader for testing with test-controlled policies.
21 // 22 //
22 // Typical test code would populate the policy contents via calls to 23 // Typical test code would populate the policy contents via calls to
23 // ClearPolicies and AddPolicies and then notify the rest of the policy 24 // ClearPolicies and AddPolicies and then notify the rest of the policy
24 // subsystem of the changes by calling PostReloadOnBackgroundThread. 25 // subsystem of the changes by calling PostReloadOnBackgroundThread.
25 class FakeAsyncPolicyLoader : public AsyncPolicyLoader { 26 class FakeAsyncPolicyLoader : public AsyncPolicyLoader {
26 public: 27 public:
27 explicit FakeAsyncPolicyLoader( 28 explicit FakeAsyncPolicyLoader(
28 const scoped_refptr<base::SequencedTaskRunner>& task_runner); 29 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
29 30
30 // Implementation of virtual methods from AsyncPolicyLoader base class. 31 // Implementation of virtual methods from AsyncPolicyLoader base class.
31 scoped_ptr<PolicyBundle> Load() override; 32 std::unique_ptr<PolicyBundle> Load() override;
32 void InitOnBackgroundThread() override; 33 void InitOnBackgroundThread() override;
33 34
34 // Provides content for the simulated / faked policies. 35 // Provides content for the simulated / faked policies.
35 void SetPolicies(const PolicyBundle& policy_bundle); 36 void SetPolicies(const PolicyBundle& policy_bundle);
36 37
37 // Notifies the rest of the policy subsystem that policy contents have 38 // Notifies the rest of the policy subsystem that policy contents have
38 // changed. This simulates / fakes a notification that normally would be 39 // changed. This simulates / fakes a notification that normally would be
39 // triggered by a FilePathWatcher or (registry)ObjectWatcher in a real loader. 40 // triggered by a FilePathWatcher or (registry)ObjectWatcher in a real loader.
40 // 41 //
41 // See AsyncPolicyLoader::Reload method for description of the |force| 42 // See AsyncPolicyLoader::Reload method for description of the |force|
42 // parameter. 43 // parameter.
43 void PostReloadOnBackgroundThread(bool force); 44 void PostReloadOnBackgroundThread(bool force);
44 45
45 private: 46 private:
46 PolicyBundle policy_bundle_; 47 PolicyBundle policy_bundle_;
47 48
48 DISALLOW_COPY_AND_ASSIGN(FakeAsyncPolicyLoader); 49 DISALLOW_COPY_AND_ASSIGN(FakeAsyncPolicyLoader);
49 }; 50 };
50 51
51 } // namespace policy 52 } // namespace policy
52 53
53 #endif // COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_ 54 #endif // COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/external_data_fetcher.cc ('k') | components/policy/core/common/fake_async_policy_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698