cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / policy / core / common / fake_async_policy_loader.h
blob2078e5a3a7dd0ebb9f60964a273d8ea841aba405
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.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_
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"
14 namespace base {
15 class SequencedTaskRunner;
16 } // namespace base
18 namespace policy {
20 // Fake AsyncPolicyLoader for testing with test-controlled policies.
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);
30 // Implementation of virtual methods from AsyncPolicyLoader base class.
31 scoped_ptr<PolicyBundle> Load() override;
32 void InitOnBackgroundThread() override;
34 // Provides content for the simulated / faked policies.
35 void SetPolicies(const PolicyBundle& policy_bundle);
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.
41 // See AsyncPolicyLoader::Reload method for description of the |force|
42 // parameter.
43 void PostReloadOnBackgroundThread(bool force);
45 private:
46 PolicyBundle policy_bundle_;
48 DISALLOW_COPY_AND_ASSIGN(FakeAsyncPolicyLoader);
51 } // namespace policy
53 #endif // COMPONENTS_POLICY_CORE_COMMON_FAKE_ASYNC_POLICY_LOADER_H_