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

Side by Side Diff: chromeos/dbus/fake_nfc_manager_client.h

Issue 2292703002: chromeos: Remove unused NFC D-Bus client library (Closed)
Patch Set: rebase Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « chromeos/dbus/fake_nfc_device_client.cc ('k') | chromeos/dbus/fake_nfc_manager_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_FAKE_NFC_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_NFC_MANAGER_CLIENT_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/observer_list.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/nfc_manager_client.h"
15 #include "dbus/property.h"
16
17 namespace chromeos {
18
19 // FakeNfcManagerClient simulates the behavior of the NFC Daemon manager object
20 // and is used both in test cases in place of a mock and on the Linux desktop.
21 class CHROMEOS_EXPORT FakeNfcManagerClient : public NfcManagerClient {
22 public:
23 struct Properties : public NfcManagerClient::Properties {
24 explicit Properties(const PropertyChangedCallback& callback);
25 ~Properties() override;
26
27 // dbus::PropertySet overrides.
28 void Get(dbus::PropertyBase* property,
29 dbus::PropertySet::GetCallback callback) override;
30 void GetAll() override;
31 void Set(dbus::PropertyBase* property,
32 dbus::PropertySet::SetCallback callback) override;
33 };
34
35 FakeNfcManagerClient();
36 ~FakeNfcManagerClient() override;
37
38 // NfcManagerClient overrides.
39 void Init(dbus::Bus* bus) override;
40 void AddObserver(Observer* observer) override;
41 void RemoveObserver(Observer* observer) override;
42 Properties* GetProperties() override;
43
44 // Methods to simulate adapters getting added and removed.
45 void AddAdapter(const std::string& adapter_path);
46 void RemoveAdapter(const std::string& adapter_path);
47
48 // Default path of an adapter that is simulated for testing.
49 static const char kDefaultAdapterPath[];
50
51 private:
52 // Property callback passed when we create Properties* structures.
53 void OnPropertyChanged(const std::string& property_name);
54
55 // List of observers interested in event notifications.
56 base::ObserverList<Observer> observers_;
57
58 // Set containing the currently simulated adapters.
59 std::set<dbus::ObjectPath> adapters_;
60
61 // Fake properties object. This gets updated whenever AddAdapter or
62 // RemoveAdapter gets called.
63 std::unique_ptr<Properties> properties_;
64
65 DISALLOW_COPY_AND_ASSIGN(FakeNfcManagerClient);
66 };
67
68 } // namespace chromeos
69
70 #endif // CHROMEOS_DBUS_FAKE_NFC_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_nfc_device_client.cc ('k') | chromeos/dbus/fake_nfc_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698