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

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

Issue 31513002: dbus: Remove MockShillDeviceClient and MockShillIPConfigClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the build Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/fake_shill_device_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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_
7 7
8 #include "base/callback_forward.h" 8 #include <string>
9 #include "base/values.h" 9
10 #include "base/basictypes.h"
11 #include "chromeos/chromeos_export.h"
10 #include "chromeos/dbus/shill_device_client.h" 12 #include "chromeos/dbus/shill_device_client.h"
11 #include "chromeos/dbus/shill_property_changed_observer.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 15
15 // A fake implementation of ShillDeviceClient. This class does nothing. 16 // A fake implementation of ShillDeviceClient.
16 class FakeShillDeviceClient : public ShillDeviceClient { 17 // Implemented: Stub cellular device for SMS testing.
18 class CHROMEOS_EXPORT FakeShillDeviceClient
19 : public ShillDeviceClient,
20 public ShillDeviceClient::TestInterface {
17 public: 21 public:
18 FakeShillDeviceClient(); 22 FakeShillDeviceClient();
19 virtual ~FakeShillDeviceClient(); 23 virtual ~FakeShillDeviceClient();
20 24
21 // ShillDeviceClient overrides 25 // ShillDeviceClient overrides
22 virtual void Init(dbus::Bus* bus) OVERRIDE; 26 virtual void Init(dbus::Bus* bus) OVERRIDE;
23 virtual void AddPropertyChangedObserver( 27 virtual void AddPropertyChangedObserver(
24 const dbus::ObjectPath& device_path, 28 const dbus::ObjectPath& device_path,
25 ShillPropertyChangedObserver* observer) OVERRIDE; 29 ShillPropertyChangedObserver* observer) OVERRIDE;
26 virtual void RemovePropertyChangedObserver( 30 virtual void RemovePropertyChangedObserver(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 const std::string& network_id, 69 const std::string& network_id,
66 const base::Closure& callback, 70 const base::Closure& callback,
67 const ErrorCallback& error_callback) OVERRIDE; 71 const ErrorCallback& error_callback) OVERRIDE;
68 virtual void SetCarrier(const dbus::ObjectPath& device_path, 72 virtual void SetCarrier(const dbus::ObjectPath& device_path,
69 const std::string& carrier, 73 const std::string& carrier,
70 const base::Closure& callback, 74 const base::Closure& callback,
71 const ErrorCallback& error_callback) OVERRIDE; 75 const ErrorCallback& error_callback) OVERRIDE;
72 virtual void Reset(const dbus::ObjectPath& device_path, 76 virtual void Reset(const dbus::ObjectPath& device_path,
73 const base::Closure& callback, 77 const base::Closure& callback,
74 const ErrorCallback& error_callback) OVERRIDE; 78 const ErrorCallback& error_callback) OVERRIDE;
75 virtual TestInterface* GetTestInterface() OVERRIDE; 79 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE;
80
81 // ShillDeviceClient::TestInterface overrides.
82 virtual void AddDevice(const std::string& device_path,
83 const std::string& type,
84 const std::string& object_path) OVERRIDE;
85 virtual void RemoveDevice(const std::string& device_path) OVERRIDE;
86 virtual void ClearDevices() OVERRIDE;
87 virtual void SetDeviceProperty(const std::string& device_path,
88 const std::string& name,
89 const base::Value& value) OVERRIDE;
90 virtual std::string GetDevicePathForType(const std::string& type) OVERRIDE;
76 91
77 private: 92 private:
93 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList;
94
95 void SetDefaultProperties();
96 void PassStubDeviceProperties(const dbus::ObjectPath& device_path,
97 const DictionaryValueCallback& callback) const;
98
99 // Posts a task to run a void callback with status code |status|.
100 void PostVoidCallback(const VoidDBusMethodCallback& callback,
101 DBusMethodCallStatus status);
102
103 void NotifyObserversPropertyChanged(const dbus::ObjectPath& device_path,
104 const std::string& property);
105 base::DictionaryValue* GetDeviceProperties(const std::string& device_path);
106 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path);
107
108 // Dictionary of <device_name, Dictionary>.
109 base::DictionaryValue stub_devices_;
110 // Observer list for each device.
111 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_;
112
113 // Note: This should remain the last member so it'll be destroyed and
114 // invalidate its weak pointers before any other members are destroyed.
115 base::WeakPtrFactory<FakeShillDeviceClient> weak_ptr_factory_;
116
78 DISALLOW_COPY_AND_ASSIGN(FakeShillDeviceClient); 117 DISALLOW_COPY_AND_ASSIGN(FakeShillDeviceClient);
79 }; 118 };
80 119
81 } // namespace chromeos 120 } // namespace chromeos
82 121
83 #endif // CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ 122 #endif // CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/fake_shill_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698