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

Unified Diff: chrome/browser/chromeos/device/fake_input_service_proxy.cc

Issue 913773002: Created fakes for HID-detection screen testing. Initial browsertest added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/device/fake_input_service_proxy.cc
diff --git a/chrome/browser/chromeos/device/fake_input_service_proxy.cc b/chrome/browser/chromeos/device/fake_input_service_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..602ba85d7e3c8fdd09f8747c6a9fe2e5d16b57c2
--- /dev/null
+++ b/chrome/browser/chromeos/device/fake_input_service_proxy.cc
@@ -0,0 +1,53 @@
+// Copyright 2014 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.
+
+#include <vector>
+
+#include "chrome/browser/chromeos/device/fake_input_service_proxy.h"
+
+typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo;
+
+namespace chromeos {
+
+FakeInputServiceProxy::FakeInputServiceProxy() {
+}
+
+FakeInputServiceProxy::~FakeInputServiceProxy() {
+}
+
+// static
+void FakeInputServiceProxy::WarmUp() {
+}
+
+void FakeInputServiceProxy::GetDevices(const GetDevicesCallback& callback) {
+ std::vector<InputDeviceInfo> devices;
+ for (auto& device_entry : devices_) {
+ devices.push_back(device_entry.second);
+ }
+ callback.Run(devices);
+}
+
+void FakeInputServiceProxy::GetDeviceInfo(const std::string& id,
+ const GetDeviceInfoCallback& callback) {
+ InputDeviceInfo info;
+ DeviceMap::const_iterator it = devices_.find(id);
+ if (it == devices_.end()) {
+ callback.Run(false, info);
+ return;
+ }
+ info = it->second;
+ callback.Run(true, info);
+}
+
+void FakeInputServiceProxy::AddDevice(InputDeviceInfo& info) {
+ devices_[info.id] = info;
+ FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceAdded(info));
+}
+
+void FakeInputServiceProxy::RemoveDevice(const std::string& id) {
+ devices_.erase(id);
+ FOR_EACH_OBSERVER(Observer, observers_, OnInputDeviceRemoved(id));
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698