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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_unittest.cc

Issue 1950033002: bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Fixing the build Created 4 years, 6 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 | « device/bluetooth/bluetooth_remote_gatt_service_mac.mm ('k') | device/bluetooth/test/bluetooth_test_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_remote_gatt_service_unittest.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_service_unittest.cc
index 4e8c00c6c41e4758aa1fb98dfcc8d4d91b56a9aa..0454f608aec8ebc9593504ac85a3cfdf45ea789e 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_unittest.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_unittest.cc
@@ -23,7 +23,7 @@ namespace device {
class BluetoothRemoteGattServiceTest : public BluetoothTest {};
#endif
-#if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_MACOSX)
+#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetIdentifier) {
if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
@@ -63,9 +63,9 @@ TEST_F(BluetoothRemoteGattServiceTest, GetIdentifier) {
EXPECT_NE(service3->GetIdentifier(), service4->GetIdentifier());
}
-#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_MACOSX)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-#if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_MACOSX)
+#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetUUID) {
if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
@@ -89,9 +89,9 @@ TEST_F(BluetoothRemoteGattServiceTest, GetUUID) {
EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID());
EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID());
}
-#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_MACOSX)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-#if defined(OS_ANDROID) || defined(OS_WIN)
+#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristics_FindNone) {
if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
@@ -112,11 +112,15 @@ TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristics_FindNone) {
EXPECT_EQ(0u, service->GetCharacteristics().size());
}
-#endif // defined(OS_ANDROID) || defined(OS_WIN)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-#if defined(OS_ANDROID) || defined(OS_WIN)
+#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest,
GetCharacteristics_and_GetCharacteristic) {
+ if (!PlatformSupportsLowEnergy()) {
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
+ return;
+ }
InitWithFakeAdapter();
StartLowEnergyDiscoverySession();
BluetoothDevice* device = SimulateLowEnergyDevice(3);
@@ -161,11 +165,15 @@ TEST_F(BluetoothRemoteGattServiceTest,
EXPECT_EQ(service->GetCharacteristic(char_id1),
service->GetCharacteristic(char_id1));
}
-#endif // defined(OS_ANDROID) || defined(OS_WIN)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
-#if defined(OS_WIN)
+#if defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest,
GetCharacteristic_CharacteristicRemoved) {
+ if (!PlatformSupportsLowEnergy()) {
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
+ return;
+ }
InitWithFakeAdapter();
StartLowEnergyDiscoverySession();
BluetoothDevice* device = SimulateLowEnergyDevice(3);
@@ -216,9 +224,16 @@ TEST_F(BluetoothRemoteGattServiceTest,
EXPECT_FALSE(service->GetCharacteristic(removed_char));
EXPECT_EQ(0u, service->GetCharacteristics().size());
+#if defined(OS_MACOSX)
+ // SimulateGattServicesDiscovered
+ // 4 * SimulateGattCharacteristic
+ // 4 * SimulateGattCharacteristicRemoved
+ EXPECT_EQ(9, observer.gatt_service_changed_count());
+#else // defined(OS_MACOSX)
EXPECT_EQ(4, observer.gatt_service_changed_count());
+#endif // defined(OS_MACOSX)
}
-#endif // defined(OS_WIN)
+#endif // defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_WIN) || defined(OS_MACOSX)
TEST_F(BluetoothRemoteGattServiceTest, SimulateGattServiceRemove) {
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.mm ('k') | device/bluetooth/test/bluetooth_test_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698