Chromium Code Reviews| 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 "device/bluetooth/test/mock_bluetooth_device.h" | 7 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 8 | 8 |
| 9 using testing::Return; | 9 using testing::Return; |
| 10 using testing::_; | 10 using testing::_; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 .WillByDefault(Return(std::vector<BluetoothGattCharacteristic*>())); | 26 .WillByDefault(Return(std::vector<BluetoothGattCharacteristic*>())); |
| 27 ON_CALL(*this, GetIncludedServices()) | 27 ON_CALL(*this, GetIncludedServices()) |
| 28 .WillByDefault(Return(std::vector<BluetoothGattService*>())); | 28 .WillByDefault(Return(std::vector<BluetoothGattService*>())); |
| 29 ON_CALL(*this, GetCharacteristic(_)) | 29 ON_CALL(*this, GetCharacteristic(_)) |
| 30 .WillByDefault(Return(static_cast<BluetoothGattCharacteristic*>(NULL))); | 30 .WillByDefault(Return(static_cast<BluetoothGattCharacteristic*>(NULL))); |
| 31 } | 31 } |
| 32 | 32 |
| 33 MockBluetoothGattService::~MockBluetoothGattService() { | 33 MockBluetoothGattService::~MockBluetoothGattService() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 void MockBluetoothGattService::AddMockCharacteristic( | |
| 37 scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { | |
| 38 mock_characteristics_.push_back(mock_characteristic.Pass()); | |
| 39 } | |
| 40 | |
| 41 std::vector<BluetoothGattCharacteristic*> | |
| 42 MockBluetoothGattService::GetMockCharacteristics() const { | |
| 43 std::vector<BluetoothGattCharacteristic*> characteristics; | |
| 44 for (BluetoothGattCharacteristic* characteristic : mock_characteristics_) { | |
| 45 characteristics.push_back(characteristic); | |
|
armansito
2015/06/09 19:23:49
Why is this copying necessary? Can't you change th
ortuno
2015/06/09 20:46:42
The compiler complains when trying to convert from
armansito
2015/06/10 02:40:47
If this is a test only method, why not just return
| |
| 46 } | |
| 47 return characteristics; | |
| 48 } | |
| 49 | |
| 36 } // namespace device | 50 } // namespace device |
| OLD | NEW |