Index: device/bluetooth/bluetooth_device_unittest.cc |
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc |
index 0b075e250d02187bba5c4bd989889af0079a1a9c..6ac2f63c374bf7c53a2d67bc8d1cc31b4790d750 100644 |
--- a/device/bluetooth/bluetooth_device_unittest.cc |
+++ b/device/bluetooth/bluetooth_device_unittest.cc |
@@ -158,6 +158,30 @@ TEST_F(BluetoothTest, CreateGattConnection) { |
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
#if defined(OS_ANDROID) || defined(OS_MACOSX) |
+TEST_F(BluetoothTest, DisconnectionNotifiesDeviceChanged) { |
+ if (!PlatformSupportsLowEnergy()) { |
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
+ return; |
+ } |
+ InitWithFakeAdapter(); |
+ TestBluetoothAdapterObserver observer(adapter_); |
+ StartLowEnergyDiscoverySession(); |
+ BluetoothDevice* device = SimulateLowEnergyDevice(3); |
+ device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), |
+ GetConnectErrorCallback(Call::NOT_EXPECTED)); |
+ SimulateGattConnection(device); |
+ EXPECT_EQ(1, observer.device_changed_count()); |
+ EXPECT_TRUE(device->IsConnected()); |
+ EXPECT_TRUE(device->IsGattConnected()); |
+ |
+ SimulateGattDisconnection(device); |
+ EXPECT_EQ(2, observer.device_changed_count()); |
+ EXPECT_FALSE(device->IsConnected()); |
+ EXPECT_FALSE(device->IsGattConnected()); |
+} |
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
+ |
+#if defined(OS_ANDROID) || defined(OS_MACOSX) |
// Creates BluetoothGattConnection instances and tests that the interface |
// functions even when some Disconnect and the BluetoothDevice is destroyed. |
TEST_F(BluetoothTest, BluetoothGattConnection) { |