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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 2783733002: Bluetooth: Add service data unit tests for chromeos (Closed)
Patch Set: Created 3 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
Index: device/bluetooth/bluetooth_device_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc
index ab478fc7386df4a49d9bf91a0645488354e48239..93f6ac7f9ecc91969ce1ea4a5e153be510b699a0 100644
--- a/device/bluetooth/bluetooth_device_unittest.cc
+++ b/device/bluetooth/bluetooth_device_unittest.cc
@@ -167,7 +167,7 @@ TEST_F(BluetoothTest, LowEnergyDeviceNoUUIDs) {
EXPECT_EQ(0u, uuids.size());
}
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
// TODO(ortuno): Enable on Android once it supports Service Data.
// http://crbug.com/639408
TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
@@ -176,7 +176,12 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
return;
}
InitWithFakeAdapter();
+
+#if !defined(OS_CHROMEOS)
+ // StartLowEnergyDiscoverySession is not yet implemented on ChromeOS|bluez.
+ // http://crbug.com/706043
StartLowEnergyDiscoverySession();
+#endif
// Receive Advertisement with service data.
BluetoothDevice* device = SimulateLowEnergyDevice(1);
@@ -189,7 +194,7 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
*device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDHeartRate)));
// Receive Advertisement with no service data.
- SimulateLowEnergyDevice(3);
+ device = SimulateLowEnergyDevice(3);
EXPECT_TRUE(device->GetServiceData().empty());
EXPECT_TRUE(device->GetServiceDataUUIDs().empty());
@@ -197,7 +202,7 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDHeartRate)));
// Receive Advertisement with new service data.
- SimulateLowEnergyDevice(2);
+ device = SimulateLowEnergyDevice(2);
EXPECT_EQ(ServiceDataMap({{BluetoothUUID(kTestUUIDHeartRate), {2}},
{BluetoothUUID(kTestUUIDImmediateAlert), {0}}}),
@@ -211,6 +216,7 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
std::vector<uint8_t>({0}),
*device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDImmediateAlert)));
+#if !defined(OS_CHROMEOS)
// Stop discovery.
discovery_sessions_[0]->Stop(GetCallback(Call::EXPECTED),
GetErrorCallback(Call::NOT_EXPECTED));
@@ -223,6 +229,7 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDHeartRate)));
EXPECT_EQ(nullptr, device->GetServiceDataForUUID(
BluetoothUUID(kTestUUIDImmediateAlert)));
+#endif
}
#endif // defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698