| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/bluetooth/bluetooth_adapter.h" | 5 #include "device/bluetooth/bluetooth_adapter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 return; | 852 return; |
| 853 } | 853 } |
| 854 InitWithFakeAdapter(); | 854 InitWithFakeAdapter(); |
| 855 TestBluetoothAdapterObserver observer(adapter_); | 855 TestBluetoothAdapterObserver observer(adapter_); |
| 856 StartLowEnergyDiscoverySession(); | 856 StartLowEnergyDiscoverySession(); |
| 857 BluetoothDevice* device = SimulateLowEnergyDevice(1); | 857 BluetoothDevice* device = SimulateLowEnergyDevice(1); |
| 858 device->SetAsExpiredForTesting(); | 858 device->SetAsExpiredForTesting(); |
| 859 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), | 859 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), |
| 860 GetConnectErrorCallback(Call::NOT_EXPECTED)); | 860 GetConnectErrorCallback(Call::NOT_EXPECTED)); |
| 861 SimulateGattConnection(device); | 861 SimulateGattConnection(device); |
| 862 base::RunLoop().RunUntilIdle(); |
| 862 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 863 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 863 RemoveTimedOutDevices(); | 864 RemoveTimedOutDevices(); |
| 864 EXPECT_EQ(0, observer.device_removed_count()); | 865 EXPECT_EQ(0, observer.device_removed_count()); |
| 865 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 866 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 866 } | 867 } |
| 867 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 868 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
| 868 | 869 |
| 869 #if defined(OS_MACOSX) | 870 #if defined(OS_MACOSX) |
| 870 // Simulate two devices being connected before calling | 871 // Simulate two devices being connected before calling |
| 871 // RetrieveGattConnectedDevicesWithDiscoveryFilter() with no service filter. | 872 // RetrieveGattConnectedDevicesWithDiscoveryFilter() with no service filter. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 } | 1046 } |
| 1046 EXPECT_EQ(BluetoothDevice::UUIDSet({heart_service_uuid}), | 1047 EXPECT_EQ(BluetoothDevice::UUIDSet({heart_service_uuid}), |
| 1047 RetrieveConnectedPeripheralServiceUUIDs()); | 1048 RetrieveConnectedPeripheralServiceUUIDs()); |
| 1048 | 1049 |
| 1049 EXPECT_EQ(0, observer.device_added_count()); | 1050 EXPECT_EQ(0, observer.device_added_count()); |
| 1050 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 1051 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 1051 } | 1052 } |
| 1052 #endif // defined(OS_MACOSX) | 1053 #endif // defined(OS_MACOSX) |
| 1053 | 1054 |
| 1054 } // namespace device | 1055 } // namespace device |
| OLD | NEW |