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

Side by Side Diff: components/arc/test/fake_app_instance.h

Issue 2364113002: Replace deprecated ScopedVector<T> in arc::FakeAppInstance (Closed)
Patch Set: Replace deprecated ScopedVector<T> in arc::FakeAppInstance Created 4 years, 2 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
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 <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_vector.h"
16 #include "components/arc/common/app.mojom.h" 15 #include "components/arc/common/app.mojom.h"
17 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
18 17
19 namespace arc { 18 namespace arc {
20 19
21 class FakeAppInstance : public mojom::AppInstance { 20 class FakeAppInstance : public mojom::AppInstance {
22 public: 21 public:
23 class Request { 22 class Request {
24 public: 23 public:
25 Request(const std::string& package_name, const std::string& activity) 24 Request(const std::string& package_name, const std::string& activity)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void SetTaskInfo(int32_t task_id, 129 void SetTaskInfo(int32_t task_id,
131 const std::string& package_name, 130 const std::string& package_name,
132 const std::string& activity); 131 const std::string& activity);
133 void SendRefreshPackageList( 132 void SendRefreshPackageList(
134 const std::vector<mojom::ArcPackageInfo>& packages); 133 const std::vector<mojom::ArcPackageInfo>& packages);
135 void SendPackageAdded(const mojom::ArcPackageInfo& package); 134 void SendPackageAdded(const mojom::ArcPackageInfo& package);
136 void SendPackageUninstalled(const mojo::String& pacakge_name); 135 void SendPackageUninstalled(const mojo::String& pacakge_name);
137 136
138 int refresh_app_list_count() const { return refresh_app_list_count_; } 137 int refresh_app_list_count() const { return refresh_app_list_count_; }
139 138
140 const ScopedVector<Request>& launch_requests() const { 139 const std::vector<std::unique_ptr<Request>>& launch_requests() const {
141 return launch_requests_; 140 return launch_requests_;
142 } 141 }
143 142
144 const ScopedVector<mojo::String>& launch_intents() const { 143 const std::vector<std::unique_ptr<mojo::String>>& launch_intents() const {
145 return launch_intents_; 144 return launch_intents_;
146 } 145 }
147 146
148 const ScopedVector<IconRequest>& icon_requests() const { 147 const std::vector<std::unique_ptr<IconRequest>>& icon_requests() const {
149 return icon_requests_; 148 return icon_requests_;
150 } 149 }
151 150
152 const ScopedVector<ShortcutIconRequest>& shortcut_icon_requests() const { 151 const std::vector<std::unique_ptr<ShortcutIconRequest>>&
152 shortcut_icon_requests() const {
153 return shortcut_icon_requests_; 153 return shortcut_icon_requests_;
154 } 154 }
155 155
156 private: 156 private:
157 using TaskIdToInfo = std::map<int32_t, std::unique_ptr<Request>>; 157 using TaskIdToInfo = std::map<int32_t, std::unique_ptr<Request>>;
158 // Mojo endpoints. 158 // Mojo endpoints.
159 mojom::AppHost* app_host_; 159 mojom::AppHost* app_host_;
160 // Number of RefreshAppList calls. 160 // Number of RefreshAppList calls.
161 int refresh_app_list_count_ = 0; 161 int refresh_app_list_count_ = 0;
162 // Keeps information about launch requests. 162 // Keeps information about launch requests.
163 ScopedVector<Request> launch_requests_; 163 std::vector<std::unique_ptr<Request>> launch_requests_;
164 // Keeps information about launch intents. 164 // Keeps information about launch intents.
165 ScopedVector<mojo::String> launch_intents_; 165 std::vector<std::unique_ptr<mojo::String>> launch_intents_;
166 // Keeps information about icon load requests. 166 // Keeps information about icon load requests.
167 ScopedVector<IconRequest> icon_requests_; 167 std::vector<std::unique_ptr<IconRequest>> icon_requests_;
168 // Keeps information about shortcut icon load requests. 168 // Keeps information about shortcut icon load requests.
169 ScopedVector<ShortcutIconRequest> shortcut_icon_requests_; 169 std::vector<std::unique_ptr<ShortcutIconRequest>> shortcut_icon_requests_;
170 // Keeps information for running tasks. 170 // Keeps information for running tasks.
171 TaskIdToInfo task_id_to_info_; 171 TaskIdToInfo task_id_to_info_;
172 172
173 bool GetFakeIcon(mojom::ScaleFactor scale_factor, 173 bool GetFakeIcon(mojom::ScaleFactor scale_factor,
174 std::string* png_data_as_string); 174 std::string* png_data_as_string);
175 175
176 DISALLOW_COPY_AND_ASSIGN(FakeAppInstance); 176 DISALLOW_COPY_AND_ASSIGN(FakeAppInstance);
177 }; 177 };
178 178
179 } // namespace arc 179 } // namespace arc
180 180
181 #endif // COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_ 181 #endif // COMPONENTS_ARC_TEST_FAKE_APP_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698