OLD | NEW |
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_service_client_stub.h" | 5 #include "chromeos/dbus/shill_service_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 flimflam::kStateIdle, | 328 flimflam::kStateIdle, |
329 add_to_watchlist); | 329 add_to_watchlist); |
330 base::StringValue technology_value(flimflam::kNetworkTechnologyGsm); | 330 base::StringValue technology_value(flimflam::kNetworkTechnologyGsm); |
331 SetServiceProperty("stub_cellular1", | 331 SetServiceProperty("stub_cellular1", |
332 flimflam::kNetworkTechnologyProperty, | 332 flimflam::kNetworkTechnologyProperty, |
333 technology_value); | 333 technology_value); |
334 base::StringValue activation_value(flimflam::kActivationStateActivated); | 334 base::StringValue activation_value(flimflam::kActivationStateActivated); |
335 SetServiceProperty("stub_cellular1", | 335 SetServiceProperty("stub_cellular1", |
336 flimflam::kActivationStateProperty, | 336 flimflam::kActivationStateProperty, |
337 activation_value); | 337 activation_value); |
| 338 |
| 339 AddService("stub_vpn1", "vpn1", |
| 340 flimflam::kTypeVPN, |
| 341 flimflam::kStateOnline, |
| 342 add_to_watchlist); |
| 343 |
| 344 AddService("stub_vpn2", "vpn2", |
| 345 flimflam::kTypeVPN, |
| 346 flimflam::kStateOffline, |
| 347 add_to_watchlist); |
338 } | 348 } |
339 | 349 |
340 void ShillServiceClientStub::PassStubServiceProperties( | 350 void ShillServiceClientStub::PassStubServiceProperties( |
341 const dbus::ObjectPath& service_path, | 351 const dbus::ObjectPath& service_path, |
342 const DictionaryValueCallback& callback) { | 352 const DictionaryValueCallback& callback) { |
343 base::DictionaryValue* dict = NULL; | 353 base::DictionaryValue* dict = NULL; |
344 if (!stub_services_.GetDictionaryWithoutPathExpansion( | 354 if (!stub_services_.GetDictionaryWithoutPathExpansion( |
345 service_path.value(), &dict)) { | 355 service_path.value(), &dict)) { |
346 base::DictionaryValue empty_dictionary; | 356 base::DictionaryValue empty_dictionary; |
347 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); | 357 callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = | 396 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = |
387 observer_list_.find(device_path); | 397 observer_list_.find(device_path); |
388 if (iter != observer_list_.end()) | 398 if (iter != observer_list_.end()) |
389 return *(iter->second); | 399 return *(iter->second); |
390 PropertyObserverList* observer_list = new PropertyObserverList(); | 400 PropertyObserverList* observer_list = new PropertyObserverList(); |
391 observer_list_[device_path] = observer_list; | 401 observer_list_[device_path] = observer_list; |
392 return *observer_list; | 402 return *observer_list; |
393 } | 403 } |
394 | 404 |
395 } // namespace chromeos | 405 } // namespace chromeos |
OLD | NEW |