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

Unified Diff: device/bluetooth/bluez/bluetooth_bluez_unittest.cc

Issue 2228953003: bluetooth: Change GetInquiryTxPower and GetInquiryRSSI to return optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: TIL value_or Created 4 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
Index: device/bluetooth/bluez/bluetooth_bluez_unittest.cc
diff --git a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc
index c26a5d5c5796a94395e3c574ee252bc336c86491..3b42c00042c96b678d543d9748afca5c95d5d65a 100644
--- a/device/bluetooth/bluez/bluetooth_bluez_unittest.cc
+++ b/device/bluetooth/bluez/bluetooth_bluez_unittest.cc
@@ -2490,7 +2490,13 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryRSSIInvalidated) {
properties->rssi.ReplaceValue(-75);
properties->rssi.set_valid(true);
- ASSERT_EQ(-75, devices[idx]->GetInquiryRSSI());
+ ASSERT_EQ(-75, devices[idx]->GetInquiryRSSI().value());
+
+ properties->rssi.ReplaceValue(INT8_MAX + 1);
+ ASSERT_EQ(INT8_MAX, devices[idx]->GetInquiryRSSI().value());
+
+ properties->rssi.ReplaceValue(INT8_MIN - 1);
+ ASSERT_EQ(INT8_MIN, devices[idx]->GetInquiryRSSI().value());
// Install an observer; expect the DeviceChanged method to be called when
// we invalidate the RSSI of the device.
@@ -2503,8 +2509,7 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryRSSIInvalidated) {
EXPECT_EQ(1, observer.device_changed_count());
EXPECT_EQ(devices[idx], observer.last_device());
- int unknown_power = BluetoothDevice::kUnknownPower;
- EXPECT_EQ(unknown_power, devices[idx]->GetInquiryRSSI());
+ EXPECT_FALSE(devices[idx]->GetInquiryRSSI());
}
TEST_F(BluetoothBlueZTest, DeviceInquiryTxPowerInvalidated) {
@@ -2527,7 +2532,13 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryTxPowerInvalidated) {
properties->tx_power.ReplaceValue(0);
properties->tx_power.set_valid(true);
- ASSERT_EQ(0, devices[idx]->GetInquiryTxPower());
+ ASSERT_EQ(0, devices[idx]->GetInquiryTxPower().value());
+
+ properties->tx_power.ReplaceValue(INT8_MAX + 1);
+ ASSERT_EQ(INT8_MAX, devices[idx]->GetInquiryTxPower().value());
+
+ properties->tx_power.ReplaceValue(INT8_MIN - 1);
+ ASSERT_EQ(INT8_MIN, devices[idx]->GetInquiryTxPower().value());
// Install an observer; expect the DeviceChanged method to be called when
// we invalidate the tx_power of the device.
@@ -2540,8 +2551,7 @@ TEST_F(BluetoothBlueZTest, DeviceInquiryTxPowerInvalidated) {
EXPECT_EQ(1, observer.device_changed_count());
EXPECT_EQ(devices[idx], observer.last_device());
- int unknown_power = BluetoothDevice::kUnknownPower;
- EXPECT_EQ(unknown_power, devices[idx]->GetInquiryTxPower());
+ EXPECT_FALSE(devices[idx]->GetInquiryTxPower());
}
TEST_F(BluetoothBlueZTest, ForgetDevice) {
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_device_mac.mm ('k') | device/bluetooth/bluez/bluetooth_device_bluez.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698