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

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

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim UpdateManagerProperties, feedback Created 6 years, 6 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 | Annotate | Revision Log
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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 void FakeShillProfileClient::AddEntry(const std::string& profile_path, 140 void FakeShillProfileClient::AddEntry(const std::string& profile_path,
141 const std::string& entry_path, 141 const std::string& entry_path,
142 const base::DictionaryValue& properties) { 142 const base::DictionaryValue& properties) {
143 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path), 143 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
144 ErrorCallback()); 144 ErrorCallback());
145 DCHECK(profile); 145 DCHECK(profile);
146 profile->entries.SetWithoutPathExpansion(entry_path, properties.DeepCopy()); 146 profile->entries.SetWithoutPathExpansion(entry_path, properties.DeepCopy());
147 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 147 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
148 AddManagerService(entry_path, false /* visible */); 148 AddManagerService(entry_path);
149 } 149 }
150 150
151 bool FakeShillProfileClient::AddService(const std::string& profile_path, 151 bool FakeShillProfileClient::AddService(const std::string& profile_path,
152 const std::string& service_path) { 152 const std::string& service_path) {
153 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path), 153 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
154 ErrorCallback()); 154 ErrorCallback());
155 if (!profile) { 155 if (!profile) {
156 LOG(ERROR) << "AddService: No matching profile: " << profile_path; 156 LOG(ERROR) << "AddService: No matching profile: " << profile_path
157 << " for: " << service_path;
157 return false; 158 return false;
158 } 159 }
159 if (profile->entries.HasKey(service_path)) { 160 if (profile->entries.HasKey(service_path))
160 LOG(ERROR) << "AddService: Profile: " << profile_path
161 << " already contains Service: " << service_path;
162 return false; 161 return false;
163 }
164 return AddOrUpdateServiceImpl(profile_path, service_path, profile); 162 return AddOrUpdateServiceImpl(profile_path, service_path, profile);
165 } 163 }
166 164
167 bool FakeShillProfileClient::UpdateService(const std::string& profile_path, 165 bool FakeShillProfileClient::UpdateService(const std::string& profile_path,
168 const std::string& service_path) { 166 const std::string& service_path) {
169 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path), 167 ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
170 ErrorCallback()); 168 ErrorCallback());
171 if (!profile) { 169 if (!profile) {
172 LOG(ERROR) << "UpdateService: No matching profile: " << profile_path; 170 LOG(ERROR) << "UpdateService: No matching profile: " << profile_path
171 << " for: " << service_path;
173 return false; 172 return false;
174 } 173 }
175 if (!profile->entries.HasKey(service_path)) { 174 if (!profile->entries.HasKey(service_path)) {
176 LOG(ERROR) << "UpdateService: Profile: " << profile_path 175 LOG(ERROR) << "UpdateService: Profile: " << profile_path
177 << " does not contain Service: " << service_path; 176 << " does not contain Service: " << service_path;
178 return false; 177 return false;
179 } 178 }
180 return AddOrUpdateServiceImpl(profile_path, service_path, profile); 179 return AddOrUpdateServiceImpl(profile_path, service_path, profile);
181 } 180 }
182 181
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (found == profiles_.end()) { 248 if (found == profiles_.end()) {
250 if (!error_callback.is_null()) 249 if (!error_callback.is_null())
251 error_callback.Run("Error.InvalidProfile", "Invalid profile"); 250 error_callback.Run("Error.InvalidProfile", "Invalid profile");
252 return NULL; 251 return NULL;
253 } 252 }
254 253
255 return found->second; 254 return found->second;
256 } 255 }
257 256
258 } // namespace chromeos 257 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698