Chromium Code Reviews| Index: device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc |
| diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc |
| index cc2186403f75d4fa8947fbfdec457d925a7a5e7c..135e22670a0e8ac625e5f0b60f6eee82542c078f 100644 |
| --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc |
| +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc |
| @@ -291,9 +291,13 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, GetService) { |
| } |
| #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) |
| // Tests ReadRemoteCharacteristic and GetValue with empty value buffer. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Empty) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -310,7 +314,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Empty) { |
| EXPECT_EQ(empty_vector, last_read_value_); |
| EXPECT_EQ(empty_vector, characteristic1_->GetValue()); |
| } |
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic with empty value buffer. |
| @@ -373,9 +377,13 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, |
| } |
| #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| -#if defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| // Tests ReadRemoteCharacteristic and GetValue with non-empty value buffer. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -395,7 +403,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic) { |
| EXPECT_EQ(test_vector, last_read_value_); |
| EXPECT_EQ(test_vector, characteristic1_->GetValue()); |
| } |
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic with non-empty value buffer. |
| @@ -416,9 +424,13 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic) { |
| } |
| #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| -#if defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| // Tests ReadRemoteCharacteristic and GetValue multiple times. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Twice) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -448,7 +460,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, ReadRemoteCharacteristic_Twice) { |
| EXPECT_EQ(empty_vector, last_read_value_); |
| EXPECT_EQ(empty_vector, characteristic1_->GetValue()); |
| } |
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic multiple times. |
| @@ -483,10 +495,14 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, WriteRemoteCharacteristic_Twice) { |
| } |
| #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| -#if defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| // Tests ReadRemoteCharacteristic on two characteristics. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, |
| ReadRemoteCharacteristic_MultipleCharacteristics) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -515,7 +531,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, |
| EXPECT_EQ(test_vector1, characteristic1_->GetValue()); |
| EXPECT_EQ(test_vector2, characteristic2_->GetValue()); |
| } |
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic on two characteristics. |
| @@ -563,9 +579,13 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, |
| } |
| #endif // defined(OS_ANDROID) || defined(OS_WIN) |
| -#if defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| // Tests ReadRemoteCharacteristic asynchronous error. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, ReadError) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -579,7 +599,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, ReadError) { |
| EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, |
| last_gatt_error_code_); |
| } |
|
ortuno
2016/06/16 18:22:19
Also check that GattCharacteristicChanged hasn't b
jlebel
2016/06/22 18:03:58
Done.
|
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic asynchronous error. |
| @@ -659,10 +679,14 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, WriteSynchronousError) { |
| } |
| #endif // defined(OS_ANDROID) |
| -#if defined(OS_ANDROID) || defined(OS_WIN) |
| +#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| // Tests ReadRemoteCharacteristic error with a pending read operation. |
| TEST_F(BluetoothRemoteGattCharacteristicTest, |
| ReadRemoteCharacteristic_ReadPending) { |
| + if (!PlatformSupportsLowEnergy()) { |
| + LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
| + return; |
| + } |
| ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate( |
| BluetoothRemoteGattCharacteristic::PROPERTY_READ)); |
| @@ -687,7 +711,7 @@ TEST_F(BluetoothRemoteGattCharacteristicTest, |
| EXPECT_EQ(1, callback_count_); |
| EXPECT_EQ(0, error_callback_count_); |
| } |
| -#endif // defined(OS_ANDROID) || defined(OS_WIN) |
| +#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) |
| #if defined(OS_ANDROID) || defined(OS_WIN) |
| // Tests WriteRemoteCharacteristic error with a pending write operation. |