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

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: address comments Created 3 years, 10 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 d4c941279cbfdd87897fcdb2640070276bcea66b..cf3dd392928c0e6284fdd0e15c77a7199acf8a95 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
@@ -496,47 +496,6 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic) {
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-// Callback that make sure GattCharacteristicValueChanged has been called
ortuno 2017/03/06 09:15:37 Could you change an existing test to assert that t
juncai 2017/03/08 23:20:39 Done.
-// before the callback runs.
-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());
- callback.Run(value);
-}
-
-// Tests that ReadRemoteCharacteristic results in a
-// GattCharacteristicValueChanged call.
-TEST_F(BluetoothRemoteGattCharacteristicTest,
- ReadRemoteCharacteristic_GattCharacteristicValueChanged) {
- if (!PlatformSupportsLowEnergy()) {
- LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
- return;
- }
- ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate(
- BluetoothRemoteGattCharacteristic::PROPERTY_READ));
-
- TestBluetoothAdapterObserver observer(adapter_);
-
- characteristic1_->ReadRemoteCharacteristic(
- base::Bind(test_callback, GetReadValueCallback(Call::EXPECTED),
- base::ConstRef(observer)),
- GetGattErrorCallback(Call::NOT_EXPECTED));
-
- std::vector<uint8_t> test_vector = {0, 1, 2, 3, 4, 0xf, 0xf0, 0xff};
- SimulateGattCharacteristicRead(characteristic1_, test_vector);
-
- 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());
-}
-#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-
-#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
// Tests WriteRemoteCharacteristic with non-empty value buffer.
TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic) {
if (!PlatformSupportsLowEnergy()) {

Powered by Google App Engine
This is Rietveld 408576698