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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 } | 302 } |
303 | 303 |
304 // ShillServiceClient::TestInterface overrides. | 304 // ShillServiceClient::TestInterface overrides. |
305 | 305 |
306 void FakeShillServiceClient::AddService(const std::string& service_path, | 306 void FakeShillServiceClient::AddService(const std::string& service_path, |
307 const std::string& name, | 307 const std::string& name, |
308 const std::string& type, | 308 const std::string& type, |
309 const std::string& state, | 309 const std::string& state, |
310 bool add_to_visible_list, | 310 bool add_to_visible_list, |
311 bool add_to_watch_list) { | 311 bool add_to_watch_list) { |
312 AddServiceWithIPConfig(service_path, name, type, state, "", | 312 AddServiceWithIPConfig(service_path, "" /* guid */, name, |
313 type, state, "" /* ipconfig_path */, | |
313 add_to_visible_list, add_to_watch_list); | 314 add_to_visible_list, add_to_watch_list); |
314 } | 315 } |
315 | 316 |
316 void FakeShillServiceClient::AddServiceWithIPConfig( | 317 void FakeShillServiceClient::AddServiceWithIPConfig( |
317 const std::string& service_path, | 318 const std::string& service_path, |
319 const std::string& guid, | |
318 const std::string& name, | 320 const std::string& name, |
319 const std::string& type, | 321 const std::string& type, |
320 const std::string& state, | 322 const std::string& state, |
321 const std::string& ipconfig_path, | 323 const std::string& ipconfig_path, |
322 bool add_to_visible_list, | 324 bool add_to_visible_list, |
323 bool add_to_watch_list) { | 325 bool add_to_watch_list) { |
324 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 326 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
325 AddManagerService(service_path, add_to_visible_list, add_to_watch_list); | 327 AddManagerService(service_path, add_to_visible_list, add_to_watch_list); |
326 std::string device_path = | 328 std::string device_path = |
327 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> | 329 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
328 GetDevicePathForType(type); | 330 GetDevicePathForType(type); |
329 | 331 |
330 base::DictionaryValue* properties = | 332 base::DictionaryValue* properties = |
331 GetModifiableServiceProperties(service_path, true); | 333 GetModifiableServiceProperties(service_path, true); |
332 connect_behavior_.erase(service_path); | 334 connect_behavior_.erase(service_path); |
335 if (!guid.empty()) { | |
336 // If |guid| is not provided, leave it blank. Shill does not enforce a | |
337 // valid guid, we do that at the NetworkStateHandler layer. | |
338 properties->SetWithoutPathExpansion( | |
339 shill::kGuidProperty, | |
340 base::Value::CreateStringValue(guid)); | |
pneubeck (no reviews)
2014/05/12 13:37:07
optional nit: CreateStringValue is deprecated, use
stevenjb
2014/05/13 01:19:00
Fixed throughout this file (not too many).
| |
341 } | |
333 shill_property_util::SetSSID(name, properties); | 342 shill_property_util::SetSSID(name, properties); |
334 properties->SetWithoutPathExpansion( | 343 properties->SetWithoutPathExpansion( |
335 shill::kNameProperty, | 344 shill::kNameProperty, |
336 base::Value::CreateStringValue(name)); | 345 base::Value::CreateStringValue(name)); |
337 properties->SetWithoutPathExpansion( | 346 properties->SetWithoutPathExpansion( |
338 shill::kDeviceProperty, | 347 shill::kDeviceProperty, |
339 base::Value::CreateStringValue(device_path)); | 348 base::Value::CreateStringValue(device_path)); |
340 properties->SetWithoutPathExpansion( | 349 properties->SetWithoutPathExpansion( |
341 shill::kTypeProperty, | 350 shill::kTypeProperty, |
342 base::Value::CreateStringValue(type)); | 351 base::Value::CreateStringValue(type)); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 base::StringValue(shill::kErrorBadPassphrase))); | 566 base::StringValue(shill::kErrorBadPassphrase))); |
558 } else { | 567 } else { |
559 // Set Online. | 568 // Set Online. |
560 SetServiceProperty(service_path, | 569 SetServiceProperty(service_path, |
561 shill::kStateProperty, | 570 shill::kStateProperty, |
562 base::StringValue(shill::kStateOnline)); | 571 base::StringValue(shill::kStateOnline)); |
563 } | 572 } |
564 } | 573 } |
565 | 574 |
566 } // namespace chromeos | 575 } // namespace chromeos |
OLD | NEW |