diff options
author | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-08 07:18:54 +0000 |
---|---|---|
committer | armansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-08 07:18:54 +0000 |
commit | 42716047fd8604517a73070401470fada6971b23 (patch) | |
tree | f17388c8038fb91984dc2c727ae58649862f96de /chromeos/dbus/fake_nfc_adapter_client.h | |
parent | 6fe561067c842ec9d884f1b3356b4218af9a0dfa (diff) | |
download | chromium_src-42716047fd8604517a73070401470fada6971b23.zip chromium_src-42716047fd8604517a73070401470fada6971b23.tar.gz chromium_src-42716047fd8604517a73070401470fada6971b23.tar.bz2 |
nfc: Implement NfcAdapterChromeOS.
Added the basic implementation of NfcAdapterChromeOS, with no tag/peer logic.
BUG=316471
TEST=device_unittests
Review URL: https://codereview.chromium.org/100393011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239388 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 | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/chromeos/dbus/fake_nfc_adapter_client.h b/chromeos/dbus/fake_nfc_adapter_client.h index 7c23fc3..268b506 100644 --- a/chromeos/dbus/fake_nfc_adapter_client.h +++ b/chromeos/dbus/fake_nfc_adapter_client.h @@ -5,6 +5,10 @@ #ifndef CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ #define CHROMEOS_DBUS_FAKE_NFC_ADAPTER_CLIENT_H_ +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "base/observer_list.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/nfc_adapter_client.h" #include "chromeos/dbus/nfc_client_helpers.h" @@ -13,9 +17,6 @@ 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 { @@ -37,6 +38,7 @@ class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient { virtual void Init(dbus::Bus* bus) OVERRIDE; virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; + virtual std::vector<dbus::ObjectPath> GetAdapters() OVERRIDE; virtual Properties* GetProperties( const dbus::ObjectPath& object_path) OVERRIDE; virtual void StartPollLoop( @@ -49,7 +51,30 @@ class CHROMEOS_EXPORT FakeNfcAdapterClient : public NfcAdapterClient { const base::Closure& callback, const nfc_client_helpers::ErrorCallback& error_callback) OVERRIDE; + // Sets the adapter as |present|. + 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[]; + private: + // Property changed callback passed when we create Properties* structures. + void OnPropertyChanged(const dbus::ObjectPath& object_path, + const std::string& property_name); + + // List of observers interested in event notifications from us. + ObserverList<Observer> observers_; + + // Fake properties that are returned for the emulated adapters. + scoped_ptr<Properties> properties_; + scoped_ptr<Properties> second_properties_; + + // Whether the adapter and second adapter is present or not. + bool present_; + bool second_present_; + DISALLOW_COPY_AND_ASSIGN(FakeNfcAdapterClient); }; |