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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 2783733002: Bluetooth: Add service data unit tests for chromeos (Closed)
Patch Set: Incoporate comments 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..197d2d3bd6774ba91a5f3f362a4b8c67e1b1b13b 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)
ortuno 2017/03/30 02:58:14 Would you mind enabling this on Linux as well? Al
Miao 2017/03/30 21:20:07 Agree on this, we don't have any Chromium specific
xiaoyinh(OOO Sep 11-29) 2017/03/31 16:26:53 Done.
// 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.
ortuno 2017/03/30 02:58:14 nit: TODO(crbug.com/706043): Remove #if once Start
xiaoyinh(OOO Sep 11-29) 2017/03/31 16:26:52 Done.
+ // http://crbug.com/706043
StartLowEnergyDiscoverySession();
+#endif
// Receive Advertisement with service data.
BluetoothDevice* device = SimulateLowEnergyDevice(1);
@@ -199,18 +204,19 @@ TEST_F(BluetoothTest, GetServiceDataUUIDs_GetServiceDataForUUID) {
// Receive Advertisement with new service data.
SimulateLowEnergyDevice(2);
- EXPECT_EQ(ServiceDataMap({{BluetoothUUID(kTestUUIDHeartRate), {2}},
- {BluetoothUUID(kTestUUIDImmediateAlert), {0}}}),
+ EXPECT_EQ(ServiceDataMap({{BluetoothUUID(kTestUUIDHeartRate), {}},
+ {BluetoothUUID(kTestUUIDImmediateAlert), {0, 2}}}),
device->GetServiceData());
EXPECT_EQ(UUIDSet({BluetoothUUID(kTestUUIDHeartRate),
BluetoothUUID(kTestUUIDImmediateAlert)}),
device->GetServiceDataUUIDs());
- EXPECT_EQ(std::vector<uint8_t>({2}),
+ EXPECT_EQ(std::vector<uint8_t>({}),
*device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDHeartRate)));
EXPECT_EQ(
- std::vector<uint8_t>({0}),
+ std::vector<uint8_t>({0, 2}),
*device->GetServiceDataForUUID(BluetoothUUID(kTestUUIDImmediateAlert)));
+#if !defined(OS_CHROMEOS)
ortuno 2017/03/30 02:58:14 TODO(crbug.com/706043): Remove #if once StartLowEn
xiaoyinh(OOO Sep 11-29) 2017/03/31 16:26:52 Done.
// 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