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

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

Issue 1523643002: arc-bridge: Move most methods to Mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased to ToT Created 5 years 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_ARC_BRIDGE_SERVICE_H_ 5 #ifndef COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_
6 #define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_ 6 #define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h"
13 #include "components/arc/arc_bridge_service.h" 12 #include "components/arc/arc_bridge_service.h"
14 13
15 namespace arc { 14 namespace arc {
16 15
17 class FakeArcBridgeService : public ArcBridgeService { 16 class FakeArcBridgeService : public ArcBridgeService {
18 public: 17 public:
19 class Request {
20 public:
21 Request(const std::string& package, const std::string& activity)
22 : package_(package),
23 activity_(activity) {
24 }
25
26 ~Request() {
27 }
28
29 const std::string& package() const { return package_; }
30
31 const std::string& activity() const { return activity_; }
32
33 bool IsForApp(const AppInfo& app_info) const {
34 return package_ == app_info.package && activity_ == app_info.activity;
35 }
36
37 private:
38 std::string package_;
39 std::string activity_;
40
41 DISALLOW_COPY_AND_ASSIGN(Request);
42 };
43
44 class IconRequest : public Request {
45 public:
46 IconRequest(const std::string& package,
47 const std::string& activity,
48 ScaleFactor scale_factor)
49 : Request(package, activity),
50 scale_factor_(scale_factor) {
51 }
52
53 ~IconRequest() {
54 }
55
56 int scale_factor() const { return scale_factor_; }
57
58 private:
59 int scale_factor_;
60
61 DISALLOW_COPY_AND_ASSIGN(IconRequest);
62 };
63
64 FakeArcBridgeService(); 18 FakeArcBridgeService();
65 ~FakeArcBridgeService() override; 19 ~FakeArcBridgeService() override;
66 20
67 // arc::ArcBridgeService 21 // arc::ArcBridgeService
68 void DetectAvailability() override; 22 void DetectAvailability() override;
69 void HandleStartup() override; 23 void HandleStartup() override;
70 void Shutdown() override; 24 void Shutdown() override;
71 bool RegisterInputDevice(const std::string& name,
72 const std::string& device_type,
73 base::ScopedFD fd) override;
74 bool SendBroadcast(const std::string& action,
75 const std::string& package,
76 const std::string& clazz,
77 const base::DictionaryValue& extras) override;
78 bool RefreshAppList() override;
79 bool LaunchApp(const std::string& package,
80 const std::string& activity) override;
81 bool RequestAppIcon(const std::string& package,
82 const std::string& activity,
83 ScaleFactor scale_factor) override;
84 bool SendNotificationEventToAndroid(const std::string& key,
85 ArcNotificationEvent event) override;
86 bool RequestProcessList() override;
87
88 int refresh_app_list_count() const { return refresh_app_list_count_; }
89
90 const ScopedVector<Request>& launch_requests() const {
91 return launch_requests_;
92 }
93
94 const ScopedVector<IconRequest>& icon_requests() const {
95 return icon_requests_;
96 }
97 25
98 void SetReady(); 26 void SetReady();
99 27
100 void SetStopped(); 28 void SetStopped();
101 29
102 bool HasObserver(const Observer* observer); 30 bool HasObserver(const Observer* observer);
103 bool HasAppObserver(const AppObserver* observer);
104
105 void SendRefreshAppList(const std::vector<AppInfo>& apps);
106
107 bool GenerateAndSendIcon(const AppInfo& app,
108 ScaleFactor scale_factor,
109 std::string* png_data);
110 31
111 private: 32 private:
112 // Number of RefreshAppList calls.
113 int refresh_app_list_count_ = 0;
114 // Keeps information about launch requests.
115 ScopedVector<Request> launch_requests_;
116 // Keeps information about icon load requests.
117 ScopedVector<IconRequest> icon_requests_;
118
119 DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeService); 33 DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeService);
120 }; 34 };
121 35
122 } // namespace arc 36 } // namespace arc
123 37
124 #endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_ 38 #endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_
OLDNEW
« no previous file with comments | « components/arc/test/fake_arc_bridge_instance.cc ('k') | components/arc/test/fake_arc_bridge_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698