OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/test/test_simple_task_runner.h" | 6 #include "base/test/test_simple_task_runner.h" |
7 #include "device/bluetooth/bluetooth_adapter.h" | 7 #include "device/bluetooth/bluetooth_adapter.h" |
8 #include "device/bluetooth/bluetooth_adapter_mac.h" | 8 #include "device/bluetooth/bluetooth_adapter_mac.h" |
9 #include "device/bluetooth/bluetooth_discovery_session.h" | 9 #include "device/bluetooth/bluetooth_discovery_session.h" |
10 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" | 10 #include "device/bluetooth/bluetooth_discovery_session_outcome.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 | 300 |
301 TEST_F(BluetoothAdapterMacTest, UpdateDevicesRemovesLowEnergyDevice) { | 301 TEST_F(BluetoothAdapterMacTest, UpdateDevicesRemovesLowEnergyDevice) { |
302 base::scoped_nsobject<id> mock_peripheral(CreateMockPeripheral(kTestNSUUID)); | 302 base::scoped_nsobject<id> mock_peripheral(CreateMockPeripheral(kTestNSUUID)); |
303 if (mock_peripheral.get() == nil) | 303 if (mock_peripheral.get() == nil) |
304 return; | 304 return; |
305 base::scoped_nsobject<NSDictionary> advertisement_data( | 305 base::scoped_nsobject<NSDictionary> advertisement_data( |
306 CreateAdvertisementData()); | 306 CreateAdvertisementData()); |
307 | 307 |
308 BluetoothLowEnergyDeviceMac* device = new BluetoothLowEnergyDeviceMac( | 308 BluetoothLowEnergyDeviceMac* device = new BluetoothLowEnergyDeviceMac( |
309 mock_peripheral, advertisement_data, kTestRssi); | 309 adapter_mac_, mock_peripheral, advertisement_data, kTestRssi); |
310 SetDeviceTimeGreaterThanTimeout(device); | 310 SetDeviceTimeGreaterThanTimeout(device); |
311 | 311 |
312 EXPECT_EQ(0, NumDevices()); | 312 EXPECT_EQ(0, NumDevices()); |
313 AddLowEnergyDevice(device); | 313 AddLowEnergyDevice(device); |
314 EXPECT_EQ(1, NumDevices()); | 314 EXPECT_EQ(1, NumDevices()); |
315 EXPECT_TRUE(DevicePresent(mock_peripheral)); | 315 EXPECT_TRUE(DevicePresent(mock_peripheral)); |
316 | 316 |
317 // Check that object pointed to by |device| is deleted by the adapter. | 317 // Check that object pointed to by |device| is deleted by the adapter. |
318 RemoveTimedOutDevices(); | 318 RemoveTimedOutDevices(); |
319 EXPECT_EQ(0, NumDevices()); | 319 EXPECT_EQ(0, NumDevices()); |
320 EXPECT_FALSE(DevicePresent(mock_peripheral)); | 320 EXPECT_FALSE(DevicePresent(mock_peripheral)); |
321 } | 321 } |
322 | 322 |
323 } // namespace device | 323 } // namespace device |
OLD | NEW |