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_manager_client.h" | 5 #include "chromeos/dbus/fake_shill_manager_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 void FakeShillManagerClient::AddGeoNetwork( | 451 void FakeShillManagerClient::AddGeoNetwork( |
452 const std::string& technology, | 452 const std::string& technology, |
453 const base::DictionaryValue& network) { | 453 const base::DictionaryValue& network) { |
454 base::ListValue* list_value = NULL; | 454 base::ListValue* list_value = NULL; |
455 if (!stub_geo_networks_.GetListWithoutPathExpansion(technology, | 455 if (!stub_geo_networks_.GetListWithoutPathExpansion(technology, |
456 &list_value)) { | 456 &list_value)) { |
457 list_value = new base::ListValue; | 457 list_value = new base::ListValue; |
458 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); | 458 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); |
459 } | 459 } |
460 list_value->Append(network.DeepCopy()); | 460 list_value->Append(network.CreateDeepCopy()); |
461 } | 461 } |
462 | 462 |
463 void FakeShillManagerClient::AddProfile(const std::string& profile_path) { | 463 void FakeShillManagerClient::AddProfile(const std::string& profile_path) { |
464 const char* key = shill::kProfilesProperty; | 464 const char* key = shill::kProfilesProperty; |
465 if (GetListProperty(key)->AppendIfNotPresent( | 465 if (GetListProperty(key)->AppendIfNotPresent( |
466 base::MakeUnique<base::StringValue>(profile_path))) { | 466 base::MakeUnique<base::StringValue>(profile_path))) { |
467 CallNotifyObserversPropertyChanged(key); | 467 CallNotifyObserversPropertyChanged(key); |
468 } | 468 } |
469 } | 469 } |
470 | 470 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 "Localized Test APN"); | 860 "Localized Test APN"); |
861 apn.SetStringWithoutPathExpansion(shill::kApnUsernameProperty, "User1"); | 861 apn.SetStringWithoutPathExpansion(shill::kApnUsernameProperty, "User1"); |
862 apn.SetStringWithoutPathExpansion(shill::kApnPasswordProperty, "password"); | 862 apn.SetStringWithoutPathExpansion(shill::kApnPasswordProperty, "password"); |
863 base::DictionaryValue apn2; | 863 base::DictionaryValue apn2; |
864 apn2.SetStringWithoutPathExpansion(shill::kApnProperty, "testapn2"); | 864 apn2.SetStringWithoutPathExpansion(shill::kApnProperty, "testapn2"); |
865 services->SetServiceProperty(kCellularServicePath, | 865 services->SetServiceProperty(kCellularServicePath, |
866 shill::kCellularApnProperty, apn); | 866 shill::kCellularApnProperty, apn); |
867 services->SetServiceProperty(kCellularServicePath, | 867 services->SetServiceProperty(kCellularServicePath, |
868 shill::kCellularLastGoodApnProperty, apn); | 868 shill::kCellularLastGoodApnProperty, apn); |
869 base::ListValue apn_list; | 869 base::ListValue apn_list; |
870 apn_list.Append(apn.DeepCopy()); | 870 apn_list.Append(apn.CreateDeepCopy()); |
871 apn_list.Append(apn2.DeepCopy()); | 871 apn_list.Append(apn2.CreateDeepCopy()); |
872 devices->SetDeviceProperty("/device/cellular1", | 872 devices->SetDeviceProperty("/device/cellular1", |
873 shill::kCellularApnListProperty, apn_list); | 873 shill::kCellularApnListProperty, apn_list); |
874 | 874 |
875 profiles->AddService(shared_profile, kCellularServicePath); | 875 profiles->AddService(shared_profile, kCellularServicePath); |
876 } | 876 } |
877 | 877 |
878 // VPN | 878 // VPN |
879 state = GetInitialStateForType(shill::kTypeVPN, &enabled); | 879 state = GetInitialStateForType(shill::kTypeVPN, &enabled); |
880 if (state != kTechnologyUnavailable) { | 880 if (state != kTechnologyUnavailable) { |
881 // Set the "Provider" dictionary properties. Note: when setting these in | 881 // Set the "Provider" dictionary properties. Note: when setting these in |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 continue; | 1034 continue; |
1035 const base::DictionaryValue* properties = | 1035 const base::DictionaryValue* properties = |
1036 service_client->GetServiceProperties(service_path); | 1036 service_client->GetServiceProperties(service_path); |
1037 if (!properties) { | 1037 if (!properties) { |
1038 LOG(ERROR) << "Properties not found for service: " << service_path; | 1038 LOG(ERROR) << "Properties not found for service: " << service_path; |
1039 continue; | 1039 continue; |
1040 } | 1040 } |
1041 std::string type; | 1041 std::string type; |
1042 properties->GetString(shill::kTypeProperty, &type); | 1042 properties->GetString(shill::kTypeProperty, &type); |
1043 if (TechnologyEnabled(type)) | 1043 if (TechnologyEnabled(type)) |
1044 new_service_list->Append((*iter)->DeepCopy()); | 1044 new_service_list->Append((*iter)->CreateDeepCopy()); |
1045 } | 1045 } |
1046 } | 1046 } |
1047 return new_service_list; | 1047 return new_service_list; |
1048 } | 1048 } |
1049 | 1049 |
1050 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, | 1050 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, |
1051 const base::Closure& callback) { | 1051 const base::Closure& callback) { |
1052 if (!device_path.empty()) { | 1052 if (!device_path.empty()) { |
1053 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> | 1053 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
1054 SetDeviceProperty(device_path, | 1054 SetDeviceProperty(device_path, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1230 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
1231 result = shill::kStateIdle; | 1231 result = shill::kStateIdle; |
1232 } | 1232 } |
1233 } | 1233 } |
1234 VLOG(1) << "Initial state for: " << type << " = " << result | 1234 VLOG(1) << "Initial state for: " << type << " = " << result |
1235 << " Enabled: " << *enabled; | 1235 << " Enabled: " << *enabled; |
1236 return result; | 1236 return result; |
1237 } | 1237 } |
1238 | 1238 |
1239 } // namespace chromeos | 1239 } // namespace chromeos |
OLD | NEW |