| 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 "device/bluetooth/test/mock_bluetooth_gatt_service.h" | 5 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "device/bluetooth/test/mock_bluetooth_device.h" | 10 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 void MockBluetoothGattService::AddMockCharacteristic( | 40 void MockBluetoothGattService::AddMockCharacteristic( |
| 41 std::unique_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { | 41 std::unique_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { |
| 42 mock_characteristics_.push_back(std::move(mock_characteristic)); | 42 mock_characteristics_.push_back(std::move(mock_characteristic)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 std::vector<BluetoothRemoteGattCharacteristic*> | 45 std::vector<BluetoothRemoteGattCharacteristic*> |
| 46 MockBluetoothGattService::GetMockCharacteristics() const { | 46 MockBluetoothGattService::GetMockCharacteristics() const { |
| 47 std::vector<BluetoothRemoteGattCharacteristic*> characteristics; | 47 std::vector<BluetoothRemoteGattCharacteristic*> characteristics; |
| 48 for (BluetoothRemoteGattCharacteristic* characteristic : | 48 for (const auto& characteristic : mock_characteristics_) |
| 49 mock_characteristics_) { | 49 characteristics.push_back(characteristic.get()); |
| 50 characteristics.push_back(characteristic); | 50 |
| 51 } | |
| 52 return characteristics; | 51 return characteristics; |
| 53 } | 52 } |
| 54 | 53 |
| 55 BluetoothRemoteGattCharacteristic* | 54 BluetoothRemoteGattCharacteristic* |
| 56 MockBluetoothGattService::GetMockCharacteristic( | 55 MockBluetoothGattService::GetMockCharacteristic( |
| 57 const std::string& identifier) const { | 56 const std::string& identifier) const { |
| 58 for (BluetoothRemoteGattCharacteristic* characteristic : | 57 for (const auto& characteristic : mock_characteristics_) |
| 59 mock_characteristics_) { | 58 if (characteristic->GetIdentifier() == identifier) |
| 60 if (characteristic->GetIdentifier() == identifier) { | 59 return characteristic.get(); |
| 61 return characteristic; | 60 |
| 62 } | |
| 63 } | |
| 64 return nullptr; | 61 return nullptr; |
| 65 } | 62 } |
| 66 | 63 |
| 67 } // namespace device | 64 } // namespace device |
| OLD | NEW |