OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ARC_TEST_FAKE_POLICY_INSTANCE_H_ | 5 #ifndef COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ |
6 #define COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ | 6 #define COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ |
7 | 7 |
8 #include "components/arc/arc_bridge_service.h" | 8 #include "components/arc/arc_bridge_service.h" |
9 #include "components/arc/common/policy.mojom.h" | 9 #include "components/arc/common/policy.mojom.h" |
| 10 #include "components/arc/instance_holder.h" |
10 #include "components/arc/test/fake_arc_bridge_instance.h" | 11 #include "components/arc/test/fake_arc_bridge_instance.h" |
11 | 12 |
12 namespace arc { | 13 namespace arc { |
13 | 14 |
14 class FakePolicyInstance : public mojom::PolicyInstance, | 15 class FakePolicyInstance |
15 public arc::ArcBridgeService::Observer { | 16 : public mojom::PolicyInstance, |
| 17 public arc::InstanceHolder<mojom::PolicyInstance>::Observer { |
16 public: | 18 public: |
17 // bridge_service should not be destroyed before the destructor is called. | 19 // bridge_service should not be destroyed before the destructor is called. |
18 FakePolicyInstance(mojo::InterfaceRequest<mojom::PolicyInstance> request, | 20 FakePolicyInstance(mojo::InterfaceRequest<mojom::PolicyInstance> request, |
19 ArcBridgeService* bridge_service); | 21 ArcBridgeService* bridge_service); |
20 ~FakePolicyInstance() override; | 22 ~FakePolicyInstance() override; |
21 | 23 |
22 // mojom::PolicyInstance | 24 // mojom::PolicyInstance |
23 void Init(mojom::PolicyHostPtr host_ptr) override; | 25 void Init(mojom::PolicyHostPtr host_ptr) override; |
24 void OnPolicyUpdated() override; | 26 void OnPolicyUpdated() override; |
25 | 27 |
26 // arc::ArcBridgeService::Observer | 28 // arc::InstanceHolder<mojom::PolicyInstance>::Observer |
27 void OnPolicyInstanceReady() override; | 29 void OnInstanceReady(mojom::PolicyInstance*, uint32_t version) override; |
28 | 30 |
29 void WaitForOnPolicyInstanceReady(); | 31 void WaitForOnPolicyInstanceReady(); |
30 void CallGetPolicies(const mojom::PolicyHost::GetPoliciesCallback& callback); | 32 void CallGetPolicies(const mojom::PolicyHost::GetPoliciesCallback& callback); |
31 | 33 |
32 private: | 34 private: |
33 mojo::Binding<mojom::PolicyInstance> binding_; | 35 mojo::Binding<mojom::PolicyInstance> binding_; |
34 ArcBridgeService* const bridge_service_; | 36 ArcBridgeService* const bridge_service_; |
35 mojom::PolicyHostPtr host_ptr_; | 37 mojom::PolicyHostPtr host_ptr_; |
36 | 38 |
37 bool ready_ = false; | 39 bool ready_ = false; |
38 | 40 |
39 DISALLOW_COPY_AND_ASSIGN(FakePolicyInstance); | 41 DISALLOW_COPY_AND_ASSIGN(FakePolicyInstance); |
40 }; | 42 }; |
41 | 43 |
42 } // namespace arc | 44 } // namespace arc |
43 | 45 |
44 #endif // COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ | 46 #endif // COMPONENTS_ARC_TEST_FAKE_POLICY_INSTANCE_H_ |
OLD | NEW |