| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 | 2813 |
| 2814 fake_bluetooth_device_client_->CreateDevice( | 2814 fake_bluetooth_device_client_->CreateDevice( |
| 2815 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 2815 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
| 2816 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: | 2816 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: |
| 2817 kConnectedTrustedNotPairedDevicePath)); | 2817 kConnectedTrustedNotPairedDevicePath)); |
| 2818 BluetoothDevice* device = | 2818 BluetoothDevice* device = |
| 2819 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient:: | 2819 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient:: |
| 2820 kConnectedTrustedNotPairedDeviceAddress); | 2820 kConnectedTrustedNotPairedDeviceAddress); |
| 2821 ASSERT_TRUE(device != nullptr); | 2821 ASSERT_TRUE(device != nullptr); |
| 2822 | 2822 |
| 2823 // On the DBus level the device is trusted but not paired. But the current | |
| 2824 // implementation of |BluetoothDevice::IsPaired()| returns true in this case. | |
| 2825 bluez::FakeBluetoothDeviceClient::Properties* properties = | 2823 bluez::FakeBluetoothDeviceClient::Properties* properties = |
| 2826 fake_bluetooth_device_client_->GetProperties( | 2824 fake_bluetooth_device_client_->GetProperties( |
| 2827 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: | 2825 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient:: |
| 2828 kConnectedTrustedNotPairedDevicePath)); | 2826 kConnectedTrustedNotPairedDevicePath)); |
| 2829 EXPECT_FALSE(properties->paired.value()); | 2827 EXPECT_FALSE(properties->paired.value()); |
| 2830 EXPECT_TRUE(properties->trusted.value()); | 2828 EXPECT_TRUE(properties->trusted.value()); |
| 2831 ASSERT_TRUE(device->IsPaired()); | 2829 ASSERT_FALSE(device->IsPaired()); |
| 2832 | 2830 |
| 2833 // The |kConnectedTrustedNotPairedDevicePath| requests a passkey confirmation. | 2831 // The |kConnectedTrustedNotPairedDevicePath| requests a passkey confirmation. |
| 2834 // Obs.: This is the flow when CrOS triggers pairing with a iOS device. | 2832 // Obs.: This is the flow when CrOS triggers pairing with a iOS device. |
| 2835 TestBluetoothAdapterObserver observer(adapter_); | 2833 TestBluetoothAdapterObserver observer(adapter_); |
| 2836 TestPairingDelegate pairing_delegate; | 2834 TestPairingDelegate pairing_delegate; |
| 2837 adapter_->AddPairingDelegate( | 2835 adapter_->AddPairingDelegate( |
| 2838 &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH); | 2836 &pairing_delegate, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH); |
| 2839 device->Pair(&pairing_delegate, GetCallback(), | 2837 device->Pair(&pairing_delegate, GetCallback(), |
| 2840 base::Bind(&BluetoothBlueZTest::ConnectErrorCallback, | 2838 base::Bind(&BluetoothBlueZTest::ConnectErrorCallback, |
| 2841 base::Unretained(this))); | 2839 base::Unretained(this))); |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4639 | 4637 |
| 4640 // Check that we can update advertising data flags. | 4638 // Check that we can update advertising data flags. |
| 4641 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23})); | 4639 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23})); |
| 4642 EXPECT_EQ(2, observer.device_changed_count()); | 4640 EXPECT_EQ(2, observer.device_changed_count()); |
| 4643 EXPECT_EQ(device, observer.last_device()); | 4641 EXPECT_EQ(device, observer.last_device()); |
| 4644 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); | 4642 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); |
| 4645 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value()); | 4643 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value()); |
| 4646 } | 4644 } |
| 4647 | 4645 |
| 4648 } // namespace bluez | 4646 } // namespace bluez |
| OLD | NEW |