| Index: chromeos/dbus/fake_bluetooth_device_client.cc
|
| diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc
|
| index 325d95e69e94eeb90ae84de5e2fba40cf4c70691..089aa386a9483f8a19fe73b417274adb7839ac96 100644
|
| --- a/chromeos/dbus/fake_bluetooth_device_client.cc
|
| +++ b/chromeos/dbus/fake_bluetooth_device_client.cc
|
| @@ -185,6 +185,15 @@ const char FakeBluetoothDeviceClient::kLowEnergyName[] =
|
| const uint32 FakeBluetoothDeviceClient::kLowEnergyClass =
|
| 0x000918; // Major class "Health", Minor class "Heart/Pulse Rate Monitor."
|
|
|
| +const char FakeBluetoothDeviceClient::kPairedUnconnectableDevicePath[] =
|
| + "/fake/hci0/devD";
|
| +const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress[] =
|
| + "20:7D:74:00:00:04";
|
| +const char FakeBluetoothDeviceClient::kPairedUnconnectableDeviceName[] =
|
| + "Paired Unconnectable Device";
|
| +const uint32 FakeBluetoothDeviceClient::kPairedUnconnectableDeviceClass =
|
| + 0x000104;
|
| +
|
| FakeBluetoothDeviceClient::Properties::Properties(
|
| const PropertyChangedCallback& callback)
|
| : BluetoothDeviceClient::Properties(
|
| @@ -249,6 +258,26 @@ FakeBluetoothDeviceClient::FakeBluetoothDeviceClient()
|
|
|
| properties_map_[dbus::ObjectPath(kPairedDevicePath)] = properties;
|
| device_list_.push_back(dbus::ObjectPath(kPairedDevicePath));
|
| +
|
| + properties = new Properties(base::Bind(
|
| + &FakeBluetoothDeviceClient::OnPropertyChanged, base::Unretained(this),
|
| + dbus::ObjectPath(kPairedUnconnectableDevicePath)));
|
| + properties->address.ReplaceValue(kPairedUnconnectableDeviceAddress);
|
| + properties->bluetooth_class.ReplaceValue(kPairedUnconnectableDeviceClass);
|
| + properties->name.ReplaceValue("Fake Device 2 (Unconnectable)");
|
| + properties->alias.ReplaceValue(kPairedUnconnectableDeviceName);
|
| + properties->paired.ReplaceValue(true);
|
| + properties->trusted.ReplaceValue(true);
|
| + properties->adapter.ReplaceValue(
|
| + dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
|
| +
|
| + properties->uuids.ReplaceValue(uuids);
|
| +
|
| + properties->modalias.ReplaceValue("usb:v05ACp030Dd0306");
|
| +
|
| + properties_map_[dbus::ObjectPath(kPairedUnconnectableDevicePath)] =
|
| + properties;
|
| + device_list_.push_back(dbus::ObjectPath(kPairedUnconnectableDevicePath));
|
| }
|
|
|
| FakeBluetoothDeviceClient::~FakeBluetoothDeviceClient() {
|
| @@ -304,7 +333,9 @@ void FakeBluetoothDeviceClient::Connect(
|
| error_callback.Run(bluetooth_device::kErrorFailed, "Not paired");
|
| return;
|
| } else if (properties->paired.value() == true &&
|
| - object_path == dbus::ObjectPath(kUnconnectableDevicePath)) {
|
| + (object_path == dbus::ObjectPath(kUnconnectableDevicePath) ||
|
| + object_path ==
|
| + dbus::ObjectPath(kPairedUnconnectableDevicePath))) {
|
| // Must not be paired
|
| error_callback.Run(bluetooth_device::kErrorFailed,
|
| "Connection fails while paired");
|
| @@ -368,6 +399,11 @@ void FakeBluetoothDeviceClient::ConnectProfile(
|
| return;
|
| }
|
|
|
| + if (object_path == dbus::ObjectPath(kPairedUnconnectableDevicePath)) {
|
| + error_callback.Run(bluetooth_device::kErrorFailed, "unconnectable");
|
| + return;
|
| + }
|
| +
|
| // Make a socket pair of a compatible type with the type used by Bluetooth;
|
| // spin up a thread to simulate the server side and wrap the client side in
|
| // a D-Bus file descriptor object.
|
|
|