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_service_client.h" | 5 #include "chromeos/dbus/fake_shill_service_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chromeos/chromeos_switches.h" | 14 #include "chromeos/chromeos_switches.h" |
15 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "chromeos/dbus/shill_device_client.h" |
16 #include "chromeos/dbus/shill_manager_client.h" | 17 #include "chromeos/dbus/shill_manager_client.h" |
17 #include "chromeos/dbus/shill_property_changed_observer.h" | 18 #include "chromeos/dbus/shill_property_changed_observer.h" |
18 #include "chromeos/dbus/shill_stub_helper.h" | 19 #include "chromeos/dbus/shill_stub_helper.h" |
19 #include "chromeos/network/shill_property_util.h" | 20 #include "chromeos/network/shill_property_util.h" |
20 #include "dbus/bus.h" | 21 #include "dbus/bus.h" |
21 #include "dbus/message.h" | 22 #include "dbus/message.h" |
22 #include "dbus/object_path.h" | 23 #include "dbus/object_path.h" |
23 #include "third_party/cros_system_api/dbus/service_constants.h" | 24 #include "third_party/cros_system_api/dbus/service_constants.h" |
24 | 25 |
25 namespace chromeos { | 26 namespace chromeos { |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void FakeShillServiceClient::AddServiceWithIPConfig( | 331 void FakeShillServiceClient::AddServiceWithIPConfig( |
331 const std::string& service_path, | 332 const std::string& service_path, |
332 const std::string& name, | 333 const std::string& name, |
333 const std::string& type, | 334 const std::string& type, |
334 const std::string& state, | 335 const std::string& state, |
335 const std::string& ipconfig_path, | 336 const std::string& ipconfig_path, |
336 bool add_to_visible_list, | 337 bool add_to_visible_list, |
337 bool add_to_watch_list) { | 338 bool add_to_watch_list) { |
338 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 339 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
339 AddManagerService(service_path, add_to_visible_list, add_to_watch_list); | 340 AddManagerService(service_path, add_to_visible_list, add_to_watch_list); |
| 341 std::string device_path = |
| 342 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
| 343 GetDevicePathForType(type); |
340 | 344 |
341 base::DictionaryValue* properties = | 345 base::DictionaryValue* properties = |
342 GetModifiableServiceProperties(service_path, true); | 346 GetModifiableServiceProperties(service_path, true); |
343 connect_behavior_.erase(service_path); | 347 connect_behavior_.erase(service_path); |
344 shill_property_util::SetSSID(name, properties); | 348 shill_property_util::SetSSID(name, properties); |
345 properties->SetWithoutPathExpansion( | 349 properties->SetWithoutPathExpansion( |
346 shill::kNameProperty, | 350 shill::kNameProperty, |
347 base::Value::CreateStringValue(name)); | 351 base::Value::CreateStringValue(name)); |
348 properties->SetWithoutPathExpansion( | 352 properties->SetWithoutPathExpansion( |
349 shill::kDeviceProperty, | 353 shill::kDeviceProperty, |
350 base::Value::CreateStringValue( | 354 base::Value::CreateStringValue(device_path)); |
351 shill_stub_helper::DevicePathForType(type))); | |
352 properties->SetWithoutPathExpansion( | 355 properties->SetWithoutPathExpansion( |
353 shill::kTypeProperty, | 356 shill::kTypeProperty, |
354 base::Value::CreateStringValue(type)); | 357 base::Value::CreateStringValue(type)); |
355 properties->SetWithoutPathExpansion( | 358 properties->SetWithoutPathExpansion( |
356 shill::kStateProperty, | 359 shill::kStateProperty, |
357 base::Value::CreateStringValue(state)); | 360 base::Value::CreateStringValue(state)); |
358 if (!ipconfig_path.empty()) | 361 if (!ipconfig_path.empty()) |
359 properties->SetWithoutPathExpansion( | 362 properties->SetWithoutPathExpansion( |
360 shill::kIPConfigProperty, | 363 shill::kIPConfigProperty, |
361 base::Value::CreateStringValue(ipconfig_path)); | 364 base::Value::CreateStringValue(ipconfig_path)); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 base::StringValue(shill::kErrorBadPassphrase))); | 558 base::StringValue(shill::kErrorBadPassphrase))); |
556 } else { | 559 } else { |
557 // Set Online. | 560 // Set Online. |
558 SetServiceProperty(service_path, | 561 SetServiceProperty(service_path, |
559 shill::kStateProperty, | 562 shill::kStateProperty, |
560 base::StringValue(shill::kStateOnline)); | 563 base::StringValue(shill::kStateOnline)); |
561 } | 564 } |
562 } | 565 } |
563 | 566 |
564 } // namespace chromeos | 567 } // namespace chromeos |
OLD | NEW |