| 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 #include "chromeos/dbus/fake_shill_device_client.h" | 5 #include "chromeos/dbus/fake_shill_device_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void FakeShillDeviceClient::Reset(const dbus::ObjectPath& device_path, | 195 void FakeShillDeviceClient::Reset(const dbus::ObjectPath& device_path, |
| 196 const base::Closure& callback, | 196 const base::Closure& callback, |
| 197 const ErrorCallback& error_callback) { | 197 const ErrorCallback& error_callback) { |
| 198 if (!stub_devices_.HasKey(device_path.value())) { | 198 if (!stub_devices_.HasKey(device_path.value())) { |
| 199 PostDeviceNotFoundError(error_callback); | 199 PostDeviceNotFoundError(error_callback); |
| 200 return; | 200 return; |
| 201 } | 201 } |
| 202 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 202 base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void FakeShillDeviceClient::PerformTDLSOperation( |
| 206 const dbus::ObjectPath& device_path, |
| 207 const std::string& operation, |
| 208 const std::string& peer, |
| 209 const StringCallback& callback, |
| 210 const ErrorCallback& error_callback) { |
| 211 if (!stub_devices_.HasKey(device_path.value())) { |
| 212 PostDeviceNotFoundError(error_callback); |
| 213 return; |
| 214 } |
| 215 std::string result; |
| 216 if (operation == shill::kTDLSStatusOperation) |
| 217 result = shill::kTDLSConnectedState; |
| 218 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 219 base::Bind(callback, result)); |
| 220 } |
| 221 |
| 205 ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() { | 222 ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() { |
| 206 return this; | 223 return this; |
| 207 } | 224 } |
| 208 | 225 |
| 209 // ShillDeviceClient::TestInterface overrides. | 226 // ShillDeviceClient::TestInterface overrides. |
| 210 | 227 |
| 211 void FakeShillDeviceClient::AddDevice(const std::string& device_path, | 228 void FakeShillDeviceClient::AddDevice(const std::string& device_path, |
| 212 const std::string& type, | 229 const std::string& type, |
| 213 const std::string& object_path) { | 230 const std::string& object_path) { |
| 214 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 231 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = | 343 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = |
| 327 observer_list_.find(device_path); | 344 observer_list_.find(device_path); |
| 328 if (iter != observer_list_.end()) | 345 if (iter != observer_list_.end()) |
| 329 return *(iter->second); | 346 return *(iter->second); |
| 330 PropertyObserverList* observer_list = new PropertyObserverList(); | 347 PropertyObserverList* observer_list = new PropertyObserverList(); |
| 331 observer_list_[device_path] = observer_list; | 348 observer_list_[device_path] = observer_list; |
| 332 return *observer_list; | 349 return *observer_list; |
| 333 } | 350 } |
| 334 | 351 |
| 335 } // namespace chromeos | 352 } // namespace chromeos |
| OLD | NEW |