Commit 008fe2b6 authored by Arman Ghotb's avatar Arman Ghotb Committed by Commit Bot

[bluetooth] modified platform independent tests to always be compiled

Changed platform checks to the gtest standard so incompatible platforms
will still compile but not run.

R=jdoerrie@chromium.org, ortuno@chromium.org, reillyg@chromium.org

Bug: 805274
Change-Id: Iacc11199b792e4637667175cddf85294a23afd98
Reviewed-on: https://chromium-review.googlesource.com/945371Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544107}
parent aa143296
...@@ -81,6 +81,7 @@ Antonin Hildebrand <antonin.hildebrand@gmail.com> ...@@ -81,6 +81,7 @@ Antonin Hildebrand <antonin.hildebrand@gmail.com>
Antonio Gomes <a1.gomes@sisa.samsung.com> Antonio Gomes <a1.gomes@sisa.samsung.com>
Anuj Kumar Sharma <anujk.sharma@samsung.com> Anuj Kumar Sharma <anujk.sharma@samsung.com>
Arjun Karthik <arjunkar@amazon.com> Arjun Karthik <arjunkar@amazon.com>
Arman Ghotb <armanghotb@gmail.com>
Armin Burgmeier <aburgmeier@bloomberg.net> Armin Burgmeier <aburgmeier@bloomberg.net>
Arnaud Renevier <a.renevier@samsung.com> Arnaud Renevier <a.renevier@samsung.com>
Arpita Bahuguna <a.bah@samsung.com> Arpita Bahuguna <a.bah@samsung.com>
......
...@@ -55,7 +55,12 @@ class BluetoothLocalGattCharacteristicTest : public BluetoothGattServerTest { ...@@ -55,7 +55,12 @@ class BluetoothLocalGattCharacteristicTest : public BluetoothGattServerTest {
}; };
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValue) { #define MAYBE_ReadLocalCharacteristicValue ReadLocalCharacteristicValue
#else
#define MAYBE_ReadLocalCharacteristicValue DISABLED_ReadLocalCharacteristicValue
#endif
TEST_F(BluetoothLocalGattCharacteristicTest,
MAYBE_ReadLocalCharacteristicValue) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
SimulateLocalGattCharacteristicValueReadRequest( SimulateLocalGattCharacteristicValueReadRequest(
device_, read_characteristic_.get(), GetReadValueCallback(Call::EXPECTED), device_, read_characteristic_.get(), GetReadValueCallback(Call::EXPECTED),
...@@ -64,10 +69,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValue) { ...@@ -64,10 +69,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValue) {
EXPECT_EQ(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_EQ(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, WriteLocalCharacteristicValue) { #define MAYBE_WriteLocalCharacteristicValue WriteLocalCharacteristicValue
#else
#define MAYBE_WriteLocalCharacteristicValue \
DISABLED_WriteLocalCharacteristicValue
#endif
TEST_F(BluetoothLocalGattCharacteristicTest,
MAYBE_WriteLocalCharacteristicValue) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
SimulateLocalGattCharacteristicValueWriteRequest( SimulateLocalGattCharacteristicValueWriteRequest(
device_, write_characteristic_.get(), GetValue(kValueToWrite), device_, write_characteristic_.get(), GetValue(kValueToWrite),
...@@ -76,10 +86,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, WriteLocalCharacteristicValue) { ...@@ -76,10 +86,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, WriteLocalCharacteristicValue) {
EXPECT_EQ(kValueToWrite, delegate_->last_written_value_); EXPECT_EQ(kValueToWrite, delegate_->last_written_value_);
EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValueFail) { #define MAYBE_ReadLocalCharacteristicValueFail ReadLocalCharacteristicValueFail
#else
#define MAYBE_ReadLocalCharacteristicValueFail \
DISABLED_ReadLocalCharacteristicValueFail
#endif
TEST_F(BluetoothLocalGattCharacteristicTest,
MAYBE_ReadLocalCharacteristicValueFail) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
delegate_->should_fail_ = true; delegate_->should_fail_ = true;
SimulateLocalGattCharacteristicValueReadRequest( SimulateLocalGattCharacteristicValueReadRequest(
...@@ -89,11 +104,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValueFail) { ...@@ -89,11 +104,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ReadLocalCharacteristicValueFail) {
EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_ReadLocalCharacteristicValueWrongPermission \
ReadLocalCharacteristicValueWrongPermission
#else
#define MAYBE_ReadLocalCharacteristicValueWrongPermission \
DISABLED_ReadLocalCharacteristicValueWrongPermission
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, TEST_F(BluetoothLocalGattCharacteristicTest,
ReadLocalCharacteristicValueWrongPermission) { MAYBE_ReadLocalCharacteristicValueWrongPermission) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
SimulateLocalGattCharacteristicValueReadRequest( SimulateLocalGattCharacteristicValueReadRequest(
device_, write_characteristic_.get(), device_, write_characteristic_.get(),
...@@ -102,11 +122,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ...@@ -102,11 +122,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest,
EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_WriteLocalCharacteristicValueFail \
WriteLocalCharacteristicValueFail
#else
#define MAYBE_WriteLocalCharacteristicValueFail \
DISABLED_WriteLocalCharacteristicValueFail
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, TEST_F(BluetoothLocalGattCharacteristicTest,
WriteLocalCharacteristicValueFail) { MAYBE_WriteLocalCharacteristicValueFail) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
delegate_->should_fail_ = true; delegate_->should_fail_ = true;
SimulateLocalGattCharacteristicValueWriteRequest( SimulateLocalGattCharacteristicValueWriteRequest(
...@@ -116,11 +141,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ...@@ -116,11 +141,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest,
EXPECT_NE(kValueToWrite, delegate_->last_written_value_); EXPECT_NE(kValueToWrite, delegate_->last_written_value_);
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_WriteLocalCharacteristicValueWrongPermission \
WriteLocalCharacteristicValueWrongPermission
#else
#define MAYBE_WriteLocalCharacteristicValueWrongPermission \
DISABLED_WriteLocalCharacteristicValueWrongPermission
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, TEST_F(BluetoothLocalGattCharacteristicTest,
WriteLocalCharacteristicValueWrongPermission) { MAYBE_WriteLocalCharacteristicValueWrongPermission) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
SimulateLocalGattCharacteristicValueWriteRequest( SimulateLocalGattCharacteristicValueWriteRequest(
device_, read_characteristic_.get(), GetValue(kValueToWrite), device_, read_characteristic_.get(), GetValue(kValueToWrite),
...@@ -129,10 +159,13 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ...@@ -129,10 +159,13 @@ TEST_F(BluetoothLocalGattCharacteristicTest,
EXPECT_NE(kValueToWrite, delegate_->last_written_value_); EXPECT_NE(kValueToWrite, delegate_->last_written_value_);
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, StartAndStopNotifications) { #define MAYBE_StartAndStopNotifications StartAndStopNotifications
#else
#define MAYBE_StartAndStopNotifications DISABLED_StartAndStopNotifications
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, MAYBE_StartAndStopNotifications) {
EXPECT_FALSE(SimulateLocalGattCharacteristicNotificationsRequest( EXPECT_FALSE(SimulateLocalGattCharacteristicNotificationsRequest(
read_characteristic_.get(), true)); read_characteristic_.get(), true));
EXPECT_FALSE(delegate_->NotificationStatusForCharacteristic( EXPECT_FALSE(delegate_->NotificationStatusForCharacteristic(
...@@ -153,10 +186,13 @@ TEST_F(BluetoothLocalGattCharacteristicTest, StartAndStopNotifications) { ...@@ -153,10 +186,13 @@ TEST_F(BluetoothLocalGattCharacteristicTest, StartAndStopNotifications) {
EXPECT_FALSE(delegate_->NotificationStatusForCharacteristic( EXPECT_FALSE(delegate_->NotificationStatusForCharacteristic(
notify_characteristic_.get())); notify_characteristic_.get()));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, SendNotifications) { #define MAYBE_SendNotifications SendNotifications
#else
#define MAYBE_SendNotifications DISABLED_SendNotifications
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, MAYBE_SendNotifications) {
const uint64_t kNotifyValue = 0x7331ul; const uint64_t kNotifyValue = 0x7331ul;
EXPECT_EQ(BluetoothLocalGattCharacteristic::NOTIFICATION_SUCCESS, EXPECT_EQ(BluetoothLocalGattCharacteristic::NOTIFICATION_SUCCESS,
notify_characteristic_->NotifyValueChanged( notify_characteristic_->NotifyValueChanged(
...@@ -171,10 +207,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, SendNotifications) { ...@@ -171,10 +207,15 @@ TEST_F(BluetoothLocalGattCharacteristicTest, SendNotifications) {
EXPECT_EQ(kIndicateValue, GetInteger(LastNotifactionValueForCharacteristic( EXPECT_EQ(kIndicateValue, GetInteger(LastNotifactionValueForCharacteristic(
indicate_characteristic_.get()))); indicate_characteristic_.get())));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattCharacteristicTest, SendNotificationsWrongProperties) { #define MAYBE_SendNotificationsWrongProperties SendNotificationsWrongProperties
#else
#define MAYBE_SendNotificationsWrongProperties \
DISABLED_SendNotificationsWrongProperties
#endif
TEST_F(BluetoothLocalGattCharacteristicTest,
MAYBE_SendNotificationsWrongProperties) {
const uint64_t kNewValue = 0x3334ul; const uint64_t kNewValue = 0x3334ul;
EXPECT_EQ(BluetoothLocalGattCharacteristic::NOTIFY_PROPERTY_NOT_SET, EXPECT_EQ(BluetoothLocalGattCharacteristic::NOTIFY_PROPERTY_NOT_SET,
read_characteristic_->NotifyValueChanged( read_characteristic_->NotifyValueChanged(
...@@ -202,11 +243,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, SendNotificationsWrongProperties) { ...@@ -202,11 +243,16 @@ TEST_F(BluetoothLocalGattCharacteristicTest, SendNotificationsWrongProperties) {
EXPECT_NE(kIndicateValue, GetInteger(LastNotifactionValueForCharacteristic( EXPECT_NE(kIndicateValue, GetInteger(LastNotifactionValueForCharacteristic(
indicate_characteristic_.get()))); indicate_characteristic_.get())));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_SendNotificationsServiceNotRegistered \
SendNotificationsServiceNotRegistered
#else
#define MAYBE_SendNotificationsServiceNotRegistered \
DISABLED_SendNotificationsServiceNotRegistered
#endif
TEST_F(BluetoothLocalGattCharacteristicTest, TEST_F(BluetoothLocalGattCharacteristicTest,
SendNotificationsServiceNotRegistered) { MAYBE_SendNotificationsServiceNotRegistered) {
service_->Unregister(GetCallback(Call::EXPECTED), service_->Unregister(GetCallback(Call::EXPECTED),
GetGattErrorCallback(Call::NOT_EXPECTED)); GetGattErrorCallback(Call::NOT_EXPECTED));
const uint64_t kNotifyValue = 0x7331ul; const uint64_t kNotifyValue = 0x7331ul;
...@@ -216,6 +262,5 @@ TEST_F(BluetoothLocalGattCharacteristicTest, ...@@ -216,6 +262,5 @@ TEST_F(BluetoothLocalGattCharacteristicTest,
EXPECT_NE(kNotifyValue, GetInteger(LastNotifactionValueForCharacteristic( EXPECT_NE(kNotifyValue, GetInteger(LastNotifactionValueForCharacteristic(
notify_characteristic_.get()))); notify_characteristic_.get())));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
} // namespace device } // namespace device
...@@ -47,7 +47,11 @@ class BluetoothLocalGattDescriptorTest : public BluetoothGattServerTest { ...@@ -47,7 +47,11 @@ class BluetoothLocalGattDescriptorTest : public BluetoothGattServerTest {
}; };
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValue) { #define MAYBE_ReadLocalDescriptorValue ReadLocalDescriptorValue
#else
#define MAYBE_ReadLocalDescriptorValue DISABLED_ReadLocalDescriptorValue
#endif
TEST_F(BluetoothLocalGattDescriptorTest, MAYBE_ReadLocalDescriptorValue) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
SimulateLocalGattDescriptorValueReadRequest( SimulateLocalGattDescriptorValueReadRequest(
device_, read_descriptor_.get(), GetReadValueCallback(Call::EXPECTED), device_, read_descriptor_.get(), GetReadValueCallback(Call::EXPECTED),
...@@ -56,10 +60,13 @@ TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValue) { ...@@ -56,10 +60,13 @@ TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValue) {
EXPECT_EQ(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_EQ(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValue) { #define MAYBE_WriteLocalDescriptorValue WriteLocalDescriptorValue
#else
#define MAYBE_WriteLocalDescriptorValue DISABLED_WriteLocalDescriptorValue
#endif
TEST_F(BluetoothLocalGattDescriptorTest, MAYBE_WriteLocalDescriptorValue) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
SimulateLocalGattDescriptorValueWriteRequest( SimulateLocalGattDescriptorValueWriteRequest(
device_, write_descriptor_.get(), GetValue(kValueToWrite), device_, write_descriptor_.get(), GetValue(kValueToWrite),
...@@ -68,10 +75,13 @@ TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValue) { ...@@ -68,10 +75,13 @@ TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValue) {
EXPECT_EQ(kValueToWrite, delegate_->last_written_value_); EXPECT_EQ(kValueToWrite, delegate_->last_written_value_);
EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_EQ(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValueFail) { #define MAYBE_ReadLocalDescriptorValueFail ReadLocalDescriptorValueFail
#else
#define MAYBE_ReadLocalDescriptorValueFail DISABLED_ReadLocalDescriptorValueFail
#endif
TEST_F(BluetoothLocalGattDescriptorTest, MAYBE_ReadLocalDescriptorValueFail) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
delegate_->should_fail_ = true; delegate_->should_fail_ = true;
SimulateLocalGattDescriptorValueReadRequest( SimulateLocalGattDescriptorValueReadRequest(
...@@ -81,10 +91,14 @@ TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValueFail) { ...@@ -81,10 +91,14 @@ TEST_F(BluetoothLocalGattDescriptorTest, ReadLocalDescriptorValueFail) {
EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValueFail) { #define MAYBE_WriteLocalDescriptorValueFail WriteLocalDescriptorValueFail
#else
#define MAYBE_WriteLocalDescriptorValueFail \
DISABLED_WriteLocalDescriptorValueFail
#endif
TEST_F(BluetoothLocalGattDescriptorTest, MAYBE_WriteLocalDescriptorValueFail) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
delegate_->should_fail_ = true; delegate_->should_fail_ = true;
SimulateLocalGattDescriptorValueWriteRequest( SimulateLocalGattDescriptorValueWriteRequest(
...@@ -94,11 +108,16 @@ TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValueFail) { ...@@ -94,11 +108,16 @@ TEST_F(BluetoothLocalGattDescriptorTest, WriteLocalDescriptorValueFail) {
EXPECT_NE(kValueToWrite, delegate_->last_written_value_); EXPECT_NE(kValueToWrite, delegate_->last_written_value_);
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_ReadLocalDescriptorValueWrongPermissions \
ReadLocalDescriptorValueWrongPermissions
#else
#define MAYBE_ReadLocalDescriptorValueWrongPermissions \
DISABLED_ReadLocalDescriptorValueWrongPermissions
#endif
TEST_F(BluetoothLocalGattDescriptorTest, TEST_F(BluetoothLocalGattDescriptorTest,
ReadLocalDescriptorValueWrongPermissions) { MAYBE_ReadLocalDescriptorValueWrongPermissions) {
delegate_->value_to_write_ = 0x1337; delegate_->value_to_write_ = 0x1337;
SimulateLocalGattDescriptorValueReadRequest( SimulateLocalGattDescriptorValueReadRequest(
device_, write_descriptor_.get(), device_, write_descriptor_.get(),
...@@ -107,11 +126,16 @@ TEST_F(BluetoothLocalGattDescriptorTest, ...@@ -107,11 +126,16 @@ TEST_F(BluetoothLocalGattDescriptorTest,
EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_)); EXPECT_NE(delegate_->value_to_write_, GetInteger(last_read_value_));
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
#define MAYBE_WriteLocalDescriptorValueWrongPermissions \
WriteLocalDescriptorValueWrongPermissions
#else
#define MAYBE_WriteLocalDescriptorValueWrongPermissions \
DISABLED_WriteLocalDescriptorValueWrongPermissions
#endif
TEST_F(BluetoothLocalGattDescriptorTest, TEST_F(BluetoothLocalGattDescriptorTest,
WriteLocalDescriptorValueWrongPermissions) { MAYBE_WriteLocalDescriptorValueWrongPermissions) {
const uint64_t kValueToWrite = 0x7331ul; const uint64_t kValueToWrite = 0x7331ul;
SimulateLocalGattDescriptorValueWriteRequest( SimulateLocalGattDescriptorValueWriteRequest(
device_, read_descriptor_.get(), GetValue(kValueToWrite), device_, read_descriptor_.get(), GetValue(kValueToWrite),
...@@ -120,6 +144,5 @@ TEST_F(BluetoothLocalGattDescriptorTest, ...@@ -120,6 +144,5 @@ TEST_F(BluetoothLocalGattDescriptorTest,
EXPECT_NE(kValueToWrite, delegate_->last_written_value_); EXPECT_NE(kValueToWrite, delegate_->last_written_value_);
EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_); EXPECT_NE(device_->GetIdentifier(), delegate_->last_seen_device_);
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
} // namespace device } // namespace device
...@@ -41,7 +41,11 @@ class BluetoothLocalGattServiceTest : public BluetoothGattServerTest { ...@@ -41,7 +41,11 @@ class BluetoothLocalGattServiceTest : public BluetoothGattServerTest {
}; };
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattServiceTest, RegisterMultipleServices) { #define MAYBE_RegisterMultipleServices RegisterMultipleServices
#else
#define MAYBE_RegisterMultipleServices DISABLED_RegisterMultipleServices
#endif
TEST_F(BluetoothLocalGattServiceTest, MAYBE_RegisterMultipleServices) {
base::WeakPtr<BluetoothLocalGattService> service2 = base::WeakPtr<BluetoothLocalGattService> service2 =
BluetoothLocalGattService::Create( BluetoothLocalGattService::Create(
adapter_.get(), BluetoothUUID(kTestUUIDGenericAttribute), true, adapter_.get(), BluetoothUUID(kTestUUIDGenericAttribute), true,
...@@ -85,10 +89,13 @@ TEST_F(BluetoothLocalGattServiceTest, RegisterMultipleServices) { ...@@ -85,10 +89,13 @@ TEST_F(BluetoothLocalGattServiceTest, RegisterMultipleServices) {
GetGattErrorCallback(Call::NOT_EXPECTED)); GetGattErrorCallback(Call::NOT_EXPECTED));
EXPECT_TRUE(ServiceSetsEqual(RegisteredGattServices(), {})); EXPECT_TRUE(ServiceSetsEqual(RegisteredGattServices(), {}));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
#if defined(OS_CHROMEOS) || defined(OS_LINUX) #if defined(OS_CHROMEOS) || defined(OS_LINUX)
TEST_F(BluetoothLocalGattServiceTest, DeleteServices) { #define MAYBE_DeleteServices DeleteServices
#else
#define MAYBE_DeleteServices DISABLED_DeleteServices
#endif
TEST_F(BluetoothLocalGattServiceTest, MAYBE_DeleteServices) {
base::WeakPtr<BluetoothLocalGattService> service2 = base::WeakPtr<BluetoothLocalGattService> service2 =
BluetoothLocalGattService::Create( BluetoothLocalGattService::Create(
adapter_.get(), BluetoothUUID(kTestUUIDGenericAttribute), true, adapter_.get(), BluetoothUUID(kTestUUIDGenericAttribute), true,
...@@ -128,6 +135,5 @@ TEST_F(BluetoothLocalGattServiceTest, DeleteServices) { ...@@ -128,6 +135,5 @@ TEST_F(BluetoothLocalGattServiceTest, DeleteServices) {
service4->Delete(); service4->Delete();
EXPECT_TRUE(ServiceSetsEqual(RegisteredGattServices(), {})); EXPECT_TRUE(ServiceSetsEqual(RegisteredGattServices(), {}));
} }
#endif // defined(OS_CHROMEOS) || defined(OS_LINUX)
} // namespace device } // namespace device
...@@ -15,17 +15,21 @@ ...@@ -15,17 +15,21 @@
#include "device/bluetooth/test/bluetooth_test_mac.h" #include "device/bluetooth/test/bluetooth_test_mac.h"
#elif defined(OS_WIN) #elif defined(OS_WIN)
#include "device/bluetooth/test/bluetooth_test_win.h" #include "device/bluetooth/test/bluetooth_test_win.h"
#elif defined(OS_CHROMEOS) || defined(OS_LINUX)
#include "device/bluetooth/test/bluetooth_test_bluez.h"
#endif #endif
namespace device { namespace device {
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
class BluetoothRemoteGattServiceTest : public BluetoothTest {}; class BluetoothRemoteGattServiceTest : public BluetoothTest {};
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
// Android is excluded because it fires a single discovery event per device. // Android is excluded because it fires a single discovery event per device.
#if defined(OS_WIN) || defined(OS_MACOSX) #if defined(OS_WIN) || defined(OS_MACOSX)
TEST_F(BluetoothRemoteGattServiceTest, IsDiscoveryComplete) { #define MAYBE_IsDiscoveryComplete IsDiscoveryComplete
#else
#define MAYBE_IsDiscoveryComplete DISABLED_IsDiscoveryComplete
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_IsDiscoveryComplete) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -44,10 +48,13 @@ TEST_F(BluetoothRemoteGattServiceTest, IsDiscoveryComplete) { ...@@ -44,10 +48,13 @@ TEST_F(BluetoothRemoteGattServiceTest, IsDiscoveryComplete) {
BluetoothRemoteGattService* service = device->GetGattServices()[0]; BluetoothRemoteGattService* service = device->GetGattServices()[0];
EXPECT_TRUE(service->IsDiscoveryComplete()); EXPECT_TRUE(service->IsDiscoveryComplete());
} }
#endif // defined(OS_WIN) || defined(OS_MACOSX)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetIdentifier) { #define MAYBE_GetIdentifier GetIdentifier
#else
#define MAYBE_GetIdentifier DISABLED_GetIdentifier
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_GetIdentifier) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -88,10 +95,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GetIdentifier) { ...@@ -88,10 +95,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GetIdentifier) {
EXPECT_NE(service3->GetIdentifier(), service4->GetIdentifier()); EXPECT_NE(service3->GetIdentifier(), service4->GetIdentifier());
} }
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetUUID) { #define MAYBE_GetUUID GetUUID
#else
#define MAYBE_GetUUID DISABLED_GetUUID
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_GetUUID) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -116,10 +126,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GetUUID) { ...@@ -116,10 +126,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GetUUID) {
EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID()); EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID());
EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID()); EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID());
} }
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristics_FindNone) { #define MAYBE_GetCharacteristics_FindNone GetCharacteristics_FindNone
#else
#define MAYBE_GetCharacteristics_FindNone DISABLED_GetCharacteristics_FindNone
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_GetCharacteristics_FindNone) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -140,11 +153,16 @@ TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristics_FindNone) { ...@@ -140,11 +153,16 @@ TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristics_FindNone) {
EXPECT_EQ(0u, service->GetCharacteristics().size()); EXPECT_EQ(0u, service->GetCharacteristics().size());
} }
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#define MAYBE_GetCharacteristics_and_GetCharacteristic \
GetCharacteristics_and_GetCharacteristic
#else
#define MAYBE_GetCharacteristics_and_GetCharacteristic \
DISABLED_GetCharacteristics_and_GetCharacteristic
#endif
TEST_F(BluetoothRemoteGattServiceTest, TEST_F(BluetoothRemoteGattServiceTest,
GetCharacteristics_and_GetCharacteristic) { MAYBE_GetCharacteristics_and_GetCharacteristic) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -194,10 +212,13 @@ TEST_F(BluetoothRemoteGattServiceTest, ...@@ -194,10 +212,13 @@ TEST_F(BluetoothRemoteGattServiceTest,
EXPECT_EQ(service->GetCharacteristic(char_id1), EXPECT_EQ(service->GetCharacteristic(char_id1),
service->GetCharacteristic(char_id1)); service->GetCharacteristic(char_id1));
} }
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristicsByUUID) { #define MAYBE_GetCharacteristicsByUUID GetCharacteristicsByUUID
#else
#define MAYBE_GetCharacteristicsByUUID DISABLED_GetCharacteristicsByUUID
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_GetCharacteristicsByUUID) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -255,10 +276,16 @@ TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristicsByUUID) { ...@@ -255,10 +276,16 @@ TEST_F(BluetoothRemoteGattServiceTest, GetCharacteristicsByUUID) {
service2->GetCharacteristicsByUUID(characteristic_uuid_not_exist_in_setup) service2->GetCharacteristicsByUUID(characteristic_uuid_not_exist_in_setup)
.empty()); .empty());
} }
#endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_MACOSX) || defined(OS_WIN) #if defined(OS_MACOSX) || defined(OS_WIN)
TEST_F(BluetoothRemoteGattServiceTest, GattCharacteristics_ObserversCalls) { #define MAYBE_GattCharacteristics_ObserversCalls \
GattCharacteristics_ObserversCalls
#else
#define MAYBE_GattCharacteristics_ObserversCalls \
DISABLED_GattCharacteristics_ObserversCalls
#endif
TEST_F(BluetoothRemoteGattServiceTest,
MAYBE_GattCharacteristics_ObserversCalls) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -314,10 +341,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GattCharacteristics_ObserversCalls) { ...@@ -314,10 +341,13 @@ TEST_F(BluetoothRemoteGattServiceTest, GattCharacteristics_ObserversCalls) {
EXPECT_FALSE(service->GetCharacteristic(removed_char)); EXPECT_FALSE(service->GetCharacteristic(removed_char));
EXPECT_EQ(0u, service->GetCharacteristics().size()); EXPECT_EQ(0u, service->GetCharacteristics().size());
} }
#endif // defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_WIN) || defined(OS_MACOSX) #if defined(OS_WIN) || defined(OS_MACOSX)
TEST_F(BluetoothRemoteGattServiceTest, SimulateGattServiceRemove) { #define MAYBE_SimulateGattServiceRemove SimulateGattServiceRemove
#else
#define MAYBE_SimulateGattServiceRemove DISABLED_SimulateGattServiceRemove
#endif
TEST_F(BluetoothRemoteGattServiceTest, MAYBE_SimulateGattServiceRemove) {
if (!PlatformSupportsLowEnergy()) { if (!PlatformSupportsLowEnergy()) {
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
return; return;
...@@ -348,7 +378,6 @@ TEST_F(BluetoothRemoteGattServiceTest, SimulateGattServiceRemove) { ...@@ -348,7 +378,6 @@ TEST_F(BluetoothRemoteGattServiceTest, SimulateGattServiceRemove) {
EXPECT_FALSE(device->GetGattService(removed_service)); EXPECT_FALSE(device->GetGattService(removed_service));
EXPECT_EQ(device->GetGattServices()[0], service2); EXPECT_EQ(device->GetGattServices()[0], service2);
} }
#endif // defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// Tests to receive a services changed notification from macOS, while // Tests to receive a services changed notification from macOS, while
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment