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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 1394973003: bluetooth: android: Create BluetoothRemoteGattServiceAndroid objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-renames-
Patch Set: Created 5 years, 2 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_device_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc
index 2aa9688e0168f6370bd2457b8d04d9ec16751764..7a43df6d93fde9bd91f77a4f6f54405d93662c8b 100644
--- a/device/bluetooth/bluetooth_device_unittest.cc
+++ b/device/bluetooth/bluetooth_device_unittest.cc
@@ -425,4 +425,38 @@ TEST_F(BluetoothTest, BluetoothGattConnection_ErrorAfterConnection) {
}
#endif // defined(OS_ANDROID)
+#if defined(OS_ANDROID)
+TEST_F(BluetoothTest, SimulateGattServicesDiscovered) {
+ InitWithFakeAdapter();
+ StartDiscoverySession();
+ BluetoothDevice* device = DiscoverLowEnergyDevice(3);
+ device->CreateGattConnection(GetGattConnectionCallback(),
+ GetConnectErrorCallback());
+ ResetEventCounts();
ortuno 2015/10/08 22:53:27 Any reason why you have this here instead of in a
scheib 2015/10/08 23:52:19 Placing it immediately before and the EXPECT after
+ SimulateGattConnection(device);
+ EXPECT_EQ(1, gatt_discovery_attempts_);
+
+ // TODO(scheib): Add more control over how many services are created and
+ // their properties.
ortuno 2015/10/08 22:53:27 Link to issue?
scheib 2015/10/08 23:52:20 Done.
+ SimulateGattServicesDiscovered(device);
+ EXPECT_EQ(2u, device->GetGattServices().size());
+}
+#endif // defined(OS_ANDROID)
+
+#if defined(OS_ANDROID)
+TEST_F(BluetoothTest, SimulateGattServicesDiscoveryError) {
+ InitWithFakeAdapter();
+ StartDiscoverySession();
+ BluetoothDevice* device = DiscoverLowEnergyDevice(3);
+ device->CreateGattConnection(GetGattConnectionCallback(),
+ GetConnectErrorCallback());
+ ResetEventCounts();
+ SimulateGattConnection(device);
+ EXPECT_EQ(1, gatt_discovery_attempts_);
+
+ SimulateGattServicesDiscoveryError(device);
+ EXPECT_EQ(0u, device->GetGattServices().size());
+}
+#endif // defined(OS_ANDROID)
+
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698