| 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_profile_client.h" | 5 #include "chromeos/dbus/fake_shill_profile_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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const ErrorCallback& error_callback) { | 102 const ErrorCallback& error_callback) { |
| 103 ProfileProperties* profile = GetProfile(profile_path, error_callback); | 103 ProfileProperties* profile = GetProfile(profile_path, error_callback); |
| 104 if (!profile) | 104 if (!profile) |
| 105 return; | 105 return; |
| 106 | 106 |
| 107 if (!profile->entries.RemoveWithoutPathExpansion(entry_path, NULL)) { | 107 if (!profile->entries.RemoveWithoutPathExpansion(entry_path, NULL)) { |
| 108 error_callback.Run("Error.InvalidProfileEntry", entry_path); | 108 error_callback.Run("Error.InvalidProfileEntry", entry_path); |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 | 111 |
| 112 base::StringValue profile_path_value(""); | 112 base::Value profile_path_value(""); |
| 113 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> | 113 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> |
| 114 SetServiceProperty(entry_path, | 114 SetServiceProperty(entry_path, |
| 115 shill::kProfileProperty, | 115 shill::kProfileProperty, |
| 116 profile_path_value); | 116 profile_path_value); |
| 117 | 117 |
| 118 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 118 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 119 } | 119 } |
| 120 | 120 |
| 121 ShillProfileClient::TestInterface* FakeShillProfileClient::GetTestInterface() { | 121 ShillProfileClient::TestInterface* FakeShillProfileClient::GetTestInterface() { |
| 122 return this; | 122 return this; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 const base::DictionaryValue* service_properties = | 187 const base::DictionaryValue* service_properties = |
| 188 service_test->GetServiceProperties(service_path); | 188 service_test->GetServiceProperties(service_path); |
| 189 if (!service_properties) { | 189 if (!service_properties) { |
| 190 LOG(ERROR) << "No matching service: " << service_path; | 190 LOG(ERROR) << "No matching service: " << service_path; |
| 191 return false; | 191 return false; |
| 192 } | 192 } |
| 193 std::string service_profile_path; | 193 std::string service_profile_path; |
| 194 service_properties->GetStringWithoutPathExpansion(shill::kProfileProperty, | 194 service_properties->GetStringWithoutPathExpansion(shill::kProfileProperty, |
| 195 &service_profile_path); | 195 &service_profile_path); |
| 196 if (service_profile_path.empty()) { | 196 if (service_profile_path.empty()) { |
| 197 base::StringValue profile_path_value(profile_path); | 197 base::Value profile_path_value(profile_path); |
| 198 service_test->SetServiceProperty(service_path, | 198 service_test->SetServiceProperty(service_path, |
| 199 shill::kProfileProperty, | 199 shill::kProfileProperty, |
| 200 profile_path_value); | 200 profile_path_value); |
| 201 } else if (service_profile_path != profile_path) { | 201 } else if (service_profile_path != profile_path) { |
| 202 LOG(ERROR) << "Service has non matching profile path: " | 202 LOG(ERROR) << "Service has non matching profile path: " |
| 203 << service_profile_path; | 203 << service_profile_path; |
| 204 return false; | 204 return false; |
| 205 } | 205 } |
| 206 | 206 |
| 207 profile->entries.SetWithoutPathExpansion(service_path, | 207 profile->entries.SetWithoutPathExpansion(service_path, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (found == profiles_.end()) { | 244 if (found == profiles_.end()) { |
| 245 if (!error_callback.is_null()) | 245 if (!error_callback.is_null()) |
| 246 error_callback.Run("Error.InvalidProfile", "Invalid profile"); | 246 error_callback.Run("Error.InvalidProfile", "Invalid profile"); |
| 247 return nullptr; | 247 return nullptr; |
| 248 } | 248 } |
| 249 | 249 |
| 250 return found->second.get(); | 250 return found->second.get(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace chromeos | 253 } // namespace chromeos |
| OLD | NEW |