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

Unified Diff: components/arc/test/fake_arc_bridge_service.h

Issue 1413153007: arc-app-launcher: Minimal support for ARC app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit comment addressed Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/test/fake_arc_bridge_service.h
diff --git a/components/arc/test/fake_arc_bridge_service.h b/components/arc/test/fake_arc_bridge_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..43e70142a421746efe112a46eb1390c2ab6a79b4
--- /dev/null
+++ b/components/arc/test/fake_arc_bridge_service.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 COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H
xiyuan 2015/11/19 03:13:49 nit: end it with "_", i.e. COMPONENTS_ARC_TEST_FAK
khmel1 2015/11/19 17:11:42 Done.
+#define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "components/arc/arc_bridge_service.h"
+#include "ui/base/layout.h"
+
+class FakeArcBridgeService : public arc::ArcBridgeService {
+ public:
+ struct AppInfo {
elijahtaylor (use chromium) 2015/11/19 05:52:00 I was a little confused by this at first because i
khmel1 2015/11/19 17:11:42 Good point TestAppInfo sounds better
+ std::string id() const;
+
+ const char* name;
+ const char* package;
+ const char* activity;
+ };
+
+ struct IconRequest {
+ std::string package;
+ std::string activity;
+ int scale_factor;
+ };
+
+ FakeArcBridgeService();
+ ~FakeArcBridgeService() 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,CHROME_BROWSER_UI_APP_LIST_TEST_FAKE_ARC_BRIDGE_SERVICE_FOR_APP_LAUNCHER_H_
elijahtaylor (use chromium) 2015/11/19 05:52:00 looks like an unintentional paste accident
khmel1 2015/11/19 17:11:42 Done.
+ const std::string& activity) override;
+ bool RequestIcon(const std::string& package,
+ const std::string& activity,
+ int scale_factor) override;
+
+ int refresh_apps_count() const { return refresh_apps_count_; }
+
+ 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_count_;
+ // 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(FakeArcBridgeService);
+};
+
+#endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_SERVICE_H

Powered by Google App Engine
This is Rietveld 408576698