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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 ShillServiceClient::TestInterface* FakeShillServiceClient::GetTestInterface() { | 301 ShillServiceClient::TestInterface* FakeShillServiceClient::GetTestInterface() { |
302 return this; | 302 return this; |
303 } | 303 } |
304 | 304 |
305 // ShillServiceClient::TestInterface overrides. | 305 // ShillServiceClient::TestInterface overrides. |
306 | 306 |
307 void FakeShillServiceClient::AddService(const std::string& service_path, | 307 void FakeShillServiceClient::AddService(const std::string& service_path, |
308 const std::string& name, | 308 const std::string& name, |
309 const std::string& type, | 309 const std::string& type, |
310 const std::string& state, | 310 const std::string& state, |
311 bool add_to_visible_list, | 311 bool add_to_visible_list) { |
312 bool add_to_watch_list) { | |
313 AddServiceWithIPConfig(service_path, "" /* guid */, name, | 312 AddServiceWithIPConfig(service_path, "" /* guid */, name, |
314 type, state, "" /* ipconfig_path */, | 313 type, state, "" /* ipconfig_path */, |
315 add_to_visible_list, add_to_watch_list); | 314 add_to_visible_list); |
316 } | 315 } |
317 | 316 |
318 void FakeShillServiceClient::AddServiceWithIPConfig( | 317 void FakeShillServiceClient::AddServiceWithIPConfig( |
319 const std::string& service_path, | 318 const std::string& service_path, |
320 const std::string& guid, | 319 const std::string& guid, |
321 const std::string& name, | 320 const std::string& name, |
322 const std::string& type, | 321 const std::string& type, |
323 const std::string& state, | 322 const std::string& state, |
324 const std::string& ipconfig_path, | 323 const std::string& ipconfig_path, |
325 bool add_to_visible_list, | 324 bool add_to_visible_list) { |
326 bool add_to_watch_list) { | |
327 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 325 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
328 AddManagerService(service_path, add_to_visible_list, add_to_watch_list); | 326 AddManagerService(service_path, add_to_visible_list); |
329 std::string device_path = | 327 std::string device_path = |
330 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> | 328 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
331 GetDevicePathForType(type); | 329 GetDevicePathForType(type); |
332 | 330 |
333 base::DictionaryValue* properties = | 331 base::DictionaryValue* properties = |
334 GetModifiableServiceProperties(service_path, true); | 332 GetModifiableServiceProperties(service_path, true); |
335 connect_behavior_.erase(service_path); | 333 connect_behavior_.erase(service_path); |
336 | 334 |
337 std::string profile_path; | 335 std::string profile_path; |
338 base::DictionaryValue profile_properties; | 336 base::DictionaryValue profile_properties; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 properties->SetWithoutPathExpansion( | 370 properties->SetWithoutPathExpansion( |
373 shill::kIPConfigProperty, | 371 shill::kIPConfigProperty, |
374 new base::StringValue(ipconfig_path)); | 372 new base::StringValue(ipconfig_path)); |
375 } | 373 } |
376 if (type == shill::kTypeWifi) { | 374 if (type == shill::kTypeWifi) { |
377 properties->SetWithoutPathExpansion( | 375 properties->SetWithoutPathExpansion( |
378 shill::kSecurityProperty, | 376 shill::kSecurityProperty, |
379 new base::StringValue(shill::kSecurityNone)); | 377 new base::StringValue(shill::kSecurityNone)); |
380 } | 378 } |
381 | 379 |
382 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 380 CallSortManagerServices(); |
383 SortManagerServices(); | |
384 | 381 |
385 if (!profile_path.empty()) { | 382 if (!profile_path.empty()) { |
386 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> | 383 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> |
387 UpdateService(profile_path, service_path); | 384 UpdateService(profile_path, service_path); |
388 } | 385 } |
389 } | 386 } |
390 | 387 |
391 void FakeShillServiceClient::RemoveService(const std::string& service_path) { | 388 void FakeShillServiceClient::RemoveService(const std::string& service_path) { |
392 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 389 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
393 RemoveManagerService(service_path, true); | 390 RemoveManagerService(service_path, true); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 base::StringValue(shill::kErrorBadPassphrase))); | 607 base::StringValue(shill::kErrorBadPassphrase))); |
611 } else { | 608 } else { |
612 // Set Online. | 609 // Set Online. |
613 SetServiceProperty(service_path, | 610 SetServiceProperty(service_path, |
614 shill::kStateProperty, | 611 shill::kStateProperty, |
615 base::StringValue(shill::kStateOnline)); | 612 base::StringValue(shill::kStateOnline)); |
616 } | 613 } |
617 } | 614 } |
618 | 615 |
619 } // namespace chromeos | 616 } // namespace chromeos |
OLD | NEW |