| 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 "device/bluetooth/bluetooth_adapter_mac.h" | 5 #include "device/bluetooth/bluetooth_adapter_mac.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 // Owned by |adapter_mac_|. | 142 // Owned by |adapter_mac_|. |
| 143 base::scoped_nsobject<MockCentralManager> mock_central_manager_; | 143 base::scoped_nsobject<MockCentralManager> mock_central_manager_; |
| 144 | 144 |
| 145 int callback_count_; | 145 int callback_count_; |
| 146 int error_callback_count_; | 146 int error_callback_count_; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 TEST_F(BluetoothAdapterMacTest, Poll) { | 149 TEST_F(BluetoothAdapterMacTest, Poll) { |
| 150 PollAdapter(); | 150 PollAdapter(); |
| 151 EXPECT_FALSE(ui_task_runner_->GetPendingTasks().empty()); | 151 EXPECT_TRUE(ui_task_runner_->HasPendingTask()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 TEST_F(BluetoothAdapterMacTest, AddDiscoverySessionWithLowEnergyFilter) { | 154 TEST_F(BluetoothAdapterMacTest, AddDiscoverySessionWithLowEnergyFilter) { |
| 155 if (!SetMockCentralManager(CBCentralManagerStatePoweredOn)) | 155 if (!SetMockCentralManager(CBCentralManagerStatePoweredOn)) |
| 156 return; | 156 return; |
| 157 EXPECT_EQ(0, [mock_central_manager_ scanForPeripheralsCallCount]); | 157 EXPECT_EQ(0, [mock_central_manager_ scanForPeripheralsCallCount]); |
| 158 EXPECT_EQ(0, NumDiscoverySessions()); | 158 EXPECT_EQ(0, NumDiscoverySessions()); |
| 159 | 159 |
| 160 std::unique_ptr<BluetoothDiscoveryFilter> discovery_filter( | 160 std::unique_ptr<BluetoothDiscoveryFilter> discovery_filter( |
| 161 new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)); | 161 new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData()); | 253 base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData()); |
| 254 | 254 |
| 255 EXPECT_EQ(0, NumDevices()); | 255 EXPECT_EQ(0, NumDevices()); |
| 256 EXPECT_FALSE(DevicePresent(mock_peripheral)); | 256 EXPECT_FALSE(DevicePresent(mock_peripheral)); |
| 257 LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi); | 257 LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi); |
| 258 EXPECT_EQ(1, NumDevices()); | 258 EXPECT_EQ(1, NumDevices()); |
| 259 EXPECT_TRUE(DevicePresent(mock_peripheral)); | 259 EXPECT_TRUE(DevicePresent(mock_peripheral)); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace device | 262 } // namespace device |
| OLD | NEW |