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

Side by Side Diff: chromeos/dbus/shill_device_client_stub.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/dbus/shill_device_client.cc ('k') | chromeos/dbus/shill_device_client_stub.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_SHILL_DEVICE_CLIENT_STUB_H_
6 #define CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_STUB_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "chromeos/dbus/shill_device_client.h"
12
13 namespace chromeos {
14
15 // A stub implementation of ShillDeviceClient.
16 // Implemented: Stub cellular device for SMS testing.
17 class ShillDeviceClientStub : public ShillDeviceClient,
18 public ShillDeviceClient::TestInterface {
19 public:
20 ShillDeviceClientStub();
21 virtual ~ShillDeviceClientStub();
22
23 // ShillDeviceClient overrides
24 virtual void Init(dbus::Bus* bus) OVERRIDE;
25 virtual void AddPropertyChangedObserver(
26 const dbus::ObjectPath& device_path,
27 ShillPropertyChangedObserver* observer) OVERRIDE;
28 virtual void RemovePropertyChangedObserver(
29 const dbus::ObjectPath& device_path,
30 ShillPropertyChangedObserver* observer) OVERRIDE;
31 virtual void GetProperties(const dbus::ObjectPath& device_path,
32 const DictionaryValueCallback& callback) OVERRIDE;
33 virtual void ProposeScan(const dbus::ObjectPath& device_path,
34 const VoidDBusMethodCallback& callback) OVERRIDE;
35
36 virtual void SetProperty(const dbus::ObjectPath& device_path,
37 const std::string& name,
38 const base::Value& value,
39 const base::Closure& callback,
40 const ErrorCallback& error_callback) OVERRIDE;
41 virtual void ClearProperty(const dbus::ObjectPath& device_path,
42 const std::string& name,
43 const VoidDBusMethodCallback& callback) OVERRIDE;
44 virtual void AddIPConfig(
45 const dbus::ObjectPath& device_path,
46 const std::string& method,
47 const ObjectPathDBusMethodCallback& callback) OVERRIDE;
48 virtual void RequirePin(const dbus::ObjectPath& device_path,
49 const std::string& pin,
50 bool require,
51 const base::Closure& callback,
52 const ErrorCallback& error_callback) OVERRIDE;
53 virtual void EnterPin(const dbus::ObjectPath& device_path,
54 const std::string& pin,
55 const base::Closure& callback,
56 const ErrorCallback& error_callback) OVERRIDE;
57 virtual void UnblockPin(const dbus::ObjectPath& device_path,
58 const std::string& puk,
59 const std::string& pin,
60 const base::Closure& callback,
61 const ErrorCallback& error_callback) OVERRIDE;
62 virtual void ChangePin(const dbus::ObjectPath& device_path,
63 const std::string& old_pin,
64 const std::string& new_pin,
65 const base::Closure& callback,
66 const ErrorCallback& error_callback) OVERRIDE;
67 virtual void Register(const dbus::ObjectPath& device_path,
68 const std::string& network_id,
69 const base::Closure& callback,
70 const ErrorCallback& error_callback) OVERRIDE;
71 virtual void SetCarrier(const dbus::ObjectPath& device_path,
72 const std::string& carrier,
73 const base::Closure& callback,
74 const ErrorCallback& error_callback) OVERRIDE;
75 virtual void Reset(const dbus::ObjectPath& device_path,
76 const base::Closure& callback,
77 const ErrorCallback& error_callback) OVERRIDE;
78 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE;
79
80 // ShillDeviceClient::TestInterface overrides.
81 virtual void AddDevice(const std::string& device_path,
82 const std::string& type,
83 const std::string& object_path) OVERRIDE;
84 virtual void RemoveDevice(const std::string& device_path) OVERRIDE;
85 virtual void ClearDevices() OVERRIDE;
86 virtual void SetDeviceProperty(const std::string& device_path,
87 const std::string& name,
88 const base::Value& value) OVERRIDE;
89 virtual std::string GetDevicePathForType(const std::string& type) OVERRIDE;
90
91 private:
92 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList;
93
94 void SetDefaultProperties();
95 void PassStubDeviceProperties(const dbus::ObjectPath& device_path,
96 const DictionaryValueCallback& callback) const;
97
98 // Posts a task to run a void callback with status code |status|.
99 void PostVoidCallback(const VoidDBusMethodCallback& callback,
100 DBusMethodCallStatus status);
101
102 void NotifyObserversPropertyChanged(const dbus::ObjectPath& device_path,
103 const std::string& property);
104 base::DictionaryValue* GetDeviceProperties(const std::string& device_path);
105 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path);
106
107 // Dictionary of <device_name, Dictionary>.
108 base::DictionaryValue stub_devices_;
109 // Observer list for each device.
110 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_;
111
112 // Note: This should remain the last member so it'll be destroyed and
113 // invalidate its weak pointers before any other members are destroyed.
114 base::WeakPtrFactory<ShillDeviceClientStub> weak_ptr_factory_;
115
116 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClientStub);
117 };
118
119 } // namespace chromeos
120
121 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_STUB_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_device_client.cc ('k') | chromeos/dbus/shill_device_client_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698