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
3 // found in the LICENSE file.
5 #include "chromeos/dbus/fake_shill_device_client.h"
10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/stl_util.h"
13 #include "base/thread_task_runner_handle.h"
14 #include "base/values.h"
15 #include "chromeos/dbus/dbus_thread_manager.h"
16 #include "chromeos/dbus/shill_manager_client.h"
17 #include "chromeos/dbus/shill_property_changed_observer.h"
19 #include "dbus/message.h"
20 #include "dbus/object_path.h"
21 #include "dbus/object_proxy.h"
22 #include "dbus/values_util.h"
23 #include "net/base/ip_endpoint.h"
24 #include "third_party/cros_system_api/dbus/service_constants.h"
30 const char kSimPuk
[] = "12345678"; // Matches pseudomodem.
31 const int kSimPinMinLength
= 4;
32 const int kSimPukRetryCount
= 10;
33 const char kFailedMessage
[] = "Failed";
35 void ErrorFunction(const std::string
& device_path
,
36 const std::string
& error_name
,
37 const std::string
& error_message
) {
38 LOG(ERROR
) << "Shill Error for: " << device_path
39 << ": " << error_name
<< " : " << error_message
;
42 void PostError(const std::string
& error
,
43 const ShillDeviceClient::ErrorCallback
& error_callback
) {
44 base::ThreadTaskRunnerHandle::Get()->PostTask(
45 FROM_HERE
, base::Bind(error_callback
, error
, kFailedMessage
));
48 void PostNotFoundError(const ShillDeviceClient::ErrorCallback
& error_callback
) {
49 PostError(shill::kErrorResultNotFound
, error_callback
);
52 bool IsReadOnlyProperty(const std::string
& name
) {
53 if (name
== shill::kCarrierProperty
)
60 const char FakeShillDeviceClient::kDefaultSimPin
[] = "1111";
61 const int FakeShillDeviceClient::kSimPinRetryCount
= 3;
63 FakeShillDeviceClient::FakeShillDeviceClient()
64 : initial_tdls_busy_count_(0),
66 weak_ptr_factory_(this) {}
68 FakeShillDeviceClient::~FakeShillDeviceClient() {
69 STLDeleteContainerPairSecondPointers(
70 observer_list_
.begin(), observer_list_
.end());
73 // ShillDeviceClient overrides.
75 void FakeShillDeviceClient::Init(dbus::Bus
* bus
) {}
77 void FakeShillDeviceClient::AddPropertyChangedObserver(
78 const dbus::ObjectPath
& device_path
,
79 ShillPropertyChangedObserver
* observer
) {
80 GetObserverList(device_path
).AddObserver(observer
);
83 void FakeShillDeviceClient::RemovePropertyChangedObserver(
84 const dbus::ObjectPath
& device_path
,
85 ShillPropertyChangedObserver
* observer
) {
86 GetObserverList(device_path
).RemoveObserver(observer
);
89 void FakeShillDeviceClient::GetProperties(
90 const dbus::ObjectPath
& device_path
,
91 const DictionaryValueCallback
& callback
) {
92 base::ThreadTaskRunnerHandle::Get()->PostTask(
94 base::Bind(&FakeShillDeviceClient::PassStubDeviceProperties
,
95 weak_ptr_factory_
.GetWeakPtr(), device_path
, callback
));
98 void FakeShillDeviceClient::ProposeScan(
99 const dbus::ObjectPath
& device_path
,
100 const VoidDBusMethodCallback
& callback
) {
101 PostVoidCallback(callback
, DBUS_METHOD_CALL_SUCCESS
);
104 void FakeShillDeviceClient::SetProperty(const dbus::ObjectPath
& device_path
,
105 const std::string
& name
,
106 const base::Value
& value
,
107 const base::Closure
& callback
,
108 const ErrorCallback
& error_callback
) {
109 if (IsReadOnlyProperty(name
))
110 PostError(shill::kErrorResultInvalidArguments
, error_callback
);
111 SetPropertyInternal(device_path
, name
, value
, callback
, error_callback
);
114 void FakeShillDeviceClient::SetPropertyInternal(
115 const dbus::ObjectPath
& device_path
,
116 const std::string
& name
,
117 const base::Value
& value
,
118 const base::Closure
& callback
,
119 const ErrorCallback
& error_callback
) {
120 base::DictionaryValue
* device_properties
= NULL
;
121 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(device_path
.value(),
122 &device_properties
)) {
123 PostNotFoundError(error_callback
);
126 device_properties
->SetWithoutPathExpansion(name
, value
.DeepCopy());
127 base::ThreadTaskRunnerHandle::Get()->PostTask(
129 base::Bind(&FakeShillDeviceClient::NotifyObserversPropertyChanged
,
130 weak_ptr_factory_
.GetWeakPtr(), device_path
, name
));
131 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
134 void FakeShillDeviceClient::ClearProperty(
135 const dbus::ObjectPath
& device_path
,
136 const std::string
& name
,
137 const VoidDBusMethodCallback
& callback
) {
138 base::DictionaryValue
* device_properties
= NULL
;
139 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(device_path
.value(),
140 &device_properties
)) {
141 PostVoidCallback(callback
, DBUS_METHOD_CALL_FAILURE
);
144 device_properties
->RemoveWithoutPathExpansion(name
, NULL
);
145 PostVoidCallback(callback
, DBUS_METHOD_CALL_SUCCESS
);
148 void FakeShillDeviceClient::AddIPConfig(
149 const dbus::ObjectPath
& device_path
,
150 const std::string
& method
,
151 const ObjectPathDBusMethodCallback
& callback
) {
152 base::ThreadTaskRunnerHandle::Get()->PostTask(
154 base::Bind(callback
, DBUS_METHOD_CALL_SUCCESS
, dbus::ObjectPath()));
157 void FakeShillDeviceClient::RequirePin(const dbus::ObjectPath
& device_path
,
158 const std::string
& pin
,
160 const base::Closure
& callback
,
161 const ErrorCallback
& error_callback
) {
162 VLOG(1) << "RequirePin: " << device_path
.value();
163 if (!stub_devices_
.HasKey(device_path
.value())) {
164 PostNotFoundError(error_callback
);
167 if (!SimTryPin(device_path
.value(), pin
)) {
168 base::ThreadTaskRunnerHandle::Get()->PostTask(
170 base::Bind(error_callback
, shill::kErrorResultIncorrectPin
, ""));
173 SimLockStatus status
= GetSimLockStatus(device_path
.value());
174 status
.lock_enabled
= require
;
175 SetSimLockStatus(device_path
.value(), status
);
177 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
180 void FakeShillDeviceClient::EnterPin(const dbus::ObjectPath
& device_path
,
181 const std::string
& pin
,
182 const base::Closure
& callback
,
183 const ErrorCallback
& error_callback
) {
184 VLOG(1) << "EnterPin: " << device_path
.value();
185 if (!stub_devices_
.HasKey(device_path
.value())) {
186 PostNotFoundError(error_callback
);
189 if (!SimTryPin(device_path
.value(), pin
)) {
190 base::ThreadTaskRunnerHandle::Get()->PostTask(
192 base::Bind(error_callback
, shill::kErrorResultIncorrectPin
, ""));
195 SetSimLocked(device_path
.value(), false);
197 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
200 void FakeShillDeviceClient::UnblockPin(const dbus::ObjectPath
& device_path
,
201 const std::string
& puk
,
202 const std::string
& pin
,
203 const base::Closure
& callback
,
204 const ErrorCallback
& error_callback
) {
205 VLOG(1) << "UnblockPin: " << device_path
.value();
206 if (!stub_devices_
.HasKey(device_path
.value())) {
207 PostNotFoundError(error_callback
);
210 if (!SimTryPuk(device_path
.value(), puk
)) {
211 base::ThreadTaskRunnerHandle::Get()->PostTask(
213 base::Bind(error_callback
, shill::kErrorResultIncorrectPin
, ""));
216 if (pin
.length() < kSimPinMinLength
) {
217 base::ThreadTaskRunnerHandle::Get()->PostTask(
219 base::Bind(error_callback
, shill::kErrorResultInvalidArguments
, ""));
222 sim_pin_
[device_path
.value()] = pin
;
223 SetSimLocked(device_path
.value(), false);
225 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
228 void FakeShillDeviceClient::ChangePin(const dbus::ObjectPath
& device_path
,
229 const std::string
& old_pin
,
230 const std::string
& new_pin
,
231 const base::Closure
& callback
,
232 const ErrorCallback
& error_callback
) {
233 VLOG(1) << "ChangePin: " << device_path
.value();
234 if (!stub_devices_
.HasKey(device_path
.value())) {
235 PostNotFoundError(error_callback
);
238 if (!SimTryPin(device_path
.value(), old_pin
)) {
239 base::ThreadTaskRunnerHandle::Get()->PostTask(
241 base::Bind(error_callback
, shill::kErrorResultIncorrectPin
, ""));
244 if (new_pin
.length() < kSimPinMinLength
) {
245 base::ThreadTaskRunnerHandle::Get()->PostTask(
247 base::Bind(error_callback
, shill::kErrorResultInvalidArguments
, ""));
250 sim_pin_
[device_path
.value()] = new_pin
;
252 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
255 void FakeShillDeviceClient::Register(const dbus::ObjectPath
& device_path
,
256 const std::string
& network_id
,
257 const base::Closure
& callback
,
258 const ErrorCallback
& error_callback
) {
259 if (!stub_devices_
.HasKey(device_path
.value())) {
260 PostNotFoundError(error_callback
);
263 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
266 void FakeShillDeviceClient::SetCarrier(const dbus::ObjectPath
& device_path
,
267 const std::string
& carrier
,
268 const base::Closure
& callback
,
269 const ErrorCallback
& error_callback
) {
270 SetPropertyInternal(device_path
, shill::kCarrierProperty
,
271 base::StringValue(carrier
), callback
, error_callback
);
274 void FakeShillDeviceClient::Reset(const dbus::ObjectPath
& device_path
,
275 const base::Closure
& callback
,
276 const ErrorCallback
& error_callback
) {
277 if (!stub_devices_
.HasKey(device_path
.value())) {
278 PostNotFoundError(error_callback
);
281 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
284 void FakeShillDeviceClient::PerformTDLSOperation(
285 const dbus::ObjectPath
& device_path
,
286 const std::string
& operation
,
287 const std::string
& peer
,
288 const StringCallback
& callback
,
289 const ErrorCallback
& error_callback
) {
290 if (!stub_devices_
.HasKey(device_path
.value())) {
291 PostNotFoundError(error_callback
);
294 // Use -1 to emulate a TDLS failure.
295 if (tdls_busy_count_
== -1) {
296 base::ThreadTaskRunnerHandle::Get()->PostTask(
298 base::Bind(error_callback
, shill::kErrorDhcpFailed
, "Failed"));
301 if (operation
!= shill::kTDLSStatusOperation
&& tdls_busy_count_
> 0) {
303 base::ThreadTaskRunnerHandle::Get()->PostTask(
304 FROM_HERE
, base::Bind(error_callback
, shill::kErrorResultInProgress
,
309 tdls_busy_count_
= initial_tdls_busy_count_
;
312 if (operation
== shill::kTDLSDiscoverOperation
) {
313 if (tdls_state_
.empty())
314 tdls_state_
= shill::kTDLSDisconnectedState
;
315 } else if (operation
== shill::kTDLSSetupOperation
) {
316 if (tdls_state_
.empty())
317 tdls_state_
= shill::kTDLSConnectedState
;
318 } else if (operation
== shill::kTDLSTeardownOperation
) {
319 if (tdls_state_
.empty())
320 tdls_state_
= shill::kTDLSDisconnectedState
;
321 } else if (operation
== shill::kTDLSStatusOperation
) {
322 result
= tdls_state_
;
325 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
,
326 base::Bind(callback
, result
));
329 void FakeShillDeviceClient::AddWakeOnPacketConnection(
330 const dbus::ObjectPath
& device_path
,
331 const net::IPEndPoint
& ip_endpoint
,
332 const base::Closure
& callback
,
333 const ErrorCallback
& error_callback
) {
334 if (!stub_devices_
.HasKey(device_path
.value())) {
335 PostNotFoundError(error_callback
);
339 wake_on_packet_connections_
[device_path
].insert(ip_endpoint
);
341 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
344 void FakeShillDeviceClient::RemoveWakeOnPacketConnection(
345 const dbus::ObjectPath
& device_path
,
346 const net::IPEndPoint
& ip_endpoint
,
347 const base::Closure
& callback
,
348 const ErrorCallback
& error_callback
) {
349 const auto device_iter
= wake_on_packet_connections_
.find(device_path
);
350 if (!stub_devices_
.HasKey(device_path
.value()) ||
351 device_iter
== wake_on_packet_connections_
.end()) {
352 PostNotFoundError(error_callback
);
356 const auto endpoint_iter
= device_iter
->second
.find(ip_endpoint
);
357 if (endpoint_iter
== device_iter
->second
.end()) {
358 PostNotFoundError(error_callback
);
362 device_iter
->second
.erase(endpoint_iter
);
364 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
367 void FakeShillDeviceClient::RemoveAllWakeOnPacketConnections(
368 const dbus::ObjectPath
& device_path
,
369 const base::Closure
& callback
,
370 const ErrorCallback
& error_callback
) {
371 const auto iter
= wake_on_packet_connections_
.find(device_path
);
372 if (!stub_devices_
.HasKey(device_path
.value()) ||
373 iter
== wake_on_packet_connections_
.end()) {
374 PostNotFoundError(error_callback
);
378 wake_on_packet_connections_
.erase(iter
);
380 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
, callback
);
383 ShillDeviceClient::TestInterface
* FakeShillDeviceClient::GetTestInterface() {
387 // ShillDeviceClient::TestInterface overrides.
389 void FakeShillDeviceClient::AddDevice(const std::string
& device_path
,
390 const std::string
& type
,
391 const std::string
& name
) {
392 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
393 AddDevice(device_path
);
395 base::DictionaryValue
* properties
= GetDeviceProperties(device_path
);
396 properties
->SetStringWithoutPathExpansion(shill::kTypeProperty
, type
);
397 properties
->SetStringWithoutPathExpansion(shill::kNameProperty
, name
);
398 properties
->SetStringWithoutPathExpansion(shill::kDBusObjectProperty
,
400 properties
->SetStringWithoutPathExpansion(
401 shill::kDBusServiceProperty
, modemmanager::kModemManager1ServiceName
);
402 if (type
== shill::kTypeCellular
) {
403 properties
->SetBooleanWithoutPathExpansion(
404 shill::kCellularAllowRoamingProperty
, false);
408 void FakeShillDeviceClient::RemoveDevice(const std::string
& device_path
) {
409 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
410 RemoveDevice(device_path
);
412 stub_devices_
.RemoveWithoutPathExpansion(device_path
, NULL
);
415 void FakeShillDeviceClient::ClearDevices() {
416 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
419 stub_devices_
.Clear();
422 void FakeShillDeviceClient::SetDeviceProperty(const std::string
& device_path
,
423 const std::string
& name
,
424 const base::Value
& value
) {
425 VLOG(1) << "SetDeviceProperty: " << device_path
426 << ": " << name
<< " = " << value
;
427 SetPropertyInternal(dbus::ObjectPath(device_path
), name
, value
,
428 base::Bind(&base::DoNothing
),
429 base::Bind(&ErrorFunction
, device_path
));
432 std::string
FakeShillDeviceClient::GetDevicePathForType(
433 const std::string
& type
) {
434 for (base::DictionaryValue::Iterator
iter(stub_devices_
);
435 !iter
.IsAtEnd(); iter
.Advance()) {
436 const base::DictionaryValue
* properties
= NULL
;
437 if (!iter
.value().GetAsDictionary(&properties
))
439 std::string prop_type
;
440 if (!properties
->GetStringWithoutPathExpansion(
441 shill::kTypeProperty
, &prop_type
) ||
446 return std::string();
449 void FakeShillDeviceClient::SetTDLSBusyCount(int count
) {
450 tdls_busy_count_
= std::max(count
, -1);
453 void FakeShillDeviceClient::SetTDLSState(const std::string
& state
) {
457 void FakeShillDeviceClient::SetSimLocked(const std::string
& device_path
,
459 SimLockStatus status
= GetSimLockStatus(device_path
);
460 status
.type
= locked
? shill::kSIMLockPin
: "";
461 status
.retries_left
= kSimPinRetryCount
;
462 SetSimLockStatus(device_path
, status
);
465 // Private Methods -------------------------------------------------------------
467 FakeShillDeviceClient::SimLockStatus
FakeShillDeviceClient::GetSimLockStatus(
468 const std::string
& device_path
) {
469 SimLockStatus status
;
470 base::DictionaryValue
* device_properties
= nullptr;
471 base::DictionaryValue
* simlock_dict
= nullptr;
472 if (stub_devices_
.GetDictionaryWithoutPathExpansion(device_path
,
473 &device_properties
) &&
474 device_properties
->GetDictionaryWithoutPathExpansion(
475 shill::kSIMLockStatusProperty
, &simlock_dict
)) {
476 simlock_dict
->GetStringWithoutPathExpansion(shill::kSIMLockTypeProperty
,
478 simlock_dict
->GetIntegerWithoutPathExpansion(
479 shill::kSIMLockRetriesLeftProperty
, &status
.retries_left
);
480 simlock_dict
->GetBooleanWithoutPathExpansion(shill::kSIMLockEnabledProperty
,
481 &status
.lock_enabled
);
482 if (status
.type
== shill::kSIMLockPin
&& status
.retries_left
== 0)
483 status
.retries_left
= kSimPinRetryCount
;
488 void FakeShillDeviceClient::SetSimLockStatus(const std::string
& device_path
,
489 const SimLockStatus
& status
) {
490 base::DictionaryValue
* device_properties
= NULL
;
491 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(device_path
,
492 &device_properties
)) {
493 NOTREACHED() << "Device not found: " << device_path
;
497 base::DictionaryValue
* simlock_dict
= nullptr;
498 if (!device_properties
->GetDictionaryWithoutPathExpansion(
499 shill::kSIMLockStatusProperty
, &simlock_dict
)) {
500 simlock_dict
= new base::DictionaryValue
;
501 device_properties
->SetWithoutPathExpansion(shill::kSIMLockStatusProperty
,
504 simlock_dict
->Clear();
505 simlock_dict
->SetStringWithoutPathExpansion(shill::kSIMLockTypeProperty
,
507 simlock_dict
->SetIntegerWithoutPathExpansion(
508 shill::kSIMLockRetriesLeftProperty
, status
.retries_left
);
509 simlock_dict
->SetBooleanWithoutPathExpansion(shill::kSIMLockEnabledProperty
,
510 status
.lock_enabled
);
511 NotifyObserversPropertyChanged(dbus::ObjectPath(device_path
),
512 shill::kSIMLockStatusProperty
);
515 bool FakeShillDeviceClient::SimTryPin(const std::string
& device_path
,
516 const std::string
& pin
) {
517 SimLockStatus status
= GetSimLockStatus(device_path
);
518 if (status
.type
== shill::kSIMLockPuk
) {
519 VLOG(1) << "SimTryPin called with PUK locked.";
520 return false; // PUK locked, PIN won't work.
522 if (pin
.length() < kSimPinMinLength
)
524 std::string sim_pin
= sim_pin_
[device_path
];
525 if (sim_pin
.empty()) {
526 sim_pin
= kDefaultSimPin
;
527 sim_pin_
[device_path
] = sim_pin
;
529 if (pin
== sim_pin
) {
531 status
.retries_left
= kSimPinRetryCount
;
532 SetSimLockStatus(device_path
, status
);
536 VLOG(1) << "SIM PIN: " << pin
<< " != " << sim_pin
537 << " Retries left: " << (status
.retries_left
- 1);
538 if (--status
.retries_left
<= 0) {
539 status
.retries_left
= kSimPukRetryCount
;
540 status
.type
= shill::kSIMLockPuk
;
541 status
.lock_enabled
= true;
543 SetSimLockStatus(device_path
, status
);
547 bool FakeShillDeviceClient::SimTryPuk(const std::string
& device_path
,
548 const std::string
& puk
) {
549 SimLockStatus status
= GetSimLockStatus(device_path
);
550 if (status
.type
!= shill::kSIMLockPuk
) {
551 VLOG(1) << "PUK Not locked";
552 return true; // Not PUK locked.
554 if (status
.retries_left
== 0) {
555 VLOG(1) << "PUK: No retries left";
556 return false; // Permanently locked.
559 if (puk
== kSimPuk
) {
561 status
.retries_left
= kSimPinRetryCount
;
562 SetSimLockStatus(device_path
, status
);
566 --status
.retries_left
;
567 VLOG(1) << "SIM PUK: " << puk
<< " != " << kSimPuk
568 << " Retries left: " << status
.retries_left
;
569 SetSimLockStatus(device_path
, status
);
573 void FakeShillDeviceClient::PassStubDeviceProperties(
574 const dbus::ObjectPath
& device_path
,
575 const DictionaryValueCallback
& callback
) const {
576 const base::DictionaryValue
* device_properties
= NULL
;
577 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(
578 device_path
.value(), &device_properties
)) {
579 base::DictionaryValue empty_dictionary
;
580 callback
.Run(DBUS_METHOD_CALL_FAILURE
, empty_dictionary
);
583 callback
.Run(DBUS_METHOD_CALL_SUCCESS
, *device_properties
);
586 // Posts a task to run a void callback with status code |status|.
587 void FakeShillDeviceClient::PostVoidCallback(
588 const VoidDBusMethodCallback
& callback
,
589 DBusMethodCallStatus status
) {
590 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE
,
591 base::Bind(callback
, status
));
594 void FakeShillDeviceClient::NotifyObserversPropertyChanged(
595 const dbus::ObjectPath
& device_path
,
596 const std::string
& property
) {
597 base::DictionaryValue
* dict
= NULL
;
598 std::string path
= device_path
.value();
599 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(path
, &dict
)) {
600 LOG(ERROR
) << "Notify for unknown service: " << path
;
603 base::Value
* value
= NULL
;
604 if (!dict
->GetWithoutPathExpansion(property
, &value
)) {
605 LOG(ERROR
) << "Notify for unknown property: "
606 << path
<< " : " << property
;
609 FOR_EACH_OBSERVER(ShillPropertyChangedObserver
,
610 GetObserverList(device_path
),
611 OnPropertyChanged(property
, *value
));
614 base::DictionaryValue
* FakeShillDeviceClient::GetDeviceProperties(
615 const std::string
& device_path
) {
616 base::DictionaryValue
* properties
= NULL
;
617 if (!stub_devices_
.GetDictionaryWithoutPathExpansion(
618 device_path
, &properties
)) {
619 properties
= new base::DictionaryValue
;
620 stub_devices_
.SetWithoutPathExpansion(device_path
, properties
);
625 FakeShillDeviceClient::PropertyObserverList
&
626 FakeShillDeviceClient::GetObserverList(const dbus::ObjectPath
& device_path
) {
627 std::map
<dbus::ObjectPath
, PropertyObserverList
*>::iterator iter
=
628 observer_list_
.find(device_path
);
629 if (iter
!= observer_list_
.end())
630 return *(iter
->second
);
631 PropertyObserverList
* observer_list
= new PropertyObserverList();
632 observer_list_
[device_path
] = observer_list
;
633 return *observer_list
;
636 } // namespace chromeos