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

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

Issue 858303003: Removing FakePolicyWatcher and introducing FakeAsyncPolicyLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
7
8 #include "base/macros.h"
9 #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/policy_bundle.h"
13
14 namespace base {
15 class SequencedTaskRunner;
16 } // namespace base
17
18 namespace policy {
19
20 // Fake AsyncPolicyLoader for testing with test-controlled policies.
21 //
22 // Typical test code would populate the policy contents via calls to
23 // ClearPolicies and AddPolicies and then notify the rest of the policy
24 // subsystem of the changes by calling PostReloadOnBackgroundThread.
25 class FakeAsyncPolicyLoader : public AsyncPolicyLoader {
26 public:
27 explicit FakeAsyncPolicyLoader(
28 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
29
30 // Implementation of virtual methods from AsyncPolicyLoader base class.
31 scoped_ptr<PolicyBundle> Load() override;
32 void InitOnBackgroundThread() override;
33
34 // Provides content for the simulated / faked policies.
35 void SetPolicies(const PolicyBundle& policy_bundle);
36
37 // Notifies the rest of the policy subsystem that policy contents have
38 // changed. This simulates / fakes a notification that normally would be
39 // triggered by a FilePathWatcher or (registry)ObjectWatcher in a real loader.
40 //
41 // See AsyncPolicyLoader::Reload method for description of the |force|
42 // parameter.
43 void PostReloadOnBackgroundThread(bool force);
44
45 private:
46 PolicyBundle policy_bundle_;
47
48 DISALLOW_COPY_AND_ASSIGN(FakeAsyncPolicyLoader);
49 };
50
51 } // namespace policy
52
53 #endif // COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
OLDNEW
« no previous file with comments | « components/policy/core/common/async_policy_loader.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