Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chromeos/dbus/fake_shill_profile_client.cc

Issue 2843813002: Remove SetWithoutPathExpansion (Closed)
Patch Set: Fix CrOS Error Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/fake_shill_manager_client.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void FakeShillProfileClient::GetProperties( 57 void FakeShillProfileClient::GetProperties(
58 const dbus::ObjectPath& profile_path, 58 const dbus::ObjectPath& profile_path,
59 const DictionaryValueCallbackWithoutStatus& callback, 59 const DictionaryValueCallbackWithoutStatus& callback,
60 const ErrorCallback& error_callback) { 60 const ErrorCallback& error_callback) {
61 ProfileProperties* profile = GetProfile(profile_path, error_callback); 61 ProfileProperties* profile = GetProfile(profile_path, error_callback);
62 if (!profile) 62 if (!profile)
63 return; 63 return;
64 64
65 std::unique_ptr<base::DictionaryValue> properties( 65 std::unique_ptr<base::DictionaryValue> properties(
66 profile->properties.DeepCopy()); 66 profile->properties.DeepCopy());
67 base::ListValue* entry_paths = new base::ListValue; 67 base::ListValue* entry_paths = nullptr;
68 properties->SetWithoutPathExpansion(shill::kEntriesProperty, entry_paths); 68 properties->SetWithoutPathExpansion(shill::kEntriesProperty,
69 base::MakeUnique<base::ListValue>());
70 properties->GetListWithoutPathExpansion(shill::kEntriesProperty,
71 &entry_paths);
69 for (base::DictionaryValue::Iterator it(profile->entries); !it.IsAtEnd(); 72 for (base::DictionaryValue::Iterator it(profile->entries); !it.IsAtEnd();
70 it.Advance()) { 73 it.Advance()) {
71 entry_paths->AppendString(it.key()); 74 entry_paths->AppendString(it.key());
72 } 75 }
73 76
74 base::ThreadTaskRunnerHandle::Get()->PostTask( 77 base::ThreadTaskRunnerHandle::Get()->PostTask(
75 FROM_HERE, 78 FROM_HERE,
76 base::Bind(&PassDictionary, callback, base::Owned(properties.release()))); 79 base::Bind(&PassDictionary, callback, base::Owned(properties.release())));
77 } 80 }
78 81
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 145 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
143 AddProfile(profile_path); 146 AddProfile(profile_path);
144 } 147 }
145 148
146 void FakeShillProfileClient::AddEntry(const std::string& profile_path, 149 void FakeShillProfileClient::AddEntry(const std::string& profile_path,
147 const std::string& entry_path, 150 const std::string& entry_path,
148 const base::DictionaryValue& properties) { 151 const base::DictionaryValue& properties) {
149 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path), 152 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
150 ErrorCallback()); 153 ErrorCallback());
151 DCHECK(profile); 154 DCHECK(profile);
152 profile->entries.SetWithoutPathExpansion(entry_path, properties.DeepCopy()); 155 profile->entries.SetWithoutPathExpansion(entry_path,
156 properties.CreateDeepCopy());
153 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 157 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
154 AddManagerService(entry_path, true); 158 AddManagerService(entry_path, true);
155 } 159 }
156 160
157 bool FakeShillProfileClient::AddService(const std::string& profile_path, 161 bool FakeShillProfileClient::AddService(const std::string& profile_path,
158 const std::string& service_path) { 162 const std::string& service_path) {
159 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path), 163 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
160 ErrorCallback()); 164 ErrorCallback());
161 if (!profile) { 165 if (!profile) {
162 LOG(ERROR) << "AddService: No matching profile: " << profile_path 166 LOG(ERROR) << "AddService: No matching profile: " << profile_path
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::Value profile_path_value(profile_path); 208 base::Value profile_path_value(profile_path);
205 service_test->SetServiceProperty(service_path, 209 service_test->SetServiceProperty(service_path,
206 shill::kProfileProperty, 210 shill::kProfileProperty,
207 profile_path_value); 211 profile_path_value);
208 } else if (service_profile_path != profile_path) { 212 } else if (service_profile_path != profile_path) {
209 LOG(ERROR) << "Service has non matching profile path: " 213 LOG(ERROR) << "Service has non matching profile path: "
210 << service_profile_path; 214 << service_profile_path;
211 return false; 215 return false;
212 } 216 }
213 217
214 profile->entries.SetWithoutPathExpansion(service_path, 218 profile->entries.SetWithoutPathExpansion(
215 service_properties->DeepCopy()); 219 service_path, service_properties->CreateDeepCopy());
216 return true; 220 return true;
217 } 221 }
218 222
219 void FakeShillProfileClient::GetProfilePaths( 223 void FakeShillProfileClient::GetProfilePaths(
220 std::vector<std::string>* profiles) { 224 std::vector<std::string>* profiles) {
221 for (const auto& profile : profiles_) 225 for (const auto& profile : profiles_)
222 profiles->push_back(profile->path); 226 profiles->push_back(profile->path);
223 } 227 }
224 228
225 void FakeShillProfileClient::GetProfilePathsContainingService( 229 void FakeShillProfileClient::GetProfilePathsContainingService(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return false; 276 return false;
273 } 277 }
274 278
275 if (properties) 279 if (properties)
276 properties->MergeDictionary(entry); 280 properties->MergeDictionary(entry);
277 281
278 return true; 282 return true;
279 } 283 }
280 284
281 } // namespace chromeos 285 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_shill_manager_client.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698