OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_SHILL_MANAGER_CLIENT_STUB_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ |
6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ | 6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "chromeos/dbus/shill_manager_client.h" | 12 #include "chromeos/dbus/shill_manager_client.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 // A stub implementation of ShillManagerClient. | 16 // A stub implementation of ShillManagerClient. This works in close coordination |
17 // Implemented: Stub devices and services for NetworkStateManager tests. | 17 // with ShillServiceClientStub. ShillDeviceClientStub, and |
18 // Implemented: Stub cellular device entry for SMS tests. | 18 // ShillProfileClientStub, and is not intended to be used independently. |
19 class ShillManagerClientStub : public ShillManagerClient, | 19 class ShillManagerClientStub : public ShillManagerClient, |
20 public ShillManagerClient::TestInterface { | 20 public ShillManagerClient::TestInterface { |
21 public: | 21 public: |
22 ShillManagerClientStub(); | 22 ShillManagerClientStub(); |
23 virtual ~ShillManagerClientStub(); | 23 virtual ~ShillManagerClientStub(); |
24 | 24 |
25 // ShillManagerClient overrides. | 25 // ShillManagerClient overrides. |
26 virtual void AddPropertyChangedObserver( | 26 virtual void AddPropertyChangedObserver( |
27 ShillPropertyChangedObserver* observer) OVERRIDE; | 27 ShillPropertyChangedObserver* observer) OVERRIDE; |
28 virtual void RemovePropertyChangedObserver( | 28 virtual void RemovePropertyChangedObserver( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const VerificationProperties& properties, | 71 const VerificationProperties& properties, |
72 const std::string& data, | 72 const std::string& data, |
73 const StringCallback& callback, | 73 const StringCallback& callback, |
74 const ErrorCallback& error_callback) OVERRIDE; | 74 const ErrorCallback& error_callback) OVERRIDE; |
75 virtual void ConnectToBestServices( | 75 virtual void ConnectToBestServices( |
76 const base::Closure& callback, | 76 const base::Closure& callback, |
77 const ErrorCallback& error_callback) OVERRIDE; | 77 const ErrorCallback& error_callback) OVERRIDE; |
78 virtual ShillManagerClient::TestInterface* GetTestInterface() OVERRIDE; | 78 virtual ShillManagerClient::TestInterface* GetTestInterface() OVERRIDE; |
79 | 79 |
80 // ShillManagerClient::TestInterface overrides. | 80 // ShillManagerClient::TestInterface overrides. |
81 | |
82 virtual void AddDevice(const std::string& device_path) OVERRIDE; | 81 virtual void AddDevice(const std::string& device_path) OVERRIDE; |
83 virtual void RemoveDevice(const std::string& device_path) OVERRIDE; | 82 virtual void RemoveDevice(const std::string& device_path) OVERRIDE; |
84 virtual void ClearDevices() OVERRIDE; | 83 virtual void ClearDevices() OVERRIDE; |
85 virtual void ClearServices() OVERRIDE; | |
86 virtual void AddService(const std::string& service_path, | |
87 bool add_to_watch_list) OVERRIDE; | |
88 virtual void AddServiceAtIndex(const std::string& service_path, | |
89 size_t index, | |
90 bool add_to_watch_list) OVERRIDE; | |
91 virtual void RemoveService(const std::string& service_path) OVERRIDE; | |
92 virtual void AddTechnology(const std::string& type, bool enabled) OVERRIDE; | 84 virtual void AddTechnology(const std::string& type, bool enabled) OVERRIDE; |
93 virtual void RemoveTechnology(const std::string& type) OVERRIDE; | 85 virtual void RemoveTechnology(const std::string& type) OVERRIDE; |
94 virtual void SetTechnologyInitializing(const std::string& type, | 86 virtual void SetTechnologyInitializing(const std::string& type, |
95 bool initializing) OVERRIDE; | 87 bool initializing) OVERRIDE; |
96 virtual void AddGeoNetwork(const std::string& technology, | 88 virtual void AddGeoNetwork(const std::string& technology, |
97 const base::DictionaryValue& network) OVERRIDE; | 89 const base::DictionaryValue& network) OVERRIDE; |
98 virtual void ClearProperties() OVERRIDE; | 90 virtual void ClearProperties() OVERRIDE; |
| 91 virtual void MoveServiceToIndex(const std::string& service_path, |
| 92 size_t index, |
| 93 bool add_to_watch_list) OVERRIDE; |
| 94 virtual void AddManagerService(const std::string& service_path, |
| 95 bool add_to_watch_list) OVERRIDE; |
| 96 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE; |
| 97 virtual void ClearManagerServices() OVERRIDE; |
99 | 98 |
100 private: | 99 private: |
101 void AddServiceToWatchList(const std::string& service_path); | 100 void AddServiceToWatchList(const std::string& service_path); |
102 void SetDefaultProperties(); | 101 void SetDefaultProperties(); |
103 void PassStubProperties(const DictionaryValueCallback& callback) const; | 102 void PassStubProperties(const DictionaryValueCallback& callback) const; |
104 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; | 103 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; |
105 void CallNotifyObserversPropertyChanged(const std::string& property, | 104 void CallNotifyObserversPropertyChanged(const std::string& property, |
106 int delay_ms); | 105 int delay_ms); |
107 void NotifyObserversPropertyChanged(const std::string& property); | 106 void NotifyObserversPropertyChanged(const std::string& property); |
108 base::ListValue* GetListProperty(const std::string& property); | 107 base::ListValue* GetListProperty(const std::string& property); |
(...skipping 15 matching lines...) Expand all Loading... |
124 // Note: This should remain the last member so it'll be destroyed and | 123 // Note: This should remain the last member so it'll be destroyed and |
125 // invalidate its weak pointers before any other members are destroyed. | 124 // invalidate its weak pointers before any other members are destroyed. |
126 base::WeakPtrFactory<ShillManagerClientStub> weak_ptr_factory_; | 125 base::WeakPtrFactory<ShillManagerClientStub> weak_ptr_factory_; |
127 | 126 |
128 DISALLOW_COPY_AND_ASSIGN(ShillManagerClientStub); | 127 DISALLOW_COPY_AND_ASSIGN(ShillManagerClientStub); |
129 }; | 128 }; |
130 | 129 |
131 } // namespace chromeos | 130 } // namespace chromeos |
132 | 131 |
133 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ | 132 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ |
OLD | NEW |