Chromium Code Reviews| Index: device/bluetooth/bluetooth_device_unittest.cc |
| diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc |
| index f395764df919cf492ace28bdd388f55d58e51c70..ddb67037169959baf09f1f2dd62e62a91aaa4c50 100644 |
| --- a/device/bluetooth/bluetooth_device_unittest.cc |
| +++ b/device/bluetooth/bluetooth_device_unittest.cc |
| @@ -395,6 +395,33 @@ TEST_F(BluetoothTest, |
| #endif // defined(OS_ANDROID) |
| #if defined(OS_ANDROID) |
| +// Calls CreateGattConnection & DisconnectGatt, then checks that gatt services |
|
ortuno
2016/01/11 21:48:40
You also need to add tests for bluez based systems
tommyt
2016/01/12 08:42:35
While it wouldn't be too hard to add equivalent un
ortuno
2016/01/12 22:28:49
btw I'm not talking about clearing the services li
tommyt
2016/01/13 09:42:30
Hmm. The intention of my change was to fix somethi
ortuno
2016/01/13 18:22:01
My bad that was an incorrect example. The issue th
|
| +// have been cleaned up. |
| +TEST_F(BluetoothTest, BluetoothGattConnection_DisconnectGatt_Cleanup) { |
|
scheib
2016/01/11 18:40:09
Thanks, would you add
+ Connecting again after a d
tommyt
2016/01/12 08:42:35
Done.
|
| + InitWithFakeAdapter(); |
| + StartLowEnergyDiscoverySession(); |
| + BluetoothDevice* device = DiscoverLowEnergyDevice(3); |
| + |
| + ResetEventCounts(); |
| + device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), |
| + GetConnectErrorCallback(Call::NOT_EXPECTED)); |
| + SimulateGattConnection(device); |
| + |
| + std::vector<std::string> services; |
| + services.push_back("00000000-0000-1000-8000-00805f9b34fb"); |
| + // 2 duplicate UUIDs creating 2 instances. |
| + services.push_back("00000001-0000-1000-8000-00805f9b34fb"); |
| + services.push_back("00000001-0000-1000-8000-00805f9b34fb"); |
| + SimulateGattServicesDiscovered(device, services); |
| + EXPECT_EQ(3u, device->GetGattServices().size()); |
| + |
| + device->DisconnectGatt(); |
| + SimulateGattDisconnection(device); |
| + EXPECT_EQ(0u, device->GetGattServices().size()); |
|
ortuno
2016/01/11 21:48:40
Also make sure IsGattServicesDiscovered == false.
tommyt
2016/01/12 08:42:35
Done.
|
| +} |
| +#endif // defined(OS_ANDROID) |
| + |
| +#if defined(OS_ANDROID) |
| // Calls CreateGattConnection, but simulate errors connecting. Also, verifies |
| // multiple errors should only invoke callbacks once. |
| TEST_F(BluetoothTest, BluetoothGattConnection_ErrorAfterConnection) { |