Chromium Code Reviews| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 properties->SetWithoutPathExpansion( | 393 properties->SetWithoutPathExpansion( |
| 394 shill::kStateProperty, | 394 shill::kStateProperty, |
| 395 new base::StringValue(state)); | 395 new base::StringValue(state)); |
| 396 properties->SetWithoutPathExpansion( | 396 properties->SetWithoutPathExpansion( |
| 397 shill::kVisibleProperty, | 397 shill::kVisibleProperty, |
| 398 new base::FundamentalValue(visible)); | 398 new base::FundamentalValue(visible)); |
| 399 if (type == shill::kTypeWifi) { | 399 if (type == shill::kTypeWifi) { |
| 400 properties->SetWithoutPathExpansion( | 400 properties->SetWithoutPathExpansion( |
| 401 shill::kSecurityProperty, | 401 shill::kSecurityProperty, |
| 402 new base::StringValue(shill::kSecurityNone)); | 402 new base::StringValue(shill::kSecurityNone)); |
| 403 properties->SetWithoutPathExpansion( | |
| 404 shill::kModeProperty, | |
| 405 new base::StringValue(shill::kModeManaged)); | |
| 403 } | 406 } |
| 404 return properties; | 407 return properties; |
| 405 } | 408 } |
| 406 | 409 |
| 407 void FakeShillServiceClient::RemoveService(const std::string& service_path) { | 410 void FakeShillServiceClient::RemoveService(const std::string& service_path) { |
| 408 stub_services_.RemoveWithoutPathExpansion(service_path, NULL); | 411 stub_services_.RemoveWithoutPathExpansion(service_path, NULL); |
| 409 connect_behavior_.erase(service_path); | 412 connect_behavior_.erase(service_path); |
| 410 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 413 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
| 411 RemoveManagerService(service_path); | 414 RemoveManagerService(service_path); |
| 412 } | 415 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 434 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); | 437 new_properties.SetWithoutPathExpansion(shill::kProviderProperty, provider); |
| 435 changed_property = shill::kProviderProperty; | 438 changed_property = shill::kProviderProperty; |
| 436 } else { | 439 } else { |
| 437 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); | 440 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); |
| 438 changed_property = property; | 441 changed_property = property; |
| 439 } | 442 } |
| 440 | 443 |
| 441 dict->MergeDictionary(&new_properties); | 444 dict->MergeDictionary(&new_properties); |
| 442 | 445 |
| 443 // Add or update the profile entry. | 446 // Add or update the profile entry. |
| 447 ShillProfileClient::TestInterface* profile_test = | |
| 448 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); | |
| 444 if (property == shill::kProfileProperty) { | 449 if (property == shill::kProfileProperty) { |
| 445 std::string profile_path; | 450 std::string profile_path; |
| 446 if (value.GetAsString(&profile_path)) { | 451 if (value.GetAsString(&profile_path)) { |
| 447 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> | 452 if (!profile_path.empty()) |
| 448 AddService(profile_path, service_path); | 453 profile_test->AddService(profile_path, service_path); |
|
stevenjb
2014/10/20 16:15:35
If profile_path is set to empty, should we remove
pneubeck (no reviews)
2014/10/20 16:21:24
Not sure. Removing the profile path could also mea
| |
| 449 } else { | 454 } else { |
| 450 LOG(ERROR) << "Profile value is not a String!"; | 455 LOG(ERROR) << "Profile value is not a String!"; |
| 451 } | 456 } |
| 452 } else { | 457 } else { |
| 453 std::string profile_path; | 458 std::string profile_path; |
| 454 if (dict->GetStringWithoutPathExpansion( | 459 if (dict->GetStringWithoutPathExpansion( |
| 455 shill::kProfileProperty, &profile_path) && !profile_path.empty()) { | 460 shill::kProfileProperty, &profile_path) && !profile_path.empty()) { |
| 456 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface()-> | 461 profile_test->UpdateService(profile_path, service_path); |
| 457 UpdateService(profile_path, service_path); | |
| 458 } | 462 } |
| 459 } | 463 } |
| 460 | 464 |
| 461 // Notify the Manager if the state changed (affects DefaultService). | 465 // Notify the Manager if the state changed (affects DefaultService). |
| 462 if (property == shill::kStateProperty) { | 466 if (property == shill::kStateProperty) { |
| 463 std::string state; | 467 std::string state; |
| 464 value.GetAsString(&state); | 468 value.GetAsString(&state); |
| 465 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 469 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
| 466 ServiceStateChanged(service_path, state); | 470 ServiceStateChanged(service_path, state); |
| 467 } | 471 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 } else { | 632 } else { |
| 629 // Set Online. | 633 // Set Online. |
| 630 VLOG(1) << "Setting state to Online " << service_path; | 634 VLOG(1) << "Setting state to Online " << service_path; |
| 631 SetServiceProperty(service_path, | 635 SetServiceProperty(service_path, |
| 632 shill::kStateProperty, | 636 shill::kStateProperty, |
| 633 base::StringValue(shill::kStateOnline)); | 637 base::StringValue(shill::kStateOnline)); |
| 634 } | 638 } |
| 635 } | 639 } |
| 636 | 640 |
| 637 } // namespace chromeos | 641 } // namespace chromeos |
| OLD | NEW |