| OLD | NEW |
| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const std::string& network_id, | 69 const std::string& network_id, |
| 70 const base::Closure& callback, | 70 const base::Closure& callback, |
| 71 const ErrorCallback& error_callback) OVERRIDE; | 71 const ErrorCallback& error_callback) OVERRIDE; |
| 72 virtual void SetCarrier(const dbus::ObjectPath& device_path, | 72 virtual void SetCarrier(const dbus::ObjectPath& device_path, |
| 73 const std::string& carrier, | 73 const std::string& carrier, |
| 74 const base::Closure& callback, | 74 const base::Closure& callback, |
| 75 const ErrorCallback& error_callback) OVERRIDE; | 75 const ErrorCallback& error_callback) OVERRIDE; |
| 76 virtual void Reset(const dbus::ObjectPath& device_path, | 76 virtual void Reset(const dbus::ObjectPath& device_path, |
| 77 const base::Closure& callback, | 77 const base::Closure& callback, |
| 78 const ErrorCallback& error_callback) OVERRIDE; | 78 const ErrorCallback& error_callback) OVERRIDE; |
| 79 virtual void PerformTDLSOperation( |
| 80 const dbus::ObjectPath& device_path, |
| 81 const std::string& operation, |
| 82 const std::string& peer, |
| 83 const StringCallback& callback, |
| 84 const ErrorCallback& error_callback) OVERRIDE; |
| 85 |
| 79 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE; | 86 virtual ShillDeviceClient::TestInterface* GetTestInterface() OVERRIDE; |
| 80 | 87 |
| 81 // ShillDeviceClient::TestInterface overrides. | 88 // ShillDeviceClient::TestInterface overrides. |
| 82 virtual void AddDevice(const std::string& device_path, | 89 virtual void AddDevice(const std::string& device_path, |
| 83 const std::string& type, | 90 const std::string& type, |
| 84 const std::string& object_path) OVERRIDE; | 91 const std::string& object_path) OVERRIDE; |
| 85 virtual void RemoveDevice(const std::string& device_path) OVERRIDE; | 92 virtual void RemoveDevice(const std::string& device_path) OVERRIDE; |
| 86 virtual void ClearDevices() OVERRIDE; | 93 virtual void ClearDevices() OVERRIDE; |
| 87 virtual void SetDeviceProperty(const std::string& device_path, | 94 virtual void SetDeviceProperty(const std::string& device_path, |
| 88 const std::string& name, | 95 const std::string& name, |
| 89 const base::Value& value) OVERRIDE; | 96 const base::Value& value) OVERRIDE; |
| 90 virtual std::string GetDevicePathForType(const std::string& type) OVERRIDE; | 97 virtual std::string GetDevicePathForType(const std::string& type) OVERRIDE; |
| 91 | 98 |
| 99 void set_tdls_busy_count(int count) { tdls_busy_count_ = count; } |
| 100 |
| 92 private: | 101 private: |
| 93 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; | 102 typedef ObserverList<ShillPropertyChangedObserver> PropertyObserverList; |
| 94 | 103 |
| 95 void SetDefaultProperties(); | 104 void SetDefaultProperties(); |
| 96 void PassStubDeviceProperties(const dbus::ObjectPath& device_path, | 105 void PassStubDeviceProperties(const dbus::ObjectPath& device_path, |
| 97 const DictionaryValueCallback& callback) const; | 106 const DictionaryValueCallback& callback) const; |
| 98 | 107 |
| 99 // Posts a task to run a void callback with status code |status|. | 108 // Posts a task to run a void callback with status code |status|. |
| 100 void PostVoidCallback(const VoidDBusMethodCallback& callback, | 109 void PostVoidCallback(const VoidDBusMethodCallback& callback, |
| 101 DBusMethodCallStatus status); | 110 DBusMethodCallStatus status); |
| 102 | 111 |
| 103 void NotifyObserversPropertyChanged(const dbus::ObjectPath& device_path, | 112 void NotifyObserversPropertyChanged(const dbus::ObjectPath& device_path, |
| 104 const std::string& property); | 113 const std::string& property); |
| 105 base::DictionaryValue* GetDeviceProperties(const std::string& device_path); | 114 base::DictionaryValue* GetDeviceProperties(const std::string& device_path); |
| 106 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); | 115 PropertyObserverList& GetObserverList(const dbus::ObjectPath& device_path); |
| 107 | 116 |
| 108 // Dictionary of <device_name, Dictionary>. | 117 // Dictionary of <device_name, Dictionary>. |
| 109 base::DictionaryValue stub_devices_; | 118 base::DictionaryValue stub_devices_; |
| 110 // Observer list for each device. | 119 // Observer list for each device. |
| 111 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; | 120 std::map<dbus::ObjectPath, PropertyObserverList*> observer_list_; |
| 112 | 121 |
| 122 int tdls_busy_count_; // Number of times to return InProgress for TDLS. |
| 123 |
| 113 // 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 |
| 114 // invalidate its weak pointers before any other members are destroyed. | 125 // invalidate its weak pointers before any other members are destroyed. |
| 115 base::WeakPtrFactory<FakeShillDeviceClient> weak_ptr_factory_; | 126 base::WeakPtrFactory<FakeShillDeviceClient> weak_ptr_factory_; |
| 116 | 127 |
| 117 DISALLOW_COPY_AND_ASSIGN(FakeShillDeviceClient); | 128 DISALLOW_COPY_AND_ASSIGN(FakeShillDeviceClient); |
| 118 }; | 129 }; |
| 119 | 130 |
| 120 } // namespace chromeos | 131 } // namespace chromeos |
| 121 | 132 |
| 122 #endif // CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ | 133 #endif // CHROMEOS_DBUS_FAKE_SHILL_DEVICE_CLIENT_H_ |
| OLD | NEW |