Index: device/bluetooth/test/mock_bluetooth_adapter.cc |
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc |
index 2667650f40bf97e3f6678254e9593f482b1f128c..cdc71350395aea57d2bea70848512695e920ba74 100644 |
--- a/device/bluetooth/test/mock_bluetooth_adapter.cc |
+++ b/device/bluetooth/test/mock_bluetooth_adapter.cc |
@@ -69,28 +69,28 @@ void MockBluetoothAdapter::AddMockDevice( |
std::unique_ptr<MockBluetoothDevice> MockBluetoothAdapter::RemoveMockDevice( |
const std::string& address) { |
for (auto it = mock_devices_.begin(); it != mock_devices_.end(); ++it) { |
- if ((*it)->GetAddress() != address) { |
+ if ((*it)->GetAddress() != address) |
continue; |
- } |
- std::unique_ptr<MockBluetoothDevice> removed_device(*it); |
- mock_devices_.weak_erase(it); |
- return removed_device; |
+ |
+ auto result = std::move(*it); |
+ mock_devices_.erase(it); |
+ return result; |
} |
return nullptr; |
} |
BluetoothAdapter::ConstDeviceList MockBluetoothAdapter::GetConstMockDevices() { |
BluetoothAdapter::ConstDeviceList devices; |
- for (auto* it : mock_devices_) { |
- devices.push_back(it); |
+ for (auto& device : mock_devices_) { |
+ devices.push_back(device.get()); |
} |
return devices; |
} |
BluetoothAdapter::DeviceList MockBluetoothAdapter::GetMockDevices() { |
BluetoothAdapter::DeviceList devices; |
- for (auto* it : mock_devices_) { |
- devices.push_back(it); |
+ for (auto& device : mock_devices_) { |
+ devices.push_back(device.get()); |
} |
return devices; |
} |