summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_bluetooth_input_client.h
diff options
context:
space:
mode:
authordeymo@chromium.org <deymo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-20 00:54:59 +0000
committerdeymo@chromium.org <deymo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-20 00:54:59 +0000
commit8e84e8ba62a62ecec0d2b2ab389e5de5d7c3e30e (patch)
treedd8434e226156e281e98d62ff003e7931079b5e6 /chromeos/dbus/fake_bluetooth_input_client.h
parent85cb468fe17f6449a387e11795b200a815c720f2 (diff)
downloadchromium_src-8e84e8ba62a62ecec0d2b2ab389e5de5d7c3e30e.zip
chromium_src-8e84e8ba62a62ecec0d2b2ab389e5de5d7c3e30e.tar.gz
chromium_src-8e84e8ba62a62ecec0d2b2ab389e5de5d7c3e30e.tar.bz2
Bluetooth: D-Bus client interface for org.bluez.Input1
Implements the D-Bus client for the new Input1 interface currently exporting only one property. BUG=220553 TEST=device_unittests pass. Review URL: https://chromiumcodereview.appspot.com/14048007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_bluetooth_input_client.h')
-rw-r--r--chromeos/dbus/fake_bluetooth_input_client.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/chromeos/dbus/fake_bluetooth_input_client.h b/chromeos/dbus/fake_bluetooth_input_client.h
new file mode 100644
index 0000000..103e57d
--- /dev/null
+++ b/chromeos/dbus/fake_bluetooth_input_client.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2013 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 CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+
+#include "base/callback.h"
+#include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client_implementation_type.h"
+#include "chromeos/dbus/experimental_bluetooth_input_client.h"
+#include "dbus/object_path.h"
+#include "dbus/property.h"
+
+namespace chromeos {
+
+// FakeBluetoothInputClient simulates the behavior of the Bluetooth Daemon
+// input device objects and is used both in test cases in place of a mock and on
+// the Linux desktop.
+class CHROMEOS_EXPORT FakeBluetoothInputClient
+ : public ExperimentalBluetoothInputClient {
+ public:
+ struct Properties : public ExperimentalBluetoothInputClient::Properties {
+ explicit Properties(const PropertyChangedCallback & callback);
+ virtual ~Properties();
+
+ // dbus::PropertySet override
+ virtual void Get(dbus::PropertyBase* property,
+ dbus::PropertySet::GetCallback callback) OVERRIDE;
+ virtual void GetAll() OVERRIDE;
+ virtual void Set(dbus::PropertyBase* property,
+ dbus::PropertySet::SetCallback callback) OVERRIDE;
+ };
+
+ FakeBluetoothInputClient();
+ virtual ~FakeBluetoothInputClient();
+
+ // ExperimentalBluetoothInputClient override
+ virtual void AddObserver(Observer* observer) OVERRIDE;
+ virtual void RemoveObserver(Observer* observer) OVERRIDE;
+ virtual Properties* GetProperties(const dbus::ObjectPath& object_path)
+ OVERRIDE;
+
+ // Simulate device addition/removal
+ void AddInputDevice(const dbus::ObjectPath& object_path);
+ void RemoveInputDevice(const dbus::ObjectPath& object_path);
+
+ private:
+ // Property callback passed when we create Properties* structures.
+ void OnPropertyChanged(const dbus::ObjectPath& object_path,
+ const std::string& property_name);
+
+ // Static properties we return.
+ typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap;
+ PropertiesMap properties_map_;
+
+ // List of observers interested in event notifications from us.
+ ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInputClient);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_