| 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..577b1bcdd8318cfe247a21b10e231befba5dfb12 100644
|
| --- a/device/bluetooth/bluetooth_adapter_win_unittest.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_win_unittest.cc
|
| @@ -5,6 +5,7 @@
|
| #include <string>
|
|
|
| #include "base/bind.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/test/test_simple_task_runner.h"
|
| @@ -28,17 +29,6 @@ const char kTestAudioSdpBytes[] =
|
| "010209000535031910020900093508350619110d090102090100250c417564696f20536f75"
|
| "726365090311090001";
|
| const device::BluetoothUUID kTestAudioSdpUuid("110a");
|
| -
|
| -void MakeDeviceState(const std::string& name,
|
| - const std::string& address,
|
| - device::BluetoothTaskManagerWin::DeviceState* state) {
|
| - state->name = name;
|
| - state->address = address;
|
| - state->bluetooth_class = 0;
|
| - state->authenticated = false;
|
| - state->connected = false;
|
| -}
|
| -
|
| } // namespace
|
|
|
| namespace device {
|
| @@ -114,6 +104,18 @@ class BluetoothAdapterWinTest : public testing::Test {
|
| int num_stop_discovery_error_callbacks_;
|
| };
|
|
|
| +BluetoothTaskManagerWin::DeviceState* MakeDeviceState(
|
| + const std::string& name,
|
| + const std::string& address) {
|
| + auto state = new BluetoothTaskManagerWin::DeviceState();
|
| + state->name = name;
|
| + state->address = address;
|
| + state->bluetooth_class = 0;
|
| + state->authenticated = false;
|
| + state->connected = false;
|
| + return state;
|
| +}
|
| +
|
| TEST_F(BluetoothAdapterWinTest, AdapterNotPresent) {
|
| BluetoothTaskManagerWin::AdapterState state;
|
| adapter_win_->AdapterStateChanged(state);
|
| @@ -434,19 +436,15 @@ TEST_F(BluetoothAdapterWinTest, StopDiscoveryBeforeDiscoveryStartedAndFailed) {
|
| }
|
|
|
| TEST_F(BluetoothAdapterWinTest, DevicesPolled) {
|
| - 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();
|
| - MakeDeviceState("laptop", "A1:B2:C3:D4:E5:E1", laptop_state);
|
| - 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);
|
| + auto* android_phone_state = MakeDeviceState("phone", "A1:B2:C3:D4:E5:E0");
|
| + auto* laptop_state = MakeDeviceState("laptop", "A1:B2:C3:D4:E5:E1");
|
| + auto* iphone_state = MakeDeviceState("phone", "A1:B2:C3:D4:E5:E2");
|
| +
|
| + std::vector<std::unique_ptr<BluetoothTaskManagerWin::DeviceState>> devices;
|
| +
|
| + devices.push_back(base::WrapUnique(android_phone_state));
|
| + devices.push_back(base::WrapUnique(laptop_state));
|
| + devices.push_back(base::WrapUnique(iphone_state));
|
|
|
| // Add 3 devices
|
| observer_.Reset();
|
| @@ -484,7 +482,7 @@ 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(base::WrapUnique(audio_state));
|
| observer_.Reset();
|
| adapter_win_->DevicesPolled(devices);
|
| EXPECT_EQ(0, observer_.device_added_count());
|
|
|