summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorscheib <scheib@chromium.org>2016-03-14 16:25:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-14 23:26:59 +0000
commitc0449e880afd4175daddff4960ec12290618ed0e (patch)
treea475a6d91de06214f6aafb68932fa86788ed54a6 /device
parentce1f4d009316d8f5f4c49b18e1bd94687d80c59d (diff)
downloadchromium_src-c0449e880afd4175daddff4960ec12290618ed0e.zip
chromium_src-c0449e880afd4175daddff4960ec12290618ed0e.tar.gz
chromium_src-c0449e880afd4175daddff4960ec12290618ed0e.tar.bz2
bluetooth: Move StartNotifySession_Multiple adjacent to related tests.
Improve bluetooth_gatt_characteristic_unittest.cc readability by keeping StartNotifySessions_ tests contiguous. R=ortuno@chromium.org Review URL: https://codereview.chromium.org/1784913004 Cr-Commit-Position: refs/heads/master@{#381109}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_gatt_characteristic_unittest.cc68
1 files changed, 34 insertions, 34 deletions
diff --git a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
index ba3e25b..93a0c9e 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());