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

Side by Side Diff: device/bluetooth/bluetooth_adapter_mac_unittest.mm

Issue 1284073002: bluetooth: Add adapter to BluetoothDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-drop-callback-
Patch Set: Updated patchset dependency Created 5 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 unified diff | Download patch
OLDNEW
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_low_energy_device_mac.h" 10 #include "device/bluetooth/bluetooth_low_energy_device_mac.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 296
297 TEST_F(BluetoothAdapterMacTest, UpdateDevicesRemovesLowEnergyDevice) { 297 TEST_F(BluetoothAdapterMacTest, UpdateDevicesRemovesLowEnergyDevice) {
298 base::scoped_nsobject<id> mock_peripheral(CreateMockPeripheral(kTestNSUUID)); 298 base::scoped_nsobject<id> mock_peripheral(CreateMockPeripheral(kTestNSUUID));
299 if (mock_peripheral.get() == nil) 299 if (mock_peripheral.get() == nil)
300 return; 300 return;
301 base::scoped_nsobject<NSDictionary> advertisement_data( 301 base::scoped_nsobject<NSDictionary> advertisement_data(
302 CreateAdvertisementData()); 302 CreateAdvertisementData());
303 303
304 BluetoothLowEnergyDeviceMac* device = new BluetoothLowEnergyDeviceMac( 304 BluetoothLowEnergyDeviceMac* device = new BluetoothLowEnergyDeviceMac(
305 mock_peripheral, advertisement_data, kTestRssi); 305 adapter_mac_, mock_peripheral, advertisement_data, kTestRssi);
306 SetDeviceTimeGreaterThanTimeout(device); 306 SetDeviceTimeGreaterThanTimeout(device);
307 307
308 EXPECT_EQ(0, NumDevices()); 308 EXPECT_EQ(0, NumDevices());
309 AddLowEnergyDevice(device); 309 AddLowEnergyDevice(device);
310 EXPECT_EQ(1, NumDevices()); 310 EXPECT_EQ(1, NumDevices());
311 EXPECT_TRUE(DevicePresent(mock_peripheral)); 311 EXPECT_TRUE(DevicePresent(mock_peripheral));
312 312
313 // Check that object pointed to by |device| is deleted by the adapter. 313 // Check that object pointed to by |device| is deleted by the adapter.
314 RemoveTimedOutDevices(); 314 RemoveTimedOutDevices();
315 EXPECT_EQ(0, NumDevices()); 315 EXPECT_EQ(0, NumDevices());
316 EXPECT_FALSE(DevicePresent(mock_peripheral)); 316 EXPECT_FALSE(DevicePresent(mock_peripheral));
317 } 317 }
318 318
319 } // namespace device 319 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698