Index: device/bluetooth/bluetooth_adapter_mac_unittest.mm |
diff --git a/device/bluetooth/bluetooth_adapter_mac_unittest.mm b/device/bluetooth/bluetooth_adapter_mac_unittest.mm |
index 9bdb2710963277d573605388025c832c01e58517..200f0ea34d9f0de14d3f825330b21b93e5b43f8f 100644 |
--- a/device/bluetooth/bluetooth_adapter_mac_unittest.mm |
+++ b/device/bluetooth/bluetooth_adapter_mac_unittest.mm |
@@ -83,12 +83,6 @@ class BluetoothAdapterMacTest : public testing::Test { |
return BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral); |
} |
- void SetDeviceTimeGreaterThanTimeout(BluetoothLowEnergyDeviceMac* device) { |
- device->last_update_time_.reset([[NSDate |
- dateWithTimeInterval:-(BluetoothAdapterMac::kDiscoveryTimeoutSec + 1) |
- sinceDate:[NSDate date]] retain]); |
- } |
- |
void AddLowEnergyDevice(BluetoothLowEnergyDeviceMac* device) { |
adapter_mac_->devices_.set(device->GetAddress(), |
std::unique_ptr<BluetoothDevice>(device)); |
@@ -102,8 +96,6 @@ class BluetoothAdapterMacTest : public testing::Test { |
return (device != NULL); |
} |
- void RemoveTimedOutDevices() { adapter_mac_->RemoveTimedOutDevices(); } |
- |
bool SetMockCentralManager(CBCentralManagerState desired_state) { |
if (!BluetoothAdapterMac::IsLowEnergyAvailable()) { |
LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
@@ -267,60 +259,4 @@ TEST_F(BluetoothAdapterMacTest, LowEnergyDeviceUpdatedNewDevice) { |
EXPECT_TRUE(DevicePresent(mock_peripheral)); |
} |
-TEST_F(BluetoothAdapterMacTest, LowEnergyDeviceUpdatedOldDevice) { |
- if (!SetMockCentralManager(CBCentralManagerStatePoweredOn)) |
- return; |
- base::scoped_nsobject<CBPeripheral> mock_peripheral( |
- CreateMockPeripheral(kTestNSUUID)); |
- if (mock_peripheral.get() == nil) |
- return; |
- base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData()); |
- |
- // Update the device for the first time and check it was correctly added to |
- // |devices_|. |
- EXPECT_EQ(0, NumDevices()); |
- EXPECT_FALSE(DevicePresent(mock_peripheral)); |
- LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi); |
- EXPECT_EQ(1, NumDevices()); |
- EXPECT_TRUE(DevicePresent(mock_peripheral)); |
- // Search for the device by the address corresponding to |kTestNSUUID|. |
- BluetoothDeviceMac* device = |
- static_cast<BluetoothDeviceMac*>(GetDevice(kTestHashAddress)); |
- base::scoped_nsobject<NSDate> first_update_time( |
- [device->GetLastUpdateTime() retain]); |
- |
- // Update the device a second time. The device should be updated in |
- // |devices_| so check the time returned by GetLastUpdateTime() has increased. |
- LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi); |
- EXPECT_EQ(1, NumDevices()); |
- EXPECT_TRUE(DevicePresent(mock_peripheral)); |
- device = static_cast<BluetoothDeviceMac*>(GetDevice(kTestHashAddress)); |
- EXPECT_TRUE([device->GetLastUpdateTime() compare:first_update_time] == |
- NSOrderedDescending); |
-} |
- |
-TEST_F(BluetoothAdapterMacTest, UpdateDevicesRemovesLowEnergyDevice) { |
- if (!SetMockCentralManager(CBCentralManagerStatePoweredOn)) |
- return; |
- base::scoped_nsobject<CBPeripheral> mock_peripheral( |
- CreateMockPeripheral(kTestNSUUID)); |
- if (mock_peripheral.get() == nil) |
- return; |
- base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData()); |
- |
- BluetoothLowEnergyDeviceMac* device = new BluetoothLowEnergyDeviceMac( |
- adapter_mac_, mock_peripheral, advertisement_data, kTestRssi); |
- SetDeviceTimeGreaterThanTimeout(device); |
- |
- EXPECT_EQ(0, NumDevices()); |
- AddLowEnergyDevice(device); |
- EXPECT_EQ(1, NumDevices()); |
- EXPECT_TRUE(DevicePresent(mock_peripheral)); |
- |
- // Check that object pointed to by |device| is deleted by the adapter. |
- RemoveTimedOutDevices(); |
- EXPECT_EQ(0, NumDevices()); |
- EXPECT_FALSE(DevicePresent(mock_peripheral)); |
-} |
- |
} // namespace device |