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

Side by Side Diff: device/bluetooth/bluetooth_device_win_unittest.cc

Issue 2567903004: Replace ScopedVector/ScopedPtrHashMap with std::vector and std::unordered_map (Closed)
Patch Set: Mac bustage Created 3 years, 12 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/bluetooth_device_win.h" 5 #include "device/bluetooth/bluetooth_device_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h"
10 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/test/test_simple_task_runner.h" 13 #include "base/test/test_simple_task_runner.h"
13 #include "device/bluetooth/bluetooth_service_record_win.h" 14 #include "device/bluetooth/bluetooth_service_record_win.h"
14 #include "device/bluetooth/bluetooth_socket_thread.h" 15 #include "device/bluetooth/bluetooth_socket_thread.h"
15 #include "device/bluetooth/bluetooth_task_manager_win.h" 16 #include "device/bluetooth/bluetooth_task_manager_win.h"
16 #include "device/bluetooth/bluetooth_uuid.h" 17 #include "device/bluetooth/bluetooth_uuid.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace { 20 namespace {
(...skipping 25 matching lines...) Expand all
45 scoped_refptr<base::SequencedTaskRunner> ui_task_runner( 46 scoped_refptr<base::SequencedTaskRunner> ui_task_runner(
46 new base::TestSimpleTaskRunner()); 47 new base::TestSimpleTaskRunner());
47 scoped_refptr<BluetoothSocketThread> socket_thread( 48 scoped_refptr<BluetoothSocketThread> socket_thread(
48 BluetoothSocketThread::Get()); 49 BluetoothSocketThread::Get());
49 50
50 // Add device with audio/video services. 51 // Add device with audio/video services.
51 device_state_.reset(new BluetoothTaskManagerWin::DeviceState()); 52 device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
52 device_state_->name = std::string(kDeviceName); 53 device_state_->name = std::string(kDeviceName);
53 device_state_->address = kDeviceAddress; 54 device_state_->address = kDeviceAddress;
54 55
55 BluetoothTaskManagerWin::ServiceRecordState* audio_state = 56 auto audio_state =
56 new BluetoothTaskManagerWin::ServiceRecordState(); 57 base::MakeUnique<BluetoothTaskManagerWin::ServiceRecordState>();
57 audio_state->name = kTestAudioSdpName; 58 audio_state->name = kTestAudioSdpName;
58 base::HexStringToBytes(kTestAudioSdpBytes, &audio_state->sdp_bytes); 59 base::HexStringToBytes(kTestAudioSdpBytes, &audio_state->sdp_bytes);
59 device_state_->service_record_states.push_back(audio_state); 60 device_state_->service_record_states.push_back(std::move(audio_state));
60 61
61 BluetoothTaskManagerWin::ServiceRecordState* video_state = 62 auto video_state =
62 new BluetoothTaskManagerWin::ServiceRecordState(); 63 base::MakeUnique<BluetoothTaskManagerWin::ServiceRecordState>();
63 video_state->name = kTestVideoSdpName; 64 video_state->name = kTestVideoSdpName;
64 base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes); 65 base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
65 device_state_->service_record_states.push_back(video_state); 66 device_state_->service_record_states.push_back(std::move(video_state));
66 67
67 device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner, 68 device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner,
68 socket_thread, NULL, 69 socket_thread, NULL,
69 net::NetLogSource())); 70 net::NetLogSource()));
70 71
71 // Add empty device. 72 // Add empty device.
72 empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState()); 73 empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
73 empty_device_state_->name = std::string(kDeviceName); 74 empty_device_state_->name = std::string(kDeviceName);
74 empty_device_state_->address = kDeviceAddress; 75 empty_device_state_->address = kDeviceAddress;
75 empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_, 76 empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_,
(...skipping 20 matching lines...) Expand all
96 } 97 }
97 98
98 TEST_F(BluetoothDeviceWinTest, IsEqual) { 99 TEST_F(BluetoothDeviceWinTest, IsEqual) {
99 EXPECT_TRUE(device_->IsEqual(*device_state_)); 100 EXPECT_TRUE(device_->IsEqual(*device_state_));
100 EXPECT_FALSE(device_->IsEqual(*empty_device_state_)); 101 EXPECT_FALSE(device_->IsEqual(*empty_device_state_));
101 EXPECT_FALSE(empty_device_->IsEqual(*device_state_)); 102 EXPECT_FALSE(empty_device_->IsEqual(*device_state_));
102 EXPECT_TRUE(empty_device_->IsEqual(*empty_device_state_)); 103 EXPECT_TRUE(empty_device_->IsEqual(*empty_device_state_));
103 } 104 }
104 105
105 } // namespace device 106 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698