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

Unified Diff: device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc

Issue 2728623004: Fix getting notified twice after subscribe to notifications and call readValue (Closed)
Patch Set: fixed device unittests 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/bluez/bluetooth_gatt_bluez_unittest.cc
diff --git a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
index d8538b6e0734214fa8b8e1704f42931132fd4edc..ce241038065b8b383599c6c53c4b85e9cf771ea4 100644
--- a/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
+++ b/device/bluetooth/bluez/bluetooth_gatt_bluez_unittest.cc
@@ -992,8 +992,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
BluetoothRemoteGattService* service =
device->GetGattService(observer.last_gatt_service_id());
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
ortuno 2017/03/03 05:28:37 Please update them to reflect the correct value ra
juncai 2017/03/04 01:33:59 Done.
-
// Run the message loop so that the characteristics appear.
base::RunLoop().Run();
@@ -1024,7 +1022,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(1, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED,
last_service_error_);
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
characteristic = service->GetCharacteristic(
fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath()
@@ -1046,7 +1043,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(2, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED,
last_service_error_);
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
// Issue write request to writable characteristic. The "Body Sensor Location"
// characteristic does not send notifications and WriteValue does not result
@@ -1070,7 +1066,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid());
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(2, error_callback_count_);
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
// Issue some invalid write requests to the characteristic.
// The value should still not change.
@@ -1087,7 +1082,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(3, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH,
last_service_error_);
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
std::vector<uint8_t> invalid_write_value;
invalid_write_value.push_back(0x02);
@@ -1099,7 +1093,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(1, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_FAILED, last_service_error_);
- EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count());
// Issue a read request. A successful read results in a
// CharacteristicValueChanged notification.
@@ -1119,7 +1112,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
base::Unretained(this)));
EXPECT_EQ(2, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
- EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count());
EXPECT_TRUE(ValuesEqual(characteristic->GetValue(), last_read_value_));
// Test long-running actions.
@@ -1143,7 +1135,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// tne next one.
EXPECT_EQ(2, success_callback_count_);
EXPECT_EQ(4, error_callback_count_);
- EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count());
// Next read should error because IN_PROGRESS
characteristic->ReadRemoteCharacteristic(
@@ -1157,7 +1148,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
// But previous call finished.
EXPECT_EQ(3, success_callback_count_);
- EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count());
EXPECT_TRUE(ValuesEqual(characteristic->GetValue(), last_read_value_));
fake_bluetooth_gatt_characteristic_client_->SetExtraProcessing(0);
@@ -1172,7 +1162,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(6, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_AUTHORIZED,
last_service_error_);
- EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthorized(true);
// Test unauthenticated / needs login.
@@ -1186,7 +1175,6 @@ TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) {
EXPECT_EQ(7, error_callback_count_);
EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_PAIRED,
last_service_error_);
- EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count());
fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true);
}

Powered by Google App Engine
This is Rietveld 408576698