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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 1260533003: BluetoothTest.* tests in bluetooth_device_unittests.cc run on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test2
Patch Set: Created 5 years, 4 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 | « no previous file | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc
index 3e8d264efee8e5d99765ab80997ed46bb8dd055d..4cea1b6fa6e48e13990e2564085aae1aad3bb134 100644
--- a/device/bluetooth/bluetooth_device_unittest.cc
+++ b/device/bluetooth/bluetooth_device_unittest.cc
@@ -12,6 +12,8 @@
#if defined(OS_ANDROID)
#include "device/bluetooth/test/bluetooth_test_android.h"
+#elif defined(OS_MACOSX)
+#include "device/bluetooth/test/bluetooth_test_mac.h"
#endif
namespace device {
@@ -63,9 +65,13 @@ TEST(BluetoothDeviceTest, CanonicalizeAddressFormat_RejectsInvalidFormats) {
}
}
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) || defined(OS_MACOSX)
// Verifies basic device properties, e.g. GetAddress, GetName, ...
-TEST_F(BluetoothTest, DeviceProperties) {
+TEST_F(BluetoothTest, LowEnergyDeviceProperties) {
+ if (!PlatformSupportsLowEnergy()) {
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
+ return;
+ }
InitWithFakeAdapter();
TestBluetoothAdapterObserver observer(adapter_);
@@ -82,17 +88,21 @@ TEST_F(BluetoothTest, DeviceProperties) {
EXPECT_EQ(0, device->GetVendorID());
EXPECT_EQ(0, device->GetProductID());
EXPECT_EQ(0, device->GetDeviceID());
- EXPECT_EQ(base::UTF8ToUTF16("FakeBluetoothDevice"), device->GetName());
- EXPECT_EQ(true, device->IsPaired());
+ EXPECT_EQ(base::UTF8ToUTF16(kTestDeviceName), device->GetName());
+ EXPECT_FALSE(device->IsPaired());
BluetoothDevice::UUIDList uuids = device->GetUUIDs();
- EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1800")));
- EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID("1801")));
+ EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID(kTestUUIDGenericAccess)));
+ EXPECT_TRUE(ContainsValue(uuids, BluetoothUUID(kTestUUIDGenericAttribute)));
}
-#endif // defined(OS_ANDROID)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX)
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) || defined(OS_MACOSX)
// Device with no advertised Service UUIDs.
-TEST_F(BluetoothTest, DeviceNoUUIDs) {
+TEST_F(BluetoothTest, LowEnergyDeviceNoUUIDs) {
+ if (!PlatformSupportsLowEnergy()) {
+ LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
+ return;
+ }
InitWithFakeAdapter();
TestBluetoothAdapterObserver observer(adapter_);
@@ -106,7 +116,7 @@ TEST_F(BluetoothTest, DeviceNoUUIDs) {
BluetoothDevice::UUIDList uuids = device->GetUUIDs();
EXPECT_EQ(0u, uuids.size());
}
-#endif // defined(OS_ANDROID)
+#endif // defined(OS_ANDROID) || defined(OS_MACOSX)
// TODO(scheib): Test with a device with no name. http://crbug.com/506415
// BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698