| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 void FakeShillServiceClient::CompleteCellularActivation( | 255 void FakeShillServiceClient::CompleteCellularActivation( |
| 256 const dbus::ObjectPath& service_path, | 256 const dbus::ObjectPath& service_path, |
| 257 const base::Closure& callback, | 257 const base::Closure& callback, |
| 258 const ErrorCallback& error_callback) { | 258 const ErrorCallback& error_callback) { |
| 259 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 259 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void FakeShillServiceClient::GetLoadableProfileEntries( | 262 void FakeShillServiceClient::GetLoadableProfileEntries( |
| 263 const dbus::ObjectPath& service_path, | 263 const dbus::ObjectPath& service_path, |
| 264 const DictionaryValueCallback& callback) { | 264 const DictionaryValueCallback& callback) { |
| 265 // Provide a dictionary with a single { profile_path, service_path } entry | 265 ShillProfileClient::TestInterface* profile_client = |
| 266 // if the Profile property is set, or an empty dictionary. | 266 DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface(); |
| 267 std::vector<std::string> profiles; |
| 268 profile_client->GetProfilePathsContainingService(service_path.value(), |
| 269 &profiles); |
| 270 |
| 271 // Provide a dictionary with {profile_path: service_path} entries for |
| 272 // profile_paths that contain the service. |
| 267 std::unique_ptr<base::DictionaryValue> result_properties( | 273 std::unique_ptr<base::DictionaryValue> result_properties( |
| 268 new base::DictionaryValue); | 274 new base::DictionaryValue); |
| 269 base::DictionaryValue* service_properties = | 275 for (const auto& profile : profiles) { |
| 270 GetModifiableServiceProperties(service_path.value(), false); | 276 result_properties->SetStringWithoutPathExpansion(profile, |
| 271 if (service_properties) { | 277 service_path.value()); |
| 272 std::string profile_path; | |
| 273 if (service_properties->GetStringWithoutPathExpansion( | |
| 274 shill::kProfileProperty, &profile_path)) { | |
| 275 result_properties->SetStringWithoutPathExpansion( | |
| 276 profile_path, service_path.value()); | |
| 277 } | |
| 278 } else { | |
| 279 LOG(WARNING) << "Service not in profile: " << service_path.value(); | |
| 280 } | 278 } |
| 281 | 279 |
| 282 DBusMethodCallStatus call_status = DBUS_METHOD_CALL_SUCCESS; | 280 DBusMethodCallStatus call_status = DBUS_METHOD_CALL_SUCCESS; |
| 283 base::ThreadTaskRunnerHandle::Get()->PostTask( | 281 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 284 FROM_HERE, base::Bind(&PassStubServiceProperties, callback, call_status, | 282 FROM_HERE, base::Bind(&PassStubServiceProperties, callback, call_status, |
| 285 base::Owned(result_properties.release()))); | 283 base::Owned(result_properties.release()))); |
| 286 } | 284 } |
| 287 | 285 |
| 288 ShillServiceClient::TestInterface* FakeShillServiceClient::GetTestInterface() { | 286 ShillServiceClient::TestInterface* FakeShillServiceClient::GetTestInterface() { |
| 289 return this; | 287 return this; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 base::Value(shill::kErrorBadPassphrase))); | 616 base::Value(shill::kErrorBadPassphrase))); |
| 619 } else { | 617 } else { |
| 620 // Set Online. | 618 // Set Online. |
| 621 VLOG(1) << "Setting state to Online " << service_path; | 619 VLOG(1) << "Setting state to Online " << service_path; |
| 622 SetServiceProperty(service_path, shill::kStateProperty, | 620 SetServiceProperty(service_path, shill::kStateProperty, |
| 623 base::Value(shill::kStateOnline)); | 621 base::Value(shill::kStateOnline)); |
| 624 } | 622 } |
| 625 } | 623 } |
| 626 | 624 |
| 627 } // namespace chromeos | 625 } // namespace chromeos |
| OLD | NEW |