| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ble/bluetooth_low_energy_characteristics_fin
der.h" | 5 #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/proximity_auth/ble/remote_attribute.h" | 10 #include "components/proximity_auth/ble/remote_attribute.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 scoped_ptr<device::MockBluetoothGattCharacteristic> characteristic( | 104 scoped_ptr<device::MockBluetoothGattCharacteristic> characteristic( |
| 105 new NiceMock<device::MockBluetoothGattCharacteristic>( | 105 new NiceMock<device::MockBluetoothGattCharacteristic>( |
| 106 service_.get(), id, uuid, true, kCharacteristicProperties, | 106 service_.get(), id, uuid, true, kCharacteristicProperties, |
| 107 device::BluetoothGattCharacteristic::PERMISSION_NONE)); | 107 device::BluetoothGattCharacteristic::PERMISSION_NONE)); |
| 108 | 108 |
| 109 ON_CALL(*characteristic.get(), GetUUID()).WillByDefault(Return(uuid)); | 109 ON_CALL(*characteristic.get(), GetUUID()).WillByDefault(Return(uuid)); |
| 110 if (valid) | 110 if (valid) |
| 111 ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); | 111 ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); |
| 112 ON_CALL(*characteristic.get(), GetService()) | 112 ON_CALL(*characteristic.get(), GetService()) |
| 113 .WillByDefault(Return(service_.get())); | 113 .WillByDefault(Return(service_.get())); |
| 114 return characteristic.Pass(); | 114 return characteristic; |
| 115 } | 115 } |
| 116 | 116 |
| 117 scoped_refptr<device::MockBluetoothAdapter> adapter_; | 117 scoped_refptr<device::MockBluetoothAdapter> adapter_; |
| 118 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback success_callback_; | 118 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback success_callback_; |
| 119 BluetoothLowEnergyCharacteristicsFinder::ErrorCallback error_callback_; | 119 BluetoothLowEnergyCharacteristicsFinder::ErrorCallback error_callback_; |
| 120 scoped_ptr<device::MockBluetoothDevice> device_; | 120 scoped_ptr<device::MockBluetoothDevice> device_; |
| 121 scoped_ptr<device::MockBluetoothGattService> service_; | 121 scoped_ptr<device::MockBluetoothGattService> service_; |
| 122 RemoteAttribute remote_service_; | 122 RemoteAttribute remote_service_; |
| 123 RemoteAttribute to_peripheral_char_; | 123 RemoteAttribute to_peripheral_char_; |
| 124 RemoteAttribute from_peripheral_char_; | 124 RemoteAttribute from_peripheral_char_; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); | 284 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); |
| 285 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); | 285 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); |
| 286 | 286 |
| 287 EXPECT_CALL(*service_, GetUUID()) | 287 EXPECT_CALL(*service_, GetUUID()) |
| 288 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 288 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
| 289 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 289 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace proximity_auth | 292 } // namespace proximity_auth |
| OLD | NEW |