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