| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), | 858 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), |
| 859 GetConnectErrorCallback(Call::NOT_EXPECTED)); | 859 GetConnectErrorCallback(Call::NOT_EXPECTED)); |
| 860 SimulateGattConnection(device); | 860 SimulateGattConnection(device); |
| 861 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 861 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 862 RemoveTimedOutDevices(); | 862 RemoveTimedOutDevices(); |
| 863 EXPECT_EQ(0, observer.device_removed_count()); | 863 EXPECT_EQ(0, observer.device_removed_count()); |
| 864 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 864 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 865 } | 865 } |
| 866 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 866 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
| 867 | 867 |
| 868 #if defined(OS_MACOSX) |
| 869 // Simulate a device being connected before starting discovery session. |
| 870 TEST_F(BluetoothTest, DiscoverConnectedLowEnergyDevice) { |
| 871 if (!PlatformSupportsLowEnergy()) { |
| 872 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| 873 return; |
| 874 } |
| 875 InitWithFakeAdapter(); |
| 876 TestBluetoothAdapterObserver observer(adapter_); |
| 877 |
| 878 SimulateConnectedLowEnergyDevice(); |
| 879 adapter_->RetrieveUnknownGattConnectedDevices(); |
| 880 |
| 881 EXPECT_EQ(1, observer.device_added_count()); |
| 882 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
| 883 } |
| 884 #endif // defined(OS_MACOSX) |
| 885 |
| 868 } // namespace device | 886 } // namespace device |
| OLD | NEW |