OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_ |
| 6 #define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "components/arc/arc_bridge_service.h" |
| 13 #include "ui/base/layout.h" |
| 14 |
| 15 class FakeArcBridgeService : public arc::ArcBridgeService { |
| 16 public: |
| 17 struct AppInfo { |
| 18 std::string id() const; |
| 19 |
| 20 const char* name; |
| 21 const char* package; |
| 22 const char* activity; |
| 23 }; |
| 24 |
| 25 struct IconRequest { |
| 26 std::string package; |
| 27 std::string activity; |
| 28 int scale_factor; |
| 29 }; |
| 30 |
| 31 FakeArcBridgeService(); |
| 32 ~FakeArcBridgeService() override; |
| 33 |
| 34 // arc::ArcBridgeService |
| 35 void HandleStartup() override; |
| 36 void Shutdown() override; |
| 37 bool RegisterInputDevice(const std::string& name, |
| 38 const std::string& device_type, |
| 39 base::ScopedFD fd) override; |
| 40 bool RefreshApps() override; |
| 41 bool LaunchApp(const std::string& package, |
| 42 const std::string& activity) override; |
| 43 bool RequestIcon(const std::string& package, |
| 44 const std::string& activity, |
| 45 int scale_factor) override; |
| 46 |
| 47 int refresh_apps_count() const { return refresh_apps_count_; } |
| 48 |
| 49 const std::vector<std::string>& launch_requests() const { |
| 50 return launch_requests_; |
| 51 } |
| 52 |
| 53 const std::vector<IconRequest>& icon_requests() const { |
| 54 return icon_requests_; |
| 55 } |
| 56 |
| 57 void SetReady(); |
| 58 |
| 59 void SetStopped(); |
| 60 |
| 61 bool HasObserver(const Observer* observer) const; |
| 62 |
| 63 void SendRefreshApps(size_t size, const AppInfo* apps); |
| 64 |
| 65 bool GenerateAndSendIcon(const AppInfo& app, |
| 66 ui::ScaleFactor scale_factor, |
| 67 std::vector<unsigned char>* png_data); |
| 68 |
| 69 private: |
| 70 // Number of RefreshApps calls. |
| 71 int refresh_apps_count_; |
| 72 // Keeps information about launch requests. |
| 73 std::vector<std::string> launch_requests_; |
| 74 // Keeps information about icon load requests. |
| 75 std::vector<IconRequest> icon_requests_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeService); |
| 78 }; |
| 79 |
| 80 #endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H_ |
OLD | NEW |