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

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

Issue 14069010: Call RequestScan periodically while the network list is open (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 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/shill_device_client_stub.h ('k') | chromeos/dbus/shill_manager_client_stub.h » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/shill_device_client_stub.h" 5 #include "chromeos/dbus/shill_device_client_stub.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void ShillDeviceClientStub::ClearDevices(){ 228 void ShillDeviceClientStub::ClearDevices(){
229 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 229 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
230 ClearDevices(); 230 ClearDevices();
231 231
232 stub_devices_.Clear(); 232 stub_devices_.Clear();
233 } 233 }
234 234
235 void ShillDeviceClientStub::SetDeviceProperty(const std::string& device_path, 235 void ShillDeviceClientStub::SetDeviceProperty(const std::string& device_path,
236 const std::string& name, 236 const std::string& name,
237 const base::Value& value){ 237 const base::Value& value){
238 VLOG(1) << "SetDeviceProperty: " << device_path
239 << ": " << name << " = " << value;
238 SetProperty(dbus::ObjectPath(device_path), name, value, 240 SetProperty(dbus::ObjectPath(device_path), name, value,
239 base::Bind(&base::DoNothing), 241 base::Bind(&base::DoNothing),
240 base::Bind(&ErrorFunction)); 242 base::Bind(&ErrorFunction));
241 } 243 }
242 244
245 std::string ShillDeviceClientStub::GetDevicePathForType(
246 const std::string& type) {
247 for (base::DictionaryValue::Iterator iter(stub_devices_);
248 !iter.IsAtEnd(); iter.Advance()) {
249 const base::DictionaryValue* properties = NULL;
250 if (!iter.value().GetAsDictionary(&properties))
251 continue;
252 std::string prop_type;
253 if (!properties->GetStringWithoutPathExpansion(
254 flimflam::kTypeProperty, &prop_type) ||
255 prop_type != type)
256 continue;
257 return iter.key();
258 }
259 return std::string();
260 }
261
243 void ShillDeviceClientStub::SetDefaultProperties() { 262 void ShillDeviceClientStub::SetDefaultProperties() {
244 // Add a wifi device. Note: path matches Manager entry. 263 // Add a wifi device. Note: path matches Manager entry.
245 AddDevice("stub_wifi_device1", flimflam::kTypeWifi, "/device/wifi1"); 264 AddDevice("stub_wifi_device1", flimflam::kTypeWifi, "/device/wifi1");
246 265
247 // Add a cellular device. Used in SMS stub. Note: path matches 266 // Add a cellular device. Used in SMS stub. Note: path matches
248 // Manager entry. 267 // Manager entry.
249 AddDevice("stub_cellular_device1", flimflam::kTypeCellular, 268 AddDevice("stub_cellular_device1", flimflam::kTypeCellular,
250 "/device/cellular1"); 269 "/device/cellular1");
251 } 270 }
252 271
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = 328 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter =
310 observer_list_.find(device_path); 329 observer_list_.find(device_path);
311 if (iter != observer_list_.end()) 330 if (iter != observer_list_.end())
312 return *(iter->second); 331 return *(iter->second);
313 PropertyObserverList* observer_list = new PropertyObserverList(); 332 PropertyObserverList* observer_list = new PropertyObserverList();
314 observer_list_[device_path] = observer_list; 333 observer_list_[device_path] = observer_list;
315 return *observer_list; 334 return *observer_list;
316 } 335 }
317 336
318 } // namespace chromeos 337 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_device_client_stub.h ('k') | chromeos/dbus/shill_manager_client_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698