Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc

Issue 2646443010: bluetooth: Test cancelling a Stop notify session request (Closed)
Patch Set: Add TODO Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
index 0b09275d3f8ca3683ec07e9250492f7b23ad5288..a0ee705f9173ccb1c95a6afb6f176a3ef30cfc37 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
@@ -1514,6 +1514,32 @@ TEST_F(BluetoothRemoteGattCharacteristicTest,
#endif // defined(OS_ANDROID)
#if defined(OS_ANDROID)
+// Tests that cancelling StopNotifySession works.
+// TODO(crbug.com/633191): Enable on macOS when SubscribeToNotifications is
+// implemented.
+// TODO(crbug.com/636270): Enable on Windows when SubscribeToNotifications is
+// implemented.
+TEST_F(BluetoothRemoteGattCharacteristicTest, StopNotifySession_Cancelled) {
+ ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
+ /* properties: NOTIFY */ 0x10,
+ /* expected_config_descriptor_value: NOTIFY */ 1));
+
+ // Check that the session is correctly setup.
+ std::string characteristic_identifier = characteristic1_->GetIdentifier();
+ EXPECT_EQ(characteristic_identifier,
+ notify_sessions_[0]->GetCharacteristicIdentifier());
+ EXPECT_EQ(characteristic1_, notify_sessions_[0]->GetCharacteristic());
+ EXPECT_TRUE(notify_sessions_[0]->IsActive());
+
+ // Queue a Stop request.
+ notify_sessions_[0]->Stop(GetStopNotifyCallback(Call::EXPECTED));
+
+ // Cancel Stop by deleting the device before Stop finishes.
+ DeleteDevice(device_); // TODO(576906) delete only the characteristic.
+}
+#endif // defined(OS_ANDROID)
+
+#if defined(OS_ANDROID)
// Tests that deleted sessions are stopped.
TEST_F(BluetoothRemoteGattCharacteristicTest, StopNotifySession_AfterDeleted) {
ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698