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

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: Merge TOT Created 5 years, 3 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_adapter_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_adapter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698