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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const char* match_type, | 60 const char* match_type, |
61 bool technology_enabled, | 61 bool technology_enabled, |
62 std::vector<std::string>* active_service_list_out, | 62 std::vector<std::string>* active_service_list_out, |
63 std::vector<std::string>* inactive_service_list_out, | 63 std::vector<std::string>* inactive_service_list_out, |
64 std::vector<std::string>* disabled_service_list_out) { | 64 std::vector<std::string>* disabled_service_list_out) { |
65 ShillServiceClient::TestInterface* service_client = | 65 ShillServiceClient::TestInterface* service_client = |
66 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 66 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
67 for (base::ListValue::const_iterator iter = service_list_in->begin(); | 67 for (base::ListValue::const_iterator iter = service_list_in->begin(); |
68 iter != service_list_in->end(); ++iter) { | 68 iter != service_list_in->end(); ++iter) { |
69 std::string service_path; | 69 std::string service_path; |
70 if (!iter->GetAsString(&service_path)) | 70 if (!(*iter)->GetAsString(&service_path)) |
71 continue; | 71 continue; |
72 const base::DictionaryValue* properties = | 72 const base::DictionaryValue* properties = |
73 service_client->GetServiceProperties(service_path); | 73 service_client->GetServiceProperties(service_path); |
74 if (!properties) { | 74 if (!properties) { |
75 LOG(ERROR) << "Properties not found for service: " << service_path; | 75 LOG(ERROR) << "Properties not found for service: " << service_path; |
76 continue; | 76 continue; |
77 } | 77 } |
78 std::string type; | 78 std::string type; |
79 properties->GetString(shill::kTypeProperty, &type); | 79 properties->GetString(shill::kTypeProperty, &type); |
80 if (type != match_type) | 80 if (type != match_type) |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 base::ListValue* FakeShillManagerClient::GetEnabledServiceList( | 1020 base::ListValue* FakeShillManagerClient::GetEnabledServiceList( |
1021 const std::string& property) const { | 1021 const std::string& property) const { |
1022 base::ListValue* new_service_list = new base::ListValue; | 1022 base::ListValue* new_service_list = new base::ListValue; |
1023 const base::ListValue* service_list; | 1023 const base::ListValue* service_list; |
1024 if (stub_properties_.GetListWithoutPathExpansion(property, &service_list)) { | 1024 if (stub_properties_.GetListWithoutPathExpansion(property, &service_list)) { |
1025 ShillServiceClient::TestInterface* service_client = | 1025 ShillServiceClient::TestInterface* service_client = |
1026 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | 1026 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); |
1027 for (base::ListValue::const_iterator iter = service_list->begin(); | 1027 for (base::ListValue::const_iterator iter = service_list->begin(); |
1028 iter != service_list->end(); ++iter) { | 1028 iter != service_list->end(); ++iter) { |
1029 std::string service_path; | 1029 std::string service_path; |
1030 if (!iter->GetAsString(&service_path)) | 1030 if (!(*iter)->GetAsString(&service_path)) |
1031 continue; | 1031 continue; |
1032 const base::DictionaryValue* properties = | 1032 const base::DictionaryValue* properties = |
1033 service_client->GetServiceProperties(service_path); | 1033 service_client->GetServiceProperties(service_path); |
1034 if (!properties) { | 1034 if (!properties) { |
1035 LOG(ERROR) << "Properties not found for service: " << service_path; | 1035 LOG(ERROR) << "Properties not found for service: " << service_path; |
1036 continue; | 1036 continue; |
1037 } | 1037 } |
1038 std::string type; | 1038 std::string type; |
1039 properties->GetString(shill::kTypeProperty, &type); | 1039 properties->GetString(shill::kTypeProperty, &type); |
1040 if (TechnologyEnabled(type)) | 1040 if (TechnologyEnabled(type)) |
1041 new_service_list->Append(iter->CreateDeepCopy()); | 1041 new_service_list->Append((*iter)->CreateDeepCopy()); |
1042 } | 1042 } |
1043 } | 1043 } |
1044 return new_service_list; | 1044 return new_service_list; |
1045 } | 1045 } |
1046 | 1046 |
1047 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, | 1047 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, |
1048 const base::Closure& callback) { | 1048 const base::Closure& callback) { |
1049 if (!device_path.empty()) { | 1049 if (!device_path.empty()) { |
1050 DBusThreadManager::Get() | 1050 DBusThreadManager::Get() |
1051 ->GetShillDeviceClient() | 1051 ->GetShillDeviceClient() |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1228 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
1229 result = shill::kStateIdle; | 1229 result = shill::kStateIdle; |
1230 } | 1230 } |
1231 } | 1231 } |
1232 VLOG(1) << "Initial state for: " << type << " = " << result | 1232 VLOG(1) << "Initial state for: " << type << " = " << result |
1233 << " Enabled: " << *enabled; | 1233 << " Enabled: " << *enabled; |
1234 return result; | 1234 return result; |
1235 } | 1235 } |
1236 | 1236 |
1237 } // namespace chromeos | 1237 } // namespace chromeos |
OLD | NEW |