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

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

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 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/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 device_state_->service_record_states.push_back(audio_state); 59 device_state_->service_record_states.push_back(audio_state);
60 60
61 BluetoothTaskManagerWin::ServiceRecordState* video_state = 61 BluetoothTaskManagerWin::ServiceRecordState* video_state =
62 new BluetoothTaskManagerWin::ServiceRecordState(); 62 new BluetoothTaskManagerWin::ServiceRecordState();
63 video_state->name = kTestVideoSdpName; 63 video_state->name = kTestVideoSdpName;
64 base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes); 64 base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
65 device_state_->service_record_states.push_back(video_state); 65 device_state_->service_record_states.push_back(video_state);
66 66
67 device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner, 67 device_.reset(new BluetoothDeviceWin(NULL, *device_state_, ui_task_runner,
68 socket_thread, NULL, 68 socket_thread, NULL,
69 net::NetLog::Source())); 69 net::NetLogSource()));
70 70
71 // Add empty device. 71 // Add empty device.
72 empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState()); 72 empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
73 empty_device_state_->name = std::string(kDeviceName); 73 empty_device_state_->name = std::string(kDeviceName);
74 empty_device_state_->address = kDeviceAddress; 74 empty_device_state_->address = kDeviceAddress;
75 empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_, 75 empty_device_.reset(new BluetoothDeviceWin(NULL, *empty_device_state_,
76 ui_task_runner, socket_thread, 76 ui_task_runner, socket_thread,
77 NULL, net::NetLog::Source())); 77 NULL, net::NetLogSource()));
78 } 78 }
79 79
80 protected: 80 protected:
81 std::unique_ptr<BluetoothDeviceWin> device_; 81 std::unique_ptr<BluetoothDeviceWin> device_;
82 std::unique_ptr<BluetoothTaskManagerWin::DeviceState> device_state_; 82 std::unique_ptr<BluetoothTaskManagerWin::DeviceState> device_state_;
83 std::unique_ptr<BluetoothDeviceWin> empty_device_; 83 std::unique_ptr<BluetoothDeviceWin> empty_device_;
84 std::unique_ptr<BluetoothTaskManagerWin::DeviceState> empty_device_state_; 84 std::unique_ptr<BluetoothTaskManagerWin::DeviceState> empty_device_state_;
85 }; 85 };
86 86
87 TEST_F(BluetoothDeviceWinTest, GetUUIDs) { 87 TEST_F(BluetoothDeviceWinTest, GetUUIDs) {
88 BluetoothDevice::UUIDSet uuids = device_->GetUUIDs(); 88 BluetoothDevice::UUIDSet uuids = device_->GetUUIDs();
89 89
90 EXPECT_EQ(2u, uuids.size()); 90 EXPECT_EQ(2u, uuids.size());
91 EXPECT_TRUE(base::ContainsKey(uuids, kTestAudioSdpUuid)); 91 EXPECT_TRUE(base::ContainsKey(uuids, kTestAudioSdpUuid));
92 EXPECT_TRUE(base::ContainsKey(uuids, kTestVideoSdpUuid)); 92 EXPECT_TRUE(base::ContainsKey(uuids, kTestVideoSdpUuid));
93 93
94 uuids = empty_device_->GetUUIDs(); 94 uuids = empty_device_->GetUUIDs();
95 EXPECT_EQ(0u, uuids.size()); 95 EXPECT_EQ(0u, uuids.size());
96 } 96 }
97 97
98 TEST_F(BluetoothDeviceWinTest, IsEqual) { 98 TEST_F(BluetoothDeviceWinTest, IsEqual) {
99 EXPECT_TRUE(device_->IsEqual(*device_state_)); 99 EXPECT_TRUE(device_->IsEqual(*device_state_));
100 EXPECT_FALSE(device_->IsEqual(*empty_device_state_)); 100 EXPECT_FALSE(device_->IsEqual(*empty_device_state_));
101 EXPECT_FALSE(empty_device_->IsEqual(*device_state_)); 101 EXPECT_FALSE(empty_device_->IsEqual(*device_state_));
102 EXPECT_TRUE(empty_device_->IsEqual(*empty_device_state_)); 102 EXPECT_TRUE(empty_device_->IsEqual(*empty_device_state_));
103 } 103 }
104 104
105 } // namespace device 105 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698