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

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: Addressed code review feedback from Mattias. 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 "components/policy/core/common/async_policy_loader.h"
9 #include "components/policy/core/common/policy_bundle.h"
10 #include "components/policy/core/common/policy_namespace.h"
11 #include "components/policy/core/common/policy_types.h"
12
13 namespace base {
14 class DictionaryValue;
15 } // namespace base
16
17 namespace policy {
18
19 // Fake AsyncPolicyLoader for testing with test-controlled policies.
20 //
21 // Typical test code would populate the policy contents via calls to
22 // ClearPolicies and AddPolicies and then notify the rest of the policy
23 // subsystem of the changes by calling PostReloadOnBackgroundThread.
24 class FakeAsyncPolicyLoader : public AsyncPolicyLoader {
25 public:
26 explicit FakeAsyncPolicyLoader(
27 scoped_refptr<base::SequencedTaskRunner> task_runner);
Mattias Nissler (ping if slow) 2015/01/23 08:27:39 #include "base/memory/ref_counted.h"
Łukasz Anforowicz 2015/01/23 17:49:55 Done.
28
29 // Implementation of virtual methods from AsyncPolicyLoader base class.
30 scoped_ptr<PolicyBundle> Load() override;
31 void InitOnBackgroundThread() override;
32
33 // Provides content for the simulated / faked policies.
34 void SetPolicies(const PolicyBundle& policy_bundle);
35
36 // Notifies the rest of the policy subsystem that policy contents have
37 // changed. This simulates / fakes a notification that normally would be
38 // triggered by a FilePathWatcher or (registry)ObjectWatcher in a real loader.
39 //
40 // See AsyncPolicyLoader::Reload method for description of the |force|
41 // parameter.
42 void PostReloadOnBackgroundThread(bool force);
43
44 private:
45 PolicyBundle policy_bundle_;
46
47 DISALLOW_COPY_AND_ASSIGN(FakeAsyncPolicyLoader);
Mattias Nissler (ping if slow) 2015/01/23 08:27:40 #include "base/macros.h"
Łukasz Anforowicz 2015/01/23 17:49:55 Done.
48 };
49
50 } // namespace policy
51
52 #endif // COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698