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

Unified Diff: device/bluetooth/bluetooth_device_win_unittest.cc

Issue 424093004: Improve processing of Bluetooth device discovery on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback (nits and memory leak). Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device_win.cc ('k') | device/bluetooth/bluetooth_low_energy_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_win_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_win_unittest.cc b/device/bluetooth/bluetooth_device_win_unittest.cc
index ff77cd99c92dc5f1296bb4b313ddba9fa2c182e3..7fc8874fc3eab8899f4cdced9f795e2f815e3e3e 100644
--- a/device/bluetooth/bluetooth_device_win_unittest.cc
+++ b/device/bluetooth/bluetooth_device_win_unittest.cc
@@ -42,36 +42,39 @@ namespace device {
class BluetoothDeviceWinTest : public testing::Test {
public:
BluetoothDeviceWinTest() {
- BluetoothTaskManagerWin::DeviceState device_state;
- device_state.name = kDeviceName;
- device_state.address = kDeviceAddress;
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner(
+ new base::TestSimpleTaskRunner());
+ scoped_refptr<BluetoothSocketThread> socket_thread(
+ BluetoothSocketThread::Get());
// Add device with audio/video services.
+ device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
+ device_state_->name = kDeviceName;
+ device_state_->address = kDeviceAddress;
+
BluetoothTaskManagerWin::ServiceRecordState* audio_state =
new BluetoothTaskManagerWin::ServiceRecordState();
audio_state->name = kTestAudioSdpName;
base::HexStringToBytes(kTestAudioSdpBytes, &audio_state->sdp_bytes);
- device_state.service_record_states.push_back(audio_state);
+ device_state_->service_record_states.push_back(audio_state);
BluetoothTaskManagerWin::ServiceRecordState* video_state =
new BluetoothTaskManagerWin::ServiceRecordState();
video_state->name = kTestVideoSdpName;
base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
- device_state.service_record_states.push_back(video_state);
+ device_state_->service_record_states.push_back(video_state);
- scoped_refptr<base::SequencedTaskRunner> ui_task_runner(
- new base::TestSimpleTaskRunner());
- scoped_refptr<BluetoothSocketThread> socket_thread(
- BluetoothSocketThread::Get());
- device_.reset(new BluetoothDeviceWin(device_state,
+ device_.reset(new BluetoothDeviceWin(*device_state_,
ui_task_runner,
socket_thread,
NULL,
net::NetLog::Source()));
// Add empty device.
- device_state.service_record_states.clear();
- empty_device_.reset(new BluetoothDeviceWin(device_state,
+ empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
+ empty_device_state_->name = kDeviceName;
+ empty_device_state_->address = kDeviceAddress;
+ empty_device_.reset(new BluetoothDeviceWin(*empty_device_state_,
ui_task_runner,
socket_thread,
NULL,
@@ -79,8 +82,10 @@ class BluetoothDeviceWinTest : public testing::Test {
}
protected:
- scoped_ptr<BluetoothDevice> device_;
- scoped_ptr<BluetoothDevice> empty_device_;
+ scoped_ptr<BluetoothDeviceWin> device_;
+ scoped_ptr<BluetoothTaskManagerWin::DeviceState> device_state_;
+ scoped_ptr<BluetoothDeviceWin> empty_device_;
+ scoped_ptr<BluetoothTaskManagerWin::DeviceState> empty_device_state_;
};
TEST_F(BluetoothDeviceWinTest, GetUUIDs) {
@@ -94,4 +99,11 @@ TEST_F(BluetoothDeviceWinTest, GetUUIDs) {
EXPECT_EQ(0, uuids.size());
}
+TEST_F(BluetoothDeviceWinTest, IsEqual) {
+ EXPECT_TRUE(device_->IsEqual(*device_state_));
+ EXPECT_FALSE(device_->IsEqual(*empty_device_state_));
+ EXPECT_FALSE(empty_device_->IsEqual(*device_state_));
+ EXPECT_TRUE(empty_device_->IsEqual(*empty_device_state_));
+}
+
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_device_win.cc ('k') | device/bluetooth/bluetooth_low_energy_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698