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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc

Issue 2728623004: Fix getting notified twice after subscribe to notifications and call readValue (Closed)
Patch Set: updated test code Created 3 years, 9 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
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 e21e347fe86d53bc65f70c7fe51aa55ce77d4c5d..0e779e75f4c5618f1590778f9dd139f9b10b323d 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
@@ -526,14 +526,14 @@ static void test_callback(
BluetoothRemoteGattCharacteristic::ValueCallback callback,
const TestBluetoothAdapterObserver& callback_observer,
const std::vector<uint8_t>& value) {
- EXPECT_EQ(1, callback_observer.gatt_characteristic_value_changed_count());
+ EXPECT_EQ(0, callback_observer.gatt_characteristic_value_changed_count());
callback.Run(value);
}
-// Tests that ReadRemoteCharacteristic results in a
+// Tests that ReadRemoteCharacteristic doesn't result in a
// GattCharacteristicValueChanged call.
TEST_F(BluetoothRemoteGattCharacteristicTest,
- ReadRemoteCharacteristic_GattCharacteristicValueChanged) {
+ ReadRemoteCharacteristic_GattCharacteristicValueChangedNotCalled) {
if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return;
@@ -552,12 +552,17 @@ TEST_F(BluetoothRemoteGattCharacteristicTest,
SimulateGattCharacteristicRead(characteristic1_, test_vector);
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count());
- EXPECT_EQ(characteristic1_->GetIdentifier(),
- observer.last_gatt_characteristic_id());
- EXPECT_EQ(characteristic1_->GetUUID(),
- observer.last_gatt_characteristic_uuid());
- EXPECT_EQ(test_vector, observer.last_changed_characteristic_value());
+ EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
+// TODO(https://crbug.com/699694): Remove this #if once the bug on Windows is
+// fixed.
+#if defined(OS_WIN)
+ EXPECT_FALSE(observer.last_gatt_characteristic_id().empty());
+ EXPECT_TRUE(observer.last_gatt_characteristic_uuid().IsValid());
+#else
+ EXPECT_TRUE(observer.last_gatt_characteristic_id().empty());
+ EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
+#endif // defined(OS_WIN)
+ EXPECT_TRUE(observer.last_changed_characteristic_value().empty());
}
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)

Powered by Google App Engine
This is Rietveld 408576698