Chromium Code Reviews| Index: chrome/browser/ui/app_list/test/fake_arc_bridge_service_for_app_launcher.h |
| diff --git a/chrome/browser/ui/app_list/test/fake_arc_bridge_service_for_app_launcher.h b/chrome/browser/ui/app_list/test/fake_arc_bridge_service_for_app_launcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9b13c66a9c84a52a7c1dfda9353144c0a91260e0 |
| --- /dev/null |
| +++ b/chrome/browser/ui/app_list/test/fake_arc_bridge_service_for_app_launcher.h |
| @@ -0,0 +1,80 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER_H_ |
| +#define CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "components/arc/arc_bridge_service.h" |
| +#include "ui/base/layout.h" |
| + |
| +class FakeArcBridgeServiceForAppLauncher : public arc::ArcBridgeService { |
|
xiyuan
2015/11/18 03:42:16
This does not feel to be app_list specific. Think
khmel1
2015/11/18 06:10:04
Yes, makes sense.
|
| + public: |
| + struct AppInfo { |
| + std::string id() const; |
| + |
| + const char* name; |
| + const char* package; |
| + const char* activity; |
| + }; |
| + |
| + struct IconRequest { |
| + std::string package; |
| + std::string activity; |
| + int scale_factor; |
| + }; |
| + |
| + FakeArcBridgeServiceForAppLauncher(); |
| + ~FakeArcBridgeServiceForAppLauncher() override; |
| + |
| + // arc::ArcBridgeService |
| + void HandleStartup() override; |
| + void Shutdown() override; |
| + bool RegisterInputDevice(const std::string& name, |
| + const std::string& device_type, |
| + base::ScopedFD fd) override; |
| + bool RefreshApps() override; |
| + bool LaunchApp(const std::string& package, |
| + const std::string& activity) override; |
| + bool RequestIcon(const std::string& package, |
| + const std::string& activity, |
| + int scale_factor) override; |
| + |
| + int refresh_apps_cnt() const { return refresh_apps_cnt_; } |
| + |
| + const std::vector<std::string>& launch_requests() const { |
| + return launch_requests_; |
| + } |
| + |
| + const std::vector<IconRequest>& icon_requests() const { |
| + return icon_requests_; |
| + } |
| + |
| + void SetReady(); |
| + |
| + void SetStopped(); |
| + |
| + bool HasObserver(const Observer* observer) const; |
| + |
| + void SendRefreshApps(size_t size, const AppInfo* apps); |
| + |
| + bool GenerateAndSendIcon(const AppInfo& app, |
| + ui::ScaleFactor scale_factor, |
| + std::vector<unsigned char>* png_data); |
| + |
| + private: |
| + // Number of RefreshApps calls. |
| + int refresh_apps_cnt_; |
| + // Keeps information about launch requests. |
| + std::vector<std::string> launch_requests_; |
| + // Keeps information about icon load requests. |
| + std::vector<IconRequest> icon_requests_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeServiceForAppLauncher); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER_H_ |