OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chromeos/dbus/shill_device_client.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 STLValueDeleter<HelperMap> helpers_deleter_; | 211 STLValueDeleter<HelperMap> helpers_deleter_; |
212 | 212 |
213 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClientImpl); | 213 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClientImpl); |
214 }; | 214 }; |
215 | 215 |
216 // A stub implementation of ShillDeviceClient. | 216 // A stub implementation of ShillDeviceClient. |
217 // Implemented: Stub cellular device for SMS testing. | 217 // Implemented: Stub cellular device for SMS testing. |
218 class ShillDeviceClientStubImpl : public ShillDeviceClient { | 218 class ShillDeviceClientStubImpl : public ShillDeviceClient { |
219 public: | 219 public: |
220 ShillDeviceClientStubImpl() : weak_ptr_factory_(this) { | 220 ShillDeviceClientStubImpl() : weak_ptr_factory_(this) { |
221 // Add a cellular device for SMS. Note: name matches Manager entry. | 221 // Add a wifi device. Note: name matches Manager entry. |
222 const char kStubCellular1[] = "stub_cellular1"; | 222 base::DictionaryValue* wifi_properties = new base::DictionaryValue; |
| 223 wifi_properties->SetWithoutPathExpansion( |
| 224 flimflam::kTypeProperty, |
| 225 base::Value::CreateStringValue(flimflam::kTypeWifi)); |
| 226 wifi_properties->SetWithoutPathExpansion( |
| 227 flimflam::kDBusConnectionProperty, |
| 228 base::Value::CreateStringValue("/stub")); |
| 229 wifi_properties->SetWithoutPathExpansion( |
| 230 flimflam::kDBusObjectProperty, |
| 231 base::Value::CreateStringValue("/device/wifi1")); |
| 232 stub_devices_.Set("stub_wifi_device1", wifi_properties); |
| 233 |
| 234 // Add a cellular device. Used in SMS stub. |
| 235 // Note: name matches Manager entry. |
223 base::DictionaryValue* cellular_properties = new base::DictionaryValue; | 236 base::DictionaryValue* cellular_properties = new base::DictionaryValue; |
224 cellular_properties->SetWithoutPathExpansion( | 237 cellular_properties->SetWithoutPathExpansion( |
225 flimflam::kTypeProperty, | 238 flimflam::kTypeProperty, |
226 base::Value::CreateStringValue(flimflam::kTypeCellular)); | 239 base::Value::CreateStringValue(flimflam::kTypeCellular)); |
227 cellular_properties->SetWithoutPathExpansion( | 240 cellular_properties->SetWithoutPathExpansion( |
228 flimflam::kDBusConnectionProperty, | 241 flimflam::kDBusConnectionProperty, |
229 base::Value::CreateStringValue("/stub")); | 242 base::Value::CreateStringValue("/stub")); |
230 cellular_properties->SetWithoutPathExpansion( | 243 cellular_properties->SetWithoutPathExpansion( |
231 flimflam::kDBusObjectProperty, | 244 flimflam::kDBusObjectProperty, |
232 base::Value::CreateStringValue("/device/cellular1")); | 245 base::Value::CreateStringValue("/device/cellular1")); |
233 stub_devices_.Set(kStubCellular1, cellular_properties); | 246 stub_devices_.Set("stub_cellular_device1", cellular_properties); |
234 | 247 |
235 // Create a second device stubbing a modem managed by | 248 // Create a second device stubbing a modem managed by |
236 // ModemManager1 interfaces. | 249 // ModemManager1 interfaces. |
237 // Note: name matches Manager entry. | 250 // Note: name matches Manager entry. |
238 const char kStubCellular2[] = "stub_cellular2"; | |
239 cellular_properties = new base::DictionaryValue; | 251 cellular_properties = new base::DictionaryValue; |
240 cellular_properties->SetWithoutPathExpansion( | 252 cellular_properties->SetWithoutPathExpansion( |
241 flimflam::kTypeProperty, | 253 flimflam::kTypeProperty, |
242 base::Value::CreateStringValue(flimflam::kTypeCellular)); | 254 base::Value::CreateStringValue(flimflam::kTypeCellular)); |
243 cellular_properties->SetWithoutPathExpansion( | 255 cellular_properties->SetWithoutPathExpansion( |
244 flimflam::kDBusConnectionProperty, | 256 flimflam::kDBusConnectionProperty, |
245 base::Value::CreateStringValue(":stub.0")); | 257 base::Value::CreateStringValue(":stub.0")); |
246 cellular_properties->SetWithoutPathExpansion( | 258 cellular_properties->SetWithoutPathExpansion( |
247 flimflam::kDBusObjectProperty, | 259 flimflam::kDBusObjectProperty, |
248 base::Value::CreateStringValue( | 260 base::Value::CreateStringValue( |
249 "/org/freedesktop/ModemManager1/stub/0")); | 261 "/org/freedesktop/ModemManager1/stub/0")); |
250 stub_devices_.Set(kStubCellular2, cellular_properties); | 262 stub_devices_.Set("stub_cellular_device2", cellular_properties); |
251 } | 263 } |
252 | 264 |
253 virtual ~ShillDeviceClientStubImpl() {} | 265 virtual ~ShillDeviceClientStubImpl() {} |
254 | 266 |
255 /////////////////////////////////// | 267 /////////////////////////////////// |
256 // ShillDeviceClient overrides. | 268 // ShillDeviceClient overrides. |
257 virtual void AddPropertyChangedObserver( | 269 virtual void AddPropertyChangedObserver( |
258 const dbus::ObjectPath& device_path, | 270 const dbus::ObjectPath& device_path, |
259 ShillPropertyChangedObserver* observer) OVERRIDE {} | 271 ShillPropertyChangedObserver* observer) OVERRIDE {} |
260 | 272 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 ShillDeviceClient* ShillDeviceClient::Create( | 425 ShillDeviceClient* ShillDeviceClient::Create( |
414 DBusClientImplementationType type, | 426 DBusClientImplementationType type, |
415 dbus::Bus* bus) { | 427 dbus::Bus* bus) { |
416 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 428 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
417 return new ShillDeviceClientImpl(bus); | 429 return new ShillDeviceClientImpl(bus); |
418 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 430 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
419 return new ShillDeviceClientStubImpl(); | 431 return new ShillDeviceClientStubImpl(); |
420 } | 432 } |
421 | 433 |
422 } // namespace chromeos | 434 } // namespace chromeos |
OLD | NEW |