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 AddProfile(const std::string& profile_path) OVERRIDE; | 90 virtual void AddProfile(const std::string& profile_path) OVERRIDE; |
99 virtual void ClearProperties() OVERRIDE; | 91 virtual void ClearProperties() OVERRIDE; |
| 92 virtual void MoveServiceToIndex(const std::string& service_path, |
| 93 size_t index, |
| 94 bool add_to_watch_list) OVERRIDE; |
| 95 virtual void AddManagerService(const std::string& service_path, |
| 96 bool add_to_watch_list) OVERRIDE; |
| 97 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE; |
| 98 virtual void ClearManagerServices() OVERRIDE; |
100 | 99 |
101 private: | 100 private: |
102 void AddServiceToWatchList(const std::string& service_path); | 101 void AddServiceToWatchList(const std::string& service_path); |
103 void SetDefaultProperties(); | 102 void SetDefaultProperties(); |
104 void PassStubProperties(const DictionaryValueCallback& callback) const; | 103 void PassStubProperties(const DictionaryValueCallback& callback) const; |
105 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; | 104 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; |
106 void CallNotifyObserversPropertyChanged(const std::string& property, | 105 void CallNotifyObserversPropertyChanged(const std::string& property, |
107 int delay_ms); | 106 int delay_ms); |
108 void NotifyObserversPropertyChanged(const std::string& property); | 107 void NotifyObserversPropertyChanged(const std::string& property); |
109 base::ListValue* GetListProperty(const std::string& property); | 108 base::ListValue* GetListProperty(const std::string& property); |
(...skipping 15 matching lines...) Expand all Loading... |
125 // Note: This should remain the last member so it'll be destroyed and | 124 // Note: This should remain the last member so it'll be destroyed and |
126 // invalidate its weak pointers before any other members are destroyed. | 125 // invalidate its weak pointers before any other members are destroyed. |
127 base::WeakPtrFactory<ShillManagerClientStub> weak_ptr_factory_; | 126 base::WeakPtrFactory<ShillManagerClientStub> weak_ptr_factory_; |
128 | 127 |
129 DISALLOW_COPY_AND_ASSIGN(ShillManagerClientStub); | 128 DISALLOW_COPY_AND_ASSIGN(ShillManagerClientStub); |
130 }; | 129 }; |
131 | 130 |
132 } // namespace chromeos | 131 } // namespace chromeos |
133 | 132 |
134 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ | 133 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ |
OLD | NEW |