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