| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/proximity_auth/bluetooth_connection_finder.h" | 5 #include "components/proximity_auth/bluetooth_connection_finder.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // should not crash. | 194 // should not crash. |
| 195 BluetoothConnectionFinder connection_finder( | 195 BluetoothConnectionFinder connection_finder( |
| 196 cryptauth::CreateClassicRemoteDeviceForTest(), | 196 cryptauth::CreateClassicRemoteDeviceForTest(), |
| 197 device::BluetoothUUID(kUuid), base::TimeDelta::FromMilliseconds(1)); | 197 device::BluetoothUUID(kUuid), base::TimeDelta::FromMilliseconds(1)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 TEST_F(ProximityAuthBluetoothConnectionFinderTest, Find_NoBluetoothAdapter) { | 200 TEST_F(ProximityAuthBluetoothConnectionFinderTest, Find_NoBluetoothAdapter) { |
| 201 // Some platforms do not support Bluetooth. This test is only meaningful on | 201 // Some platforms do not support Bluetooth. This test is only meaningful on |
| 202 // those platforms. | 202 // those platforms. |
| 203 adapter_ = NULL; | 203 adapter_ = NULL; |
| 204 if (device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) | 204 if (device::BluetoothAdapterFactory::IsBluetoothSupported()) |
| 205 return; | 205 return; |
| 206 | 206 |
| 207 // The StrictMock will verify that no connection is created. | 207 // The StrictMock will verify that no connection is created. |
| 208 StartConnectionFinder(false); | 208 StartConnectionFinder(false); |
| 209 } | 209 } |
| 210 | 210 |
| 211 TEST_F(ProximityAuthBluetoothConnectionFinderTest, | 211 TEST_F(ProximityAuthBluetoothConnectionFinderTest, |
| 212 Find_BluetoothAdapterNotPresent) { | 212 Find_BluetoothAdapterNotPresent) { |
| 213 // The StrictMock will verify that no connection is created. | 213 // The StrictMock will verify that no connection is created. |
| 214 ON_CALL(*adapter_, IsPresent()).WillByDefault(Return(false)); | 214 ON_CALL(*adapter_, IsPresent()).WillByDefault(Return(false)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 // Successfully connect to the Bluetooth device. | 360 // Successfully connect to the Bluetooth device. |
| 361 ON_CALL(*adapter_, GetDevice(cryptauth::kTestRemoteDeviceBluetoothAddress)) | 361 ON_CALL(*adapter_, GetDevice(cryptauth::kTestRemoteDeviceBluetoothAddress)) |
| 362 .WillByDefault(Return(bluetooth_device_.get())); | 362 .WillByDefault(Return(bluetooth_device_.get())); |
| 363 MockConnection* connection = connection_finder_.ExpectCreateConnection(); | 363 MockConnection* connection = connection_finder_.ExpectCreateConnection(); |
| 364 connection_finder_.seek_callback().Run(); | 364 connection_finder_.seek_callback().Run(); |
| 365 SimulateDeviceConnection(connection); | 365 SimulateDeviceConnection(connection); |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace proximity_auth | 368 } // namespace proximity_auth |
| OLD | NEW |