summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_nfc_adapter_client.h
diff options
context:
space:
mode:
authorarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-26 10:39:02 +0000
committerarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-26 10:39:02 +0000
commitd3cbda82eef3ace61ef147b27438cbb6ea5b0202 (patch)
treef381556b410f2800e5ba62b59b5bf770b049643b /chromeos/dbus/fake_nfc_adapter_client.h
parentc81f5d320735ef94097d08e1c2627ce7fd0842df (diff)
downloadchromium_src-d3cbda82eef3ace61ef147b27438cbb6ea5b0202.zip
chromium_src-d3cbda82eef3ace61ef147b27438cbb6ea5b0202.tar.gz
chromium_src-d3cbda82eef3ace61ef147b27438cbb6ea5b0202.tar.bz2
nfc: Add D-Bus client for NFC adapter.
Added D-Bus client code for the NFC Adapter interface. BUG=304979 TEST=1. chromeos_unittests 2. On Chrome OS machine, adding and removing a USB NFC adapter should cause adapter object proxies to get added and removed. Tapping an NFC tag or a Nexus 4 device should log property change events. Review URL: https://codereview.chromium.org/35873002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_nfc_adapter_client.h')
-rw-r--r--chromeos/dbus/fake_nfc_adapter_client.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/chromeos/dbus/fake_nfc_adapter_client.h b/chromeos/dbus/fake_nfc_adapter_client.h
new file mode 100644
index 0000000..97cab97
--- /dev/null
+++ b/chromeos/dbus/fake_nfc_adapter_client.h
@@ -0,0 +1,61 @@
+// Copyright 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_NFC_ADAPTER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_
+
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/nfc_adapter_client.h"
+#include "chromeos/dbus/nfc_client_helpers.h"
+
+namespace chromeos {
+
+// FakeNfcAdapterClient simulates the behavior of the NFC adapter objects
+// and is used both in test cases in place of a mock and on the Linux desktop.
+// TODO(armansito): For now, this doesn't do anything. Implement fake
+// behavior in conjunction with unit tests while implementing the src/device
+// layer.
+class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient {
+ public:
+ struct Properties : public NfcAdapterClient::Properties {
+ explicit Properties(const PropertyChangedCallback& callback);
+ virtual ~Properties();
+
+ // dbus::PropertySet overrides.
+ 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;
+ };
+
+ FakeNfcAdapterClient();
+ virtual ~FakeNfcAdapterClient();
+
+ // NfcAdapterClient overrides.
+ virtual void Init(dbus::Bus* bus) OVERRIDE;
+ virtual void AddObserver(Observer* observer) OVERRIDE;
+ virtual void RemoveObserver(Observer* observer) OVERRIDE;
+ virtual Properties* GetProperties(const dbus::ObjectPath& object_path)
+ OVERRIDE;
+ virtual void StartPollLoop(
+ const dbus::ObjectPath& object_path,
+ const std::string& mode,
+ const base::Closure& callback,
+ const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE;
+ virtual void StopPollLoop(
+ const dbus::ObjectPath& object_path,
+ const base::Closure& callback,
+ const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE;
+
+ private:
+ // Property callback passed when we create Properties* structures.
+ void OnPropertyChanged(const std::string& property_name);
+
+ DISALLOW_COPY_AND_ASSIGN(FakeNfcAdapterClient);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_