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 <utility> |
| 8 |
7 #include "device/bluetooth/test/mock_bluetooth_device.h" | 9 #include "device/bluetooth/test/mock_bluetooth_device.h" |
8 | 10 |
9 using testing::Return; | 11 using testing::Return; |
10 using testing::_; | 12 using testing::_; |
11 | 13 |
12 namespace device { | 14 namespace device { |
13 | 15 |
14 MockBluetoothGattService::MockBluetoothGattService( | 16 MockBluetoothGattService::MockBluetoothGattService( |
15 MockBluetoothDevice* device, | 17 MockBluetoothDevice* device, |
16 const std::string& identifier, | 18 const std::string& identifier, |
(...skipping 11 matching lines...) Expand all Loading... |
28 .WillByDefault(Return(std::vector<BluetoothGattService*>())); | 30 .WillByDefault(Return(std::vector<BluetoothGattService*>())); |
29 ON_CALL(*this, GetCharacteristic(_)) | 31 ON_CALL(*this, GetCharacteristic(_)) |
30 .WillByDefault(Return(static_cast<BluetoothGattCharacteristic*>(NULL))); | 32 .WillByDefault(Return(static_cast<BluetoothGattCharacteristic*>(NULL))); |
31 } | 33 } |
32 | 34 |
33 MockBluetoothGattService::~MockBluetoothGattService() { | 35 MockBluetoothGattService::~MockBluetoothGattService() { |
34 } | 36 } |
35 | 37 |
36 void MockBluetoothGattService::AddMockCharacteristic( | 38 void MockBluetoothGattService::AddMockCharacteristic( |
37 scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { | 39 scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { |
38 mock_characteristics_.push_back(mock_characteristic.Pass()); | 40 mock_characteristics_.push_back(std::move(mock_characteristic)); |
39 } | 41 } |
40 | 42 |
41 std::vector<BluetoothGattCharacteristic*> | 43 std::vector<BluetoothGattCharacteristic*> |
42 MockBluetoothGattService::GetMockCharacteristics() const { | 44 MockBluetoothGattService::GetMockCharacteristics() const { |
43 std::vector<BluetoothGattCharacteristic*> characteristics; | 45 std::vector<BluetoothGattCharacteristic*> characteristics; |
44 for (BluetoothGattCharacteristic* characteristic : mock_characteristics_) { | 46 for (BluetoothGattCharacteristic* characteristic : mock_characteristics_) { |
45 characteristics.push_back(characteristic); | 47 characteristics.push_back(characteristic); |
46 } | 48 } |
47 return characteristics; | 49 return characteristics; |
48 } | 50 } |
49 | 51 |
50 BluetoothGattCharacteristic* MockBluetoothGattService::GetMockCharacteristic( | 52 BluetoothGattCharacteristic* MockBluetoothGattService::GetMockCharacteristic( |
51 const std::string& identifier) const { | 53 const std::string& identifier) const { |
52 for (BluetoothGattCharacteristic* characteristic : mock_characteristics_) { | 54 for (BluetoothGattCharacteristic* characteristic : mock_characteristics_) { |
53 if (characteristic->GetIdentifier() == identifier) { | 55 if (characteristic->GetIdentifier() == identifier) { |
54 return characteristic; | 56 return characteristic; |
55 } | 57 } |
56 } | 58 } |
57 return nullptr; | 59 return nullptr; |
58 } | 60 } |
59 | 61 |
60 } // namespace device | 62 } // namespace device |
OLD | NEW |