diff options
author | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 23:24:19 +0000 |
---|---|---|
committer | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 23:24:19 +0000 |
commit | 13aa72068571a09f84d6bd2524cf6d9ca190f214 (patch) | |
tree | 77b4587e072bdfdde5ac0e95db8292acbf0211f9 /chromeos/dbus/fake_nfc_adapter_client.h | |
parent | 57afa12e2f3d503b2cea20ecd50a47930156305a (diff) | |
download | chromium_src-13aa72068571a09f84d6bd2524cf6d9ca190f214.zip chromium_src-13aa72068571a09f84d6bd2524cf6d9ca190f214.tar.gz chromium_src-13aa72068571a09f84d6bd2524cf6d9ca190f214.tar.bz2 |
nfc: Implement device::NfcPeerChromeOS.
Implemented device::NfcPeer for Chrome OS. With this, Chrome can now
interact with remote NFC adapters.
BUG=316471
TEST=device_unittests
Review URL: https://codereview.chromium.org/112183002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_nfc_adapter_client.h')
-rw-r--r-- | chromeos/dbus/fake_nfc_adapter_client.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/chromeos/dbus/fake_nfc_adapter_client.h b/chromeos/dbus/fake_nfc_adapter_client.h index 268b506..6752458 100644 --- a/chromeos/dbus/fake_nfc_adapter_client.h +++ b/chromeos/dbus/fake_nfc_adapter_client.h @@ -19,6 +19,11 @@ namespace chromeos { // and is used both in test cases in place of a mock and on the Linux desktop. class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient { public: + // The object paths for the adapters that are being emulated. + static const char kAdapterPath0[]; + static const char kAdapterPath1[]; + + // Properties structure that provides fake behavior for D-Bus calls. struct Properties : public NfcAdapterClient::Properties { explicit Properties(const PropertyChangedCallback& callback); virtual ~Properties(); @@ -51,13 +56,27 @@ class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient { const base::Closure& callback, const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE; - // Sets the adapter as |present|. + // Sets the adapter as |present|. Used for testing. void SetAdapterPresent(bool present); void SetSecondAdapterPresent(bool present); - // The object paths for the adapters that are being emulated. - static const char kAdapterPath0[]; - static const char kAdapterPath1[]; + // Tells the FakeNfcAdapterClient to add the device with path |device_path| + // to its list of devices exposed for |kAdapterPath0|, if it is not already in + // the list and promptly triggers a property changed signal. This method will + // also fail, if the polling property of the adapter is false and will set it + // to false on success. + void SetDevice(const dbus::ObjectPath& device_path); + + // Talls the FakeNfcAdapterClient to remove the device with path + // |device_path| from its list of devices exposed for |kAdapterPath0|, if it + // is in its list of devices. On success, this method will mark the polling + // property of the adapter to true. + void UnsetDevice(const dbus::ObjectPath& device_path); + + // Sets a flag that determines whether FakeNfcAdapterClient should notify + // FakeNfcDeviceClient to start a pairing simulation as a result of a call + // to StartPollLoop(). This is enabled by default. + void EnablePairingOnPoll(bool enabled); private: // Property changed callback passed when we create Properties* structures. @@ -71,10 +90,14 @@ class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient { scoped_ptr<Properties> properties_; scoped_ptr<Properties> second_properties_; - // Whether the adapter and second adapter is present or not. + // Whether the adapter and second adapter are present or not. bool present_; bool second_present_; + // If true, a pairing simulation is initiated on a successful call to + // StartPollLoop(). + bool start_pairing_on_poll_; + DISALLOW_COPY_AND_ASSIGN(FakeNfcAdapterClient); }; |