| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_device.h" | 5 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 8 #include "device/bluetooth/bluetooth_gatt_service.h" | 10 #include "device/bluetooth/bluetooth_gatt_service.h" |
| 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 11 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 10 | 12 |
| 11 namespace device { | 13 namespace device { |
| 12 | 14 |
| 13 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, | 15 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, |
| 14 uint32_t bluetooth_class, | 16 uint32_t bluetooth_class, |
| 15 const std::string& name, | 17 const std::string& name, |
| 16 const std::string& address, | 18 const std::string& address, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ON_CALL(*this, ExpectingConfirmation()) | 57 ON_CALL(*this, ExpectingConfirmation()) |
| 56 .WillByDefault(testing::Return(false)); | 58 .WillByDefault(testing::Return(false)); |
| 57 ON_CALL(*this, GetUUIDs()) | 59 ON_CALL(*this, GetUUIDs()) |
| 58 .WillByDefault(testing::Return(uuids_)); | 60 .WillByDefault(testing::Return(uuids_)); |
| 59 } | 61 } |
| 60 | 62 |
| 61 MockBluetoothDevice::~MockBluetoothDevice() {} | 63 MockBluetoothDevice::~MockBluetoothDevice() {} |
| 62 | 64 |
| 63 void MockBluetoothDevice::AddMockService( | 65 void MockBluetoothDevice::AddMockService( |
| 64 scoped_ptr<MockBluetoothGattService> mock_service) { | 66 scoped_ptr<MockBluetoothGattService> mock_service) { |
| 65 mock_services_.push_back(mock_service.Pass()); | 67 mock_services_.push_back(std::move(mock_service)); |
| 66 } | 68 } |
| 67 | 69 |
| 68 std::vector<BluetoothGattService*> MockBluetoothDevice::GetMockServices() | 70 std::vector<BluetoothGattService*> MockBluetoothDevice::GetMockServices() |
| 69 const { | 71 const { |
| 70 std::vector<BluetoothGattService*> services; | 72 std::vector<BluetoothGattService*> services; |
| 71 for (BluetoothGattService* service : mock_services_) { | 73 for (BluetoothGattService* service : mock_services_) { |
| 72 services.push_back(service); | 74 services.push_back(service); |
| 73 } | 75 } |
| 74 return services; | 76 return services; |
| 75 } | 77 } |
| 76 | 78 |
| 77 BluetoothGattService* MockBluetoothDevice::GetMockService( | 79 BluetoothGattService* MockBluetoothDevice::GetMockService( |
| 78 const std::string& identifier) const { | 80 const std::string& identifier) const { |
| 79 for (BluetoothGattService* service : mock_services_) { | 81 for (BluetoothGattService* service : mock_services_) { |
| 80 if (service->GetIdentifier() == identifier) | 82 if (service->GetIdentifier() == identifier) |
| 81 return service; | 83 return service; |
| 82 } | 84 } |
| 83 return nullptr; | 85 return nullptr; |
| 84 } | 86 } |
| 85 | 87 |
| 86 } // namespace device | 88 } // namespace device |
| OLD | NEW |