| OLD | NEW |
| (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_MANAGER_CLIENT_STUB_H_ | |
| 6 #define CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | |
| 12 #include "chromeos/dbus/shill_manager_client.h" | |
| 13 | |
| 14 namespace chromeos { | |
| 15 | |
| 16 // A stub implementation of ShillManagerClient. This works in close coordination | |
| 17 // with ShillServiceClientStub. ShillDeviceClientStub, and | |
| 18 // ShillProfileClientStub, and is not intended to be used independently. | |
| 19 class ShillManagerClientStub : public ShillManagerClient, | |
| 20 public ShillManagerClient::TestInterface { | |
| 21 public: | |
| 22 ShillManagerClientStub(); | |
| 23 virtual ~ShillManagerClientStub(); | |
| 24 | |
| 25 // ShillManagerClient overrides | |
| 26 virtual void Init(dbus::Bus* bus) OVERRIDE; | |
| 27 virtual void AddPropertyChangedObserver( | |
| 28 ShillPropertyChangedObserver* observer) OVERRIDE; | |
| 29 virtual void RemovePropertyChangedObserver( | |
| 30 ShillPropertyChangedObserver* observer) OVERRIDE; | |
| 31 virtual void GetProperties(const DictionaryValueCallback& callback) OVERRIDE; | |
| 32 virtual void GetNetworksForGeolocation( | |
| 33 const DictionaryValueCallback& callback) OVERRIDE; | |
| 34 virtual void SetProperty(const std::string& name, | |
| 35 const base::Value& value, | |
| 36 const base::Closure& callback, | |
| 37 const ErrorCallback& error_callback) OVERRIDE; | |
| 38 virtual void RequestScan(const std::string& type, | |
| 39 const base::Closure& callback, | |
| 40 const ErrorCallback& error_callback) OVERRIDE; | |
| 41 virtual void EnableTechnology( | |
| 42 const std::string& type, | |
| 43 const base::Closure& callback, | |
| 44 const ErrorCallback& error_callback) OVERRIDE; | |
| 45 virtual void DisableTechnology( | |
| 46 const std::string& type, | |
| 47 const base::Closure& callback, | |
| 48 const ErrorCallback& error_callback) OVERRIDE; | |
| 49 virtual void ConfigureService( | |
| 50 const base::DictionaryValue& properties, | |
| 51 const ObjectPathCallback& callback, | |
| 52 const ErrorCallback& error_callback) OVERRIDE; | |
| 53 virtual void ConfigureServiceForProfile( | |
| 54 const dbus::ObjectPath& profile_path, | |
| 55 const base::DictionaryValue& properties, | |
| 56 const ObjectPathCallback& callback, | |
| 57 const ErrorCallback& error_callback) OVERRIDE; | |
| 58 virtual void GetService( | |
| 59 const base::DictionaryValue& properties, | |
| 60 const ObjectPathCallback& callback, | |
| 61 const ErrorCallback& error_callback) OVERRIDE; | |
| 62 virtual void VerifyDestination(const VerificationProperties& properties, | |
| 63 const BooleanCallback& callback, | |
| 64 const ErrorCallback& error_callback) OVERRIDE; | |
| 65 virtual void VerifyAndEncryptCredentials( | |
| 66 const VerificationProperties& properties, | |
| 67 const std::string& service_path, | |
| 68 const StringCallback& callback, | |
| 69 const ErrorCallback& error_callback) OVERRIDE; | |
| 70 virtual void VerifyAndEncryptData( | |
| 71 const VerificationProperties& properties, | |
| 72 const std::string& data, | |
| 73 const StringCallback& callback, | |
| 74 const ErrorCallback& error_callback) OVERRIDE; | |
| 75 virtual void ConnectToBestServices( | |
| 76 const base::Closure& callback, | |
| 77 const ErrorCallback& error_callback) OVERRIDE; | |
| 78 virtual ShillManagerClient::TestInterface* GetTestInterface() OVERRIDE; | |
| 79 | |
| 80 // ShillManagerClient::TestInterface overrides. | |
| 81 virtual void AddDevice(const std::string& device_path) OVERRIDE; | |
| 82 virtual void RemoveDevice(const std::string& device_path) OVERRIDE; | |
| 83 virtual void ClearDevices() OVERRIDE; | |
| 84 virtual void AddTechnology(const std::string& type, bool enabled) OVERRIDE; | |
| 85 virtual void RemoveTechnology(const std::string& type) OVERRIDE; | |
| 86 virtual void SetTechnologyInitializing(const std::string& type, | |
| 87 bool initializing) OVERRIDE; | |
| 88 virtual void AddGeoNetwork(const std::string& technology, | |
| 89 const base::DictionaryValue& network) OVERRIDE; | |
| 90 virtual void AddProfile(const std::string& profile_path) OVERRIDE; | |
| 91 virtual void ClearProperties() OVERRIDE; | |
| 92 virtual void AddManagerService(const std::string& service_path, | |
| 93 bool add_to_visible_list, | |
| 94 bool add_to_watch_list) OVERRIDE; | |
| 95 virtual void RemoveManagerService(const std::string& service_path) OVERRIDE; | |
| 96 virtual void ClearManagerServices() OVERRIDE; | |
| 97 virtual void SortManagerServices() OVERRIDE; | |
| 98 | |
| 99 private: | |
| 100 void AddServiceToWatchList(const std::string& service_path); | |
| 101 void SetDefaultProperties(); | |
| 102 void PassStubProperties(const DictionaryValueCallback& callback) const; | |
| 103 void PassStubGeoNetworks(const DictionaryValueCallback& callback) const; | |
| 104 void CallNotifyObserversPropertyChanged(const std::string& property, | |
| 105 int delay_ms); | |
| 106 void NotifyObserversPropertyChanged(const std::string& property); | |
| 107 base::ListValue* GetListProperty(const std::string& property); | |
| 108 bool TechnologyEnabled(const std::string& type) const; | |
| 109 void SetTechnologyEnabled(const std::string& type, | |
| 110 const base::Closure& callback, | |
| 111 bool enabled); | |
| 112 base::ListValue* GetEnabledServiceList(const std::string& property) const; | |
| 113 void ScanCompleted(const std::string& device_path, | |
| 114 const base::Closure& callback); | |
| 115 | |
| 116 // Dictionary of property name -> property value | |
| 117 base::DictionaryValue stub_properties_; | |
| 118 // Dictionary of technology -> list of property dictionaries | |
| 119 base::DictionaryValue stub_geo_networks_; | |
| 120 | |
| 121 ObserverList<ShillPropertyChangedObserver> observer_list_; | |
| 122 | |
| 123 // Note: This should remain the last member so it'll be destroyed and | |
| 124 // invalidate its weak pointers before any other members are destroyed. | |
| 125 base::WeakPtrFactory<ShillManagerClientStub> weak_ptr_factory_; | |
| 126 | |
| 127 DISALLOW_COPY_AND_ASSIGN(ShillManagerClientStub); | |
| 128 }; | |
| 129 | |
| 130 } // namespace chromeos | |
| 131 | |
| 132 #endif // CHROMEOS_DBUS_SHILL_MANAGER_CLIENT_STUB_H_ | |
| OLD | NEW |