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

Unified Diff: device/bluetooth/bluetooth_gatt_characteristic_unittest.cc

Issue 1784913004: bluetooth: Move StartNotifySession_Multiple adjacent to related tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« 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_gatt_characteristic_unittest.cc
diff --git a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
index ba3e25ba371760cdbb8e6d448752569f9a8d7549..93a0c9ed93b17bdc5216be7b9cd0f35734bb2cb1 100644
--- a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
@@ -849,6 +849,40 @@ TEST_F(BluetoothGattCharacteristicTest,
#endif // defined(OS_ANDROID)
#if defined(OS_ANDROID)
+// Tests multiple StartNotifySession success.
+TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) {
+ ASSERT_NO_FATAL_FAILURE(
+ FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10));
+ SimulateGattDescriptor(
+ characteristic1_,
+ /* Client Characteristic Configuration descriptor's standard UUID: */
+ "00002902-0000-1000-8000-00805F9B34FB");
+ ASSERT_EQ(1u, characteristic1_->GetDescriptors().size());
+
+ characteristic1_->StartNotifySession(
+ GetNotifyCallback(Call::EXPECTED),
+ GetGattErrorCallback(Call::NOT_EXPECTED));
+ characteristic1_->StartNotifySession(
+ GetNotifyCallback(Call::EXPECTED),
+ GetGattErrorCallback(Call::NOT_EXPECTED));
+ EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
+ EXPECT_EQ(0, callback_count_);
+ SimulateGattNotifySessionStarted(characteristic1_);
+ EXPECT_EQ(2, callback_count_);
+ EXPECT_EQ(0, error_callback_count_);
+ ASSERT_EQ(2u, notify_sessions_.size());
+ ASSERT_TRUE(notify_sessions_[0]);
+ ASSERT_TRUE(notify_sessions_[1]);
+ EXPECT_EQ(characteristic1_->GetIdentifier(),
+ notify_sessions_[0]->GetCharacteristicIdentifier());
+ EXPECT_EQ(characteristic1_->GetIdentifier(),
+ notify_sessions_[1]->GetCharacteristicIdentifier());
+ EXPECT_TRUE(notify_sessions_[0]->IsActive());
+ EXPECT_TRUE(notify_sessions_[1]->IsActive());
+}
+#endif // defined(OS_ANDROID)
+
+#if defined(OS_ANDROID)
// Tests Characteristic Value changes during a Notify Session.
TEST_F(BluetoothGattCharacteristicTest, GattCharacteristicValueChanged) {
ASSERT_NO_FATAL_FAILURE(StartNotifyBoilerplate(
@@ -890,40 +924,6 @@ TEST_F(BluetoothGattCharacteristicTest,
}
#endif // defined(OS_ANDROID)
-#if defined(OS_ANDROID)
-// Tests multiple StartNotifySession success.
-TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) {
- ASSERT_NO_FATAL_FAILURE(
- FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10));
- SimulateGattDescriptor(
- characteristic1_,
- /* Client Characteristic Configuration descriptor's standard UUID: */
- "00002902-0000-1000-8000-00805F9B34FB");
- ASSERT_EQ(1u, characteristic1_->GetDescriptors().size());
-
- characteristic1_->StartNotifySession(
- GetNotifyCallback(Call::EXPECTED),
- GetGattErrorCallback(Call::NOT_EXPECTED));
- characteristic1_->StartNotifySession(
- GetNotifyCallback(Call::EXPECTED),
- GetGattErrorCallback(Call::NOT_EXPECTED));
- EXPECT_EQ(1, gatt_notify_characteristic_attempts_);
- EXPECT_EQ(0, callback_count_);
- SimulateGattNotifySessionStarted(characteristic1_);
- EXPECT_EQ(2, callback_count_);
- EXPECT_EQ(0, error_callback_count_);
- ASSERT_EQ(2u, notify_sessions_.size());
- ASSERT_TRUE(notify_sessions_[0]);
- ASSERT_TRUE(notify_sessions_[1]);
- EXPECT_EQ(characteristic1_->GetIdentifier(),
- notify_sessions_[0]->GetCharacteristicIdentifier());
- EXPECT_EQ(characteristic1_->GetIdentifier(),
- notify_sessions_[1]->GetCharacteristicIdentifier());
- EXPECT_TRUE(notify_sessions_[0]->IsActive());
- EXPECT_TRUE(notify_sessions_[1]->IsActive());
-}
-#endif // defined(OS_ANDROID)
-
#if defined(OS_ANDROID) || defined(OS_WIN)
TEST_F(BluetoothGattCharacteristicTest, GetDescriptors_FindNone) {
ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate());
« 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