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 #include "chromeos/dbus/shill_service_client_stub.h" | 5 #include "chromeos/dbus/shill_service_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return this; | 247 return this; |
248 } | 248 } |
249 | 249 |
250 // ShillServiceClient::TestInterface overrides. | 250 // ShillServiceClient::TestInterface overrides. |
251 | 251 |
252 void ShillServiceClientStub::AddService(const std::string& service_path, | 252 void ShillServiceClientStub::AddService(const std::string& service_path, |
253 const std::string& name, | 253 const std::string& name, |
254 const std::string& type, | 254 const std::string& type, |
255 const std::string& state, | 255 const std::string& state, |
256 bool add_to_watch_list) { | 256 bool add_to_watch_list) { |
| 257 AddServiceWithIPConfig(service_path, name, type, state, "", |
| 258 add_to_watch_list); |
| 259 } |
| 260 |
| 261 void ShillServiceClientStub::AddServiceWithIPConfig( |
| 262 const std::string& service_path, |
| 263 const std::string& name, |
| 264 const std::string& type, |
| 265 const std::string& state, |
| 266 const std::string& ipconfig_path, |
| 267 bool add_to_watch_list) { |
257 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 268 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
258 AddService(service_path, add_to_watch_list); | 269 AddService(service_path, add_to_watch_list); |
259 | 270 |
260 base::DictionaryValue* properties = | 271 base::DictionaryValue* properties = |
261 GetModifiableServiceProperties(service_path); | 272 GetModifiableServiceProperties(service_path); |
262 properties->SetWithoutPathExpansion( | 273 properties->SetWithoutPathExpansion( |
263 flimflam::kSSIDProperty, | 274 flimflam::kSSIDProperty, |
264 base::Value::CreateStringValue(service_path)); | 275 base::Value::CreateStringValue(service_path)); |
265 properties->SetWithoutPathExpansion( | 276 properties->SetWithoutPathExpansion( |
266 flimflam::kNameProperty, | 277 flimflam::kNameProperty, |
267 base::Value::CreateStringValue(name)); | 278 base::Value::CreateStringValue(name)); |
268 properties->SetWithoutPathExpansion( | 279 properties->SetWithoutPathExpansion( |
269 flimflam::kTypeProperty, | 280 flimflam::kTypeProperty, |
270 base::Value::CreateStringValue(type)); | 281 base::Value::CreateStringValue(type)); |
271 properties->SetWithoutPathExpansion( | 282 properties->SetWithoutPathExpansion( |
272 flimflam::kStateProperty, | 283 flimflam::kStateProperty, |
273 base::Value::CreateStringValue(state)); | 284 base::Value::CreateStringValue(state)); |
| 285 if (!ipconfig_path.empty()) |
| 286 properties->SetWithoutPathExpansion( |
| 287 shill::kIPConfigProperty, |
| 288 base::Value::CreateStringValue(ipconfig_path)); |
274 } | 289 } |
275 | 290 |
276 void ShillServiceClientStub::RemoveService(const std::string& service_path) { | 291 void ShillServiceClientStub::RemoveService(const std::string& service_path) { |
277 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 292 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
278 RemoveService(service_path); | 293 RemoveService(service_path); |
279 | 294 |
280 stub_services_.RemoveWithoutPathExpansion(service_path, NULL); | 295 stub_services_.RemoveWithoutPathExpansion(service_path, NULL); |
281 } | 296 } |
282 | 297 |
283 void ShillServiceClientStub::SetServiceProperty(const std::string& service_path, | 298 void ShillServiceClientStub::SetServiceProperty(const std::string& service_path, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = | 423 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = |
409 observer_list_.find(device_path); | 424 observer_list_.find(device_path); |
410 if (iter != observer_list_.end()) | 425 if (iter != observer_list_.end()) |
411 return *(iter->second); | 426 return *(iter->second); |
412 PropertyObserverList* observer_list = new PropertyObserverList(); | 427 PropertyObserverList* observer_list = new PropertyObserverList(); |
413 observer_list_[device_path] = observer_list; | 428 observer_list_[device_path] = observer_list; |
414 return *observer_list; | 429 return *observer_list; |
415 } | 430 } |
416 | 431 |
417 } // namespace chromeos | 432 } // namespace chromeos |
OLD | NEW |