Chromium Code Reviews| Index: device/bluetooth/bluetooth_gatt_chromeos_unittest.cc |
| diff --git a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc |
| index de3750d82c0fad1de709aa180a034475edfabf10..f4720454eb0b5e5eb8642dac949c6889cc45058a 100644 |
| --- a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc |
| +++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc |
| @@ -1102,9 +1102,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { |
| EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), |
| descriptor->GetUUID()); |
| - std::vector<uint8> desc_value; |
| - desc_value.push_back(1); |
| - desc_value.push_back(0); |
| + std::vector<uint8_t> desc_value = {0x00, 0x00}; |
| /* The cached value will be empty until the first read request */ |
| EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); |
| @@ -1145,7 +1143,7 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { |
| EXPECT_EQ(0, observer.gatt_service_changed_count_); |
| EXPECT_EQ(1, observer.gatt_descriptor_value_changed_count_); |
| - // Read new value. |
| + // Read value. The value should remain unchanged. |
| descriptor->ReadRemoteDescriptor( |
| base::Bind(&BluetoothGattChromeOSTest::ValueCallback, |
| base::Unretained(this)), |
| @@ -1156,6 +1154,32 @@ TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { |
| EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
| EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); |
| EXPECT_EQ(0, observer.gatt_service_changed_count_); |
| + EXPECT_EQ(1, observer.gatt_descriptor_value_changed_count_); |
| + |
| + // Start notifications on the descriptor's characteristic. The descriptor |
| + // value should change. |
| + characteristic->StartNotifySession( |
|
Marie Janssen
2014/12/11 23:18:52
You should EXPECT_FALSE(characteristic->IsNotifyin
armansito
2015/02/03 01:54:38
Done.
|
| + base::Bind(&BluetoothGattChromeOSTest::NotifySessionCallback, |
| + base::Unretained(this)), |
| + base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback, |
| + base::Unretained(this))); |
| + base::MessageLoop::current()->Run(); |
| + EXPECT_EQ(3, success_callback_count_); |
| + EXPECT_EQ(1, error_callback_count_); |
| + EXPECT_EQ(1U, update_sessions_.size()); |
| + EXPECT_TRUE(characteristic->IsNotifying()); |
| + |
| + // Read the new descriptor value. We should receive a value updated event. |
| + descriptor->ReadRemoteDescriptor( |
| + base::Bind(&BluetoothGattChromeOSTest::ValueCallback, |
| + base::Unretained(this)), |
| + base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback, |
| + base::Unretained(this))); |
| + EXPECT_EQ(4, success_callback_count_); |
| + EXPECT_EQ(1, error_callback_count_); |
| + EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
| + EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); |
| + EXPECT_EQ(0, observer.gatt_service_changed_count_); |
| EXPECT_EQ(2, observer.gatt_descriptor_value_changed_count_); |
| } |