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

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

Issue 299403012: Clean up shill fake implementations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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_device_client.h" 5 #include "chromeos/dbus/fake_shill_device_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() { 232 ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() {
233 return this; 233 return this;
234 } 234 }
235 235
236 // ShillDeviceClient::TestInterface overrides. 236 // ShillDeviceClient::TestInterface overrides.
237 237
238 void FakeShillDeviceClient::AddDevice(const std::string& device_path, 238 void FakeShillDeviceClient::AddDevice(const std::string& device_path,
239 const std::string& type, 239 const std::string& type,
240 const std::string& object_path) { 240 const std::string& name) {
241 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 241 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
242 AddDevice(device_path); 242 AddDevice(device_path);
243 243
244 base::DictionaryValue* properties = GetDeviceProperties(device_path); 244 base::DictionaryValue* properties = GetDeviceProperties(device_path);
245 properties->SetWithoutPathExpansion(shill::kTypeProperty, 245 properties->SetWithoutPathExpansion(shill::kTypeProperty,
246 base::Value::CreateStringValue(type)); 246 base::Value::CreateStringValue(type));
247 properties->SetWithoutPathExpansion(shill::kNameProperty,
248 base::Value::CreateStringValue(name));
247 properties->SetWithoutPathExpansion( 249 properties->SetWithoutPathExpansion(
248 shill::kNameProperty, 250 shill::kDBusObjectProperty, base::Value::CreateStringValue(device_path));
249 base::Value::CreateStringValue(object_path));
250 properties->SetWithoutPathExpansion(
251 shill::kDBusObjectProperty, base::Value::CreateStringValue(object_path));
252 properties->SetWithoutPathExpansion( 251 properties->SetWithoutPathExpansion(
253 shill::kDBusServiceProperty, 252 shill::kDBusServiceProperty,
254 base::Value::CreateStringValue(modemmanager::kModemManager1ServiceName)); 253 base::Value::CreateStringValue(modemmanager::kModemManager1ServiceName));
255 if (type == shill::kTypeCellular) { 254 if (type == shill::kTypeCellular) {
256 properties->SetWithoutPathExpansion(shill::kCellularAllowRoamingProperty, 255 properties->SetWithoutPathExpansion(shill::kCellularAllowRoamingProperty,
257 new base::FundamentalValue(false)); 256 new base::FundamentalValue(false));
258 } 257 }
259 } 258 }
260 259
261 void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) { 260 void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = 355 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter =
357 observer_list_.find(device_path); 356 observer_list_.find(device_path);
358 if (iter != observer_list_.end()) 357 if (iter != observer_list_.end())
359 return *(iter->second); 358 return *(iter->second);
360 PropertyObserverList* observer_list = new PropertyObserverList(); 359 PropertyObserverList* observer_list = new PropertyObserverList();
361 observer_list_[device_path] = observer_list; 360 observer_list_[device_path] = observer_list;
362 return *observer_list; 361 return *observer_list;
363 } 362 }
364 363
365 } // namespace chromeos 364 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698