| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_APP_INSTANCE_H_ | 5 #ifndef COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ |
| 6 #define COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ | 6 #define COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "components/arc/common/app.mojom.h" | 15 #include "components/arc/common/app.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 17 |
| 18 namespace arc { | 18 namespace arc { |
| 19 | 19 |
| 20 class FakeAppInstance : public mojom::AppInstance { | 20 class FakeAppInstance : public mojom::AppInstance { |
| 21 public: | 21 public: |
| 22 class Request { | 22 class Request { |
| 23 public: | 23 public: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // mojom::AppHost::OnAppInstanceReady(), which in turn calls | 110 // mojom::AppHost::OnAppInstanceReady(), which in turn calls |
| 111 // mojom::AppInstance::Init() and | 111 // mojom::AppInstance::Init() and |
| 112 // mojom::AppInstance::RefreshAppList(). This method should be called after a | 112 // mojom::AppInstance::RefreshAppList(). This method should be called after a |
| 113 // call | 113 // call |
| 114 // to mojom::ArcBridgeHost::OnAppInstanceReady() to make sure all method calls | 114 // to mojom::ArcBridgeHost::OnAppInstanceReady() to make sure all method calls |
| 115 // have | 115 // have |
| 116 // been dispatched. | 116 // been dispatched. |
| 117 void WaitForOnAppInstanceReady(); | 117 void WaitForOnAppInstanceReady(); |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 using TaskIdToInfo = std::map<int32_t, scoped_ptr<Request>>; | 120 using TaskIdToInfo = std::map<int32_t, std::unique_ptr<Request>>; |
| 121 // Mojo endpoints. | 121 // Mojo endpoints. |
| 122 mojo::Binding<mojom::AppInstance> binding_; | 122 mojo::Binding<mojom::AppInstance> binding_; |
| 123 mojom::AppHost* app_host_; | 123 mojom::AppHost* app_host_; |
| 124 // Number of RefreshAppList calls. | 124 // Number of RefreshAppList calls. |
| 125 int refresh_app_list_count_ = 0; | 125 int refresh_app_list_count_ = 0; |
| 126 // Keeps information about launch requests. | 126 // Keeps information about launch requests. |
| 127 ScopedVector<Request> launch_requests_; | 127 ScopedVector<Request> launch_requests_; |
| 128 // Keeps information about icon load requests. | 128 // Keeps information about icon load requests. |
| 129 ScopedVector<IconRequest> icon_requests_; | 129 ScopedVector<IconRequest> icon_requests_; |
| 130 // Keeps information for running tasks. | 130 // Keeps information for running tasks. |
| 131 TaskIdToInfo task_id_to_info_; | 131 TaskIdToInfo task_id_to_info_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(FakeAppInstance); | 133 DISALLOW_COPY_AND_ASSIGN(FakeAppInstance); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace arc | 136 } // namespace arc |
| 137 | 137 |
| 138 #endif // COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ | 138 #endif // COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ |
| OLD | NEW |