Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1418)

Unified Diff: device/bluetooth/bluetooth_adapter_win_unittest.cc

Issue 2567903004: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map (Closed)
Patch Set: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_adapter_win_unittest.cc
diff --git a/device/bluetooth/bluetooth_adapter_win_unittest.cc b/device/bluetooth/bluetooth_adapter_win_unittest.cc
index e5126e8cf59344ae43ae4c002095060ea4386ff2..0160cb70ba00e28332f5201f047cc6a495835e22 100644
--- a/device/bluetooth/bluetooth_adapter_win_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_win_unittest.cc
@@ -434,19 +434,22 @@ TEST_F(BluetoothAdapterWinTest, StopDiscoveryBeforeDiscoveryStartedAndFailed) {
}
TEST_F(BluetoothAdapterWinTest, DevicesPolled) {
- BluetoothTaskManagerWin::DeviceState* android_phone_state =
- new BluetoothTaskManagerWin::DeviceState();
+ BluetoothTaskManagerWin::DeviceState* android_phone_state(
+ new BluetoothTaskManagerWin::DeviceState());
MakeDeviceState("phone", "A1:B2:C3:D4:E5:E0", android_phone_state);
- BluetoothTaskManagerWin::DeviceState* laptop_state =
- new BluetoothTaskManagerWin::DeviceState();
+ BluetoothTaskManagerWin::DeviceState* laptop_state(
+ new BluetoothTaskManagerWin::DeviceState());
MakeDeviceState("laptop", "A1:B2:C3:D4:E5:E1", laptop_state);
- BluetoothTaskManagerWin::DeviceState* iphone_state =
- new BluetoothTaskManagerWin::DeviceState();
+ BluetoothTaskManagerWin::DeviceState* iphone_state(
+ new BluetoothTaskManagerWin::DeviceState());
MakeDeviceState("phone", "A1:B2:C3:D4:E5:E2", iphone_state);
- ScopedVector<BluetoothTaskManagerWin::DeviceState> devices;
- devices.push_back(android_phone_state);
- devices.push_back(laptop_state);
- devices.push_back(iphone_state);
+ std::vector<std::unique_ptr<BluetoothTaskManagerWin::DeviceState>> devices;
+ devices.push_back(std::unique_ptr<BluetoothTaskManagerWin::DeviceState>(
+ android_phone_state));
+ devices.push_back(
+ std::unique_ptr<BluetoothTaskManagerWin::DeviceState>(laptop_state));
+ devices.push_back(
+ std::unique_ptr<BluetoothTaskManagerWin::DeviceState>(iphone_state));
Reilly Grant (use Gerrit) 2016/12/21 22:25:13 auto state = base::MakeUnique<BluetoothTaskManager
dougt 2016/12/22 01:18:02 recall, below I need to access the ptr, so std::mo
// Add 3 devices
observer_.Reset();
@@ -484,7 +487,9 @@ TEST_F(BluetoothAdapterWinTest, DevicesPolled) {
new BluetoothTaskManagerWin::ServiceRecordState();
audio_state->name = kTestAudioSdpName;
base::HexStringToBytes(kTestAudioSdpBytes, &audio_state->sdp_bytes);
- laptop_state->service_record_states.push_back(audio_state);
+ laptop_state->service_record_states.push_back(
+ std::unique_ptr<BluetoothTaskManagerWin::ServiceRecordState>(
+ audio_state));
Reilly Grant (use Gerrit) 2016/12/21 22:25:13 Use base::WrapUnique() if you really want to conve
dougt 2016/12/22 01:18:02 Done.
observer_.Reset();
adapter_win_->DevicesPolled(devices);
EXPECT_EQ(0, observer_.device_added_count());

Powered by Google App Engine
This is Rietveld 408576698