Chromium Code Reviews| Index: device/bluetooth/bluetooth_gatt_characteristic_unittest.cc |
| diff --git a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc |
| index 3b980d1d470d90b16f77f72dea1647bbf71421ff..ae79a43a7116ead71156437953f6540841247c69 100644 |
| --- a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc |
| +++ b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc |
| @@ -896,6 +896,44 @@ TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) { |
| } |
| #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_WIN) |
| +// Tests StartNotifySession reentrant in start notify session error callback. |
| +TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Reentrant) { |
|
scheib
2016/03/19 04:58:07
Please test all 4 combinations of
initial callba
gogerald1
2016/04/21 21:05:22
Done. "success, error" looks impossible in current
|
| + ASSERT_NO_FATAL_FAILURE( |
| + FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10)); |
| + SimulateGattDescriptor( |
| + characteristic1_, |
| + /* Client Characteristic Configuration descriptor's standard UUID: */ |
| + "00002902-0000-1000-8000-00805F9B34FB"); |
|
scheib
2016/03/19 04:58:07
BluetoothGattDescriptor::ClientCharacteristicConfi
gogerald1
2016/04/21 21:05:22
Done.
|
| + ASSERT_EQ(1u, characteristic1_->GetDescriptors().size()); |
| + |
| + SimulateGattCharacteristicSetNotifyWillFailAsynchronouslyOnce( |
| + characteristic1_); |
| + |
| + characteristic1_->StartNotifySession( |
| + GetNotifyCallback(Call::NOT_EXPECTED), |
| + GetReentrantStartNotifySessionErrorCallback(Call::EXPECTED, |
| + characteristic1_)); |
| + EXPECT_EQ(0, callback_count_); |
| + SimulateGattNotifySessionStarted(characteristic1_); |
| + EXPECT_EQ(0, gatt_notify_characteristic_attempts_); |
| + EXPECT_EQ(0, callback_count_); |
| + EXPECT_EQ(1, error_callback_count_); |
| + ASSERT_EQ(0u, notify_sessions_.size()); |
| + |
| + // Simulate reentrant StartNotifySession request from |
| + // BluetoothTestBase::ReentrantStartNotifySessionErrorCallback. |
| + SimulateGattNotifySessionStarted(characteristic1_); |
| + EXPECT_EQ(1, gatt_notify_characteristic_attempts_); |
| + EXPECT_EQ(1, callback_count_); |
| + ASSERT_EQ(1u, notify_sessions_.size()); |
| + ASSERT_TRUE(notify_sessions_[0]); |
| + EXPECT_EQ(characteristic1_->GetIdentifier(), |
| + notify_sessions_[0]->GetCharacteristicIdentifier()); |
| + EXPECT_TRUE(notify_sessions_[0]->IsActive()); |
| +} |
| +#endif // defined(OS_WIN) |
| + |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests Characteristic Value changes during a Notify Session. |
| TEST_F(BluetoothGattCharacteristicTest, GattCharacteristicValueChanged) { |