OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "chromeos/dbus/bluetooth_profile_service_provider.h" | |
8 #include "chromeos/dbus/dbus_thread_manager.h" | |
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | |
10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | |
11 #include "chromeos/dbus/fake_bluetooth_device_client.h" | |
12 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | |
13 #include "device/bluetooth/bluetooth_adapter.h" | 7 #include "device/bluetooth/bluetooth_adapter.h" |
14 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 8 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
15 #include "device/bluetooth/bluetooth_adapter_factory.h" | 9 #include "device/bluetooth/bluetooth_adapter_factory.h" |
16 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" | 10 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h" |
17 #include "device/bluetooth/bluetooth_uuid.h" | 11 #include "device/bluetooth/bluetooth_uuid.h" |
| 12 #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" |
| 13 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 14 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" |
| 15 #include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" |
| 16 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
| 17 #include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using device::BluetoothAdapter; | 20 using device::BluetoothAdapter; |
21 using device::BluetoothUUID; | 21 using device::BluetoothUUID; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 class BluetoothAdapterProfileChromeOSTest : public testing::Test { | 25 class BluetoothAdapterProfileChromeOSTest : public testing::Test { |
26 public: | 26 public: |
27 BluetoothAdapterProfileChromeOSTest() | 27 BluetoothAdapterProfileChromeOSTest() |
28 : success_callback_count_(0), | 28 : success_callback_count_(0), |
29 error_callback_count_(0), | 29 error_callback_count_(0), |
30 fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath), | 30 fake_delegate_paired_( |
31 fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath), | 31 bluez::FakeBluetoothDeviceClient::kPairedDevicePath), |
| 32 fake_delegate_autopair_( |
| 33 bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath), |
32 fake_delegate_listen_(""), | 34 fake_delegate_listen_(""), |
33 profile_user_ptr_(nullptr) {} | 35 profile_user_ptr_(nullptr) {} |
34 | 36 |
35 void SetUp() override { | 37 void SetUp() override { |
36 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 38 scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter = |
37 DBusThreadManager::GetSetterForTesting(); | 39 bluez::BluezDBusManager::GetSetterForTesting(); |
38 | 40 |
39 dbus_setter->SetBluetoothAdapterClient( | 41 dbus_setter->SetBluetoothAdapterClient( |
40 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); | 42 scoped_ptr<bluez::BluetoothAdapterClient>( |
| 43 new bluez::FakeBluetoothAdapterClient)); |
41 dbus_setter->SetBluetoothAgentManagerClient( | 44 dbus_setter->SetBluetoothAgentManagerClient( |
42 scoped_ptr<BluetoothAgentManagerClient>( | 45 scoped_ptr<bluez::BluetoothAgentManagerClient>( |
43 new FakeBluetoothAgentManagerClient)); | 46 new bluez::FakeBluetoothAgentManagerClient)); |
44 dbus_setter->SetBluetoothDeviceClient( | 47 dbus_setter->SetBluetoothDeviceClient( |
45 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); | 48 scoped_ptr<bluez::BluetoothDeviceClient>( |
| 49 new bluez::FakeBluetoothDeviceClient)); |
46 dbus_setter->SetBluetoothProfileManagerClient( | 50 dbus_setter->SetBluetoothProfileManagerClient( |
47 scoped_ptr<BluetoothProfileManagerClient>( | 51 scoped_ptr<bluez::BluetoothProfileManagerClient>( |
48 new FakeBluetoothProfileManagerClient)); | 52 new bluez::FakeBluetoothProfileManagerClient)); |
49 | 53 |
50 // Grab a pointer to the adapter. | 54 // Grab a pointer to the adapter. |
51 device::BluetoothAdapterFactory::GetAdapter( | 55 device::BluetoothAdapterFactory::GetAdapter( |
52 base::Bind(&BluetoothAdapterProfileChromeOSTest::AdapterCallback, | 56 base::Bind(&BluetoothAdapterProfileChromeOSTest::AdapterCallback, |
53 base::Unretained(this))); | 57 base::Unretained(this))); |
54 ASSERT_TRUE(adapter_.get() != nullptr); | 58 ASSERT_TRUE(adapter_.get() != nullptr); |
55 ASSERT_TRUE(adapter_->IsInitialized()); | 59 ASSERT_TRUE(adapter_->IsInitialized()); |
56 ASSERT_TRUE(adapter_->IsPresent()); | 60 ASSERT_TRUE(adapter_->IsPresent()); |
57 | 61 |
58 // Turn on the adapter. | 62 // Turn on the adapter. |
59 adapter_->SetPowered(true, base::Bind(&base::DoNothing), | 63 adapter_->SetPowered(true, base::Bind(&base::DoNothing), |
60 base::Bind(&base::DoNothing)); | 64 base::Bind(&base::DoNothing)); |
61 ASSERT_TRUE(adapter_->IsPowered()); | 65 ASSERT_TRUE(adapter_->IsPowered()); |
62 } | 66 } |
63 | 67 |
64 void TearDown() override { | 68 void TearDown() override { |
65 profile_.reset(); | 69 profile_.reset(); |
66 adapter_ = nullptr; | 70 adapter_ = nullptr; |
67 DBusThreadManager::Shutdown(); | 71 bluez::BluezDBusManager::Shutdown(); |
68 } | 72 } |
69 | 73 |
70 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { | 74 void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { |
71 adapter_ = adapter; | 75 adapter_ = adapter; |
72 } | 76 } |
73 | 77 |
74 class FakeDelegate | 78 class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate { |
75 : public chromeos::BluetoothProfileServiceProvider::Delegate { | |
76 public: | 79 public: |
77 FakeDelegate(const std::string& device_path) : connections_(0) { | 80 FakeDelegate(const std::string& device_path) : connections_(0) { |
78 device_path_ = dbus::ObjectPath(device_path); | 81 device_path_ = dbus::ObjectPath(device_path); |
79 } | 82 } |
80 | 83 |
81 // BluetoothProfileServiceProvider::Delegate: | 84 // bluez::BluetoothProfileServiceProvider::Delegate: |
82 void Released() override { | 85 void Released() override { |
83 // noop | 86 // noop |
84 } | 87 } |
85 | 88 |
86 void NewConnection( | 89 void NewConnection( |
87 const dbus::ObjectPath& device_path, | 90 const dbus::ObjectPath& device_path, |
88 scoped_ptr<dbus::FileDescriptor> fd, | 91 scoped_ptr<dbus::FileDescriptor> fd, |
89 const BluetoothProfileServiceProvider::Delegate::Options& options, | 92 const bluez::BluetoothProfileServiceProvider::Delegate::Options& |
| 93 options, |
90 const ConfirmationCallback& callback) override { | 94 const ConfirmationCallback& callback) override { |
91 ++connections_; | 95 ++connections_; |
92 fd->CheckValidity(); | 96 fd->CheckValidity(); |
93 close(fd->TakeValue()); | 97 close(fd->TakeValue()); |
94 callback.Run(SUCCESS); | 98 callback.Run(SUCCESS); |
95 if (device_path_.value() != "") | 99 if (device_path_.value() != "") |
96 ASSERT_EQ(device_path_, device_path); | 100 ASSERT_EQ(device_path_, device_path); |
97 } | 101 } |
98 | 102 |
99 void RequestDisconnection(const dbus::ObjectPath& device_path, | 103 void RequestDisconnection(const dbus::ObjectPath& device_path, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 FakeDelegate fake_delegate_listen_; | 154 FakeDelegate fake_delegate_listen_; |
151 | 155 |
152 scoped_ptr<BluetoothAdapterProfileChromeOS> profile_; | 156 scoped_ptr<BluetoothAdapterProfileChromeOS> profile_; |
153 | 157 |
154 // unowned pointer as expected to be used by clients of | 158 // unowned pointer as expected to be used by clients of |
155 // BluetoothAdapterChromeOS::UseProfile like BluetoothSocketChromeOS | 159 // BluetoothAdapterChromeOS::UseProfile like BluetoothSocketChromeOS |
156 BluetoothAdapterProfileChromeOS* profile_user_ptr_; | 160 BluetoothAdapterProfileChromeOS* profile_user_ptr_; |
157 }; | 161 }; |
158 | 162 |
159 TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { | 163 TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) { |
160 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 164 BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); |
161 BluetoothProfileManagerClient::Options options; | 165 bluez::BluetoothProfileManagerClient::Options options; |
162 | 166 |
163 options.require_authentication.reset(new bool(false)); | 167 options.require_authentication.reset(new bool(false)); |
164 | 168 |
165 BluetoothAdapterProfileChromeOS::Register( | 169 BluetoothAdapterProfileChromeOS::Register( |
166 uuid, options, | 170 uuid, options, |
167 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, | 171 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
168 base::Unretained(this)), | 172 base::Unretained(this)), |
169 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 173 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
170 base::Unretained(this))); | 174 base::Unretained(this))); |
171 | 175 |
(...skipping 15 matching lines...) Expand all Loading... |
187 | 191 |
188 EXPECT_EQ(1U, profile_->DelegateCount()); | 192 EXPECT_EQ(1U, profile_->DelegateCount()); |
189 | 193 |
190 profile_->RemoveDelegate(fake_delegate_paired_.device_path_, | 194 profile_->RemoveDelegate(fake_delegate_paired_.device_path_, |
191 base::Bind(&base::DoNothing)); | 195 base::Bind(&base::DoNothing)); |
192 | 196 |
193 EXPECT_EQ(0U, profile_->DelegateCount()); | 197 EXPECT_EQ(0U, profile_->DelegateCount()); |
194 } | 198 } |
195 | 199 |
196 TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { | 200 TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) { |
197 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 201 BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); |
198 BluetoothProfileManagerClient::Options options; | 202 bluez::BluetoothProfileManagerClient::Options options; |
199 | 203 |
200 options.require_authentication.reset(new bool(false)); | 204 options.require_authentication.reset(new bool(false)); |
201 | 205 |
202 BluetoothAdapterProfileChromeOS::Register( | 206 BluetoothAdapterProfileChromeOS::Register( |
203 uuid, options, | 207 uuid, options, |
204 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, | 208 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
205 base::Unretained(this)), | 209 base::Unretained(this)), |
206 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 210 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
207 base::Unretained(this))); | 211 base::Unretained(this))); |
208 | 212 |
209 message_loop_.RunUntilIdle(); | 213 message_loop_.RunUntilIdle(); |
210 | 214 |
211 EXPECT_TRUE(profile_); | 215 EXPECT_TRUE(profile_); |
212 EXPECT_EQ(1U, success_callback_count_); | 216 EXPECT_EQ(1U, success_callback_count_); |
213 EXPECT_EQ(0U, error_callback_count_); | 217 EXPECT_EQ(0U, error_callback_count_); |
214 | 218 |
215 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 219 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
216 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), | 220 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), |
217 FakeBluetoothProfileManagerClient::kRfcommUuid, | 221 bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, |
218 base::Bind( | 222 base::Bind( |
219 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 223 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, |
220 base::Unretained(this)), | 224 base::Unretained(this)), |
221 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 225 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
222 base::Unretained(this))); | 226 base::Unretained(this))); |
223 | 227 |
224 message_loop_.RunUntilIdle(); | 228 message_loop_.RunUntilIdle(); |
225 | 229 |
226 EXPECT_EQ(1U, success_callback_count_); | 230 EXPECT_EQ(1U, success_callback_count_); |
227 EXPECT_EQ(1U, error_callback_count_); | 231 EXPECT_EQ(1U, error_callback_count_); |
228 | 232 |
229 EXPECT_EQ(0U, fake_delegate_paired_.connections_); | 233 EXPECT_EQ(0U, fake_delegate_paired_.connections_); |
230 } | 234 } |
231 | 235 |
232 TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { | 236 TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) { |
233 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 237 BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); |
234 BluetoothProfileManagerClient::Options options; | 238 bluez::BluetoothProfileManagerClient::Options options; |
235 | 239 |
236 options.require_authentication.reset(new bool(false)); | 240 options.require_authentication.reset(new bool(false)); |
237 | 241 |
238 BluetoothAdapterProfileChromeOS::Register( | 242 BluetoothAdapterProfileChromeOS::Register( |
239 uuid, options, | 243 uuid, options, |
240 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, | 244 base::Bind(&BluetoothAdapterProfileChromeOSTest::ProfileSuccessCallback, |
241 base::Unretained(this)), | 245 base::Unretained(this)), |
242 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 246 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
243 base::Unretained(this))); | 247 base::Unretained(this))); |
244 | 248 |
245 message_loop_.RunUntilIdle(); | 249 message_loop_.RunUntilIdle(); |
246 | 250 |
247 ASSERT_TRUE(profile_); | 251 ASSERT_TRUE(profile_); |
248 ASSERT_EQ(1U, success_callback_count_); | 252 ASSERT_EQ(1U, success_callback_count_); |
249 ASSERT_EQ(0U, error_callback_count_); | 253 ASSERT_EQ(0U, error_callback_count_); |
250 | 254 |
251 profile_->SetDelegate(fake_delegate_paired_.device_path_, | 255 profile_->SetDelegate(fake_delegate_paired_.device_path_, |
252 &fake_delegate_paired_); | 256 &fake_delegate_paired_); |
253 profile_->SetDelegate(fake_delegate_autopair_.device_path_, | 257 profile_->SetDelegate(fake_delegate_autopair_.device_path_, |
254 &fake_delegate_autopair_); | 258 &fake_delegate_autopair_); |
255 profile_->SetDelegate(fake_delegate_listen_.device_path_, | 259 profile_->SetDelegate(fake_delegate_listen_.device_path_, |
256 &fake_delegate_listen_); | 260 &fake_delegate_listen_); |
257 | 261 |
258 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 262 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
259 dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath), | 263 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath), |
260 FakeBluetoothProfileManagerClient::kRfcommUuid, | 264 bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, |
261 base::Bind( | 265 base::Bind( |
262 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 266 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, |
263 base::Unretained(this)), | 267 base::Unretained(this)), |
264 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 268 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
265 base::Unretained(this))); | 269 base::Unretained(this))); |
266 | 270 |
267 message_loop_.RunUntilIdle(); | 271 message_loop_.RunUntilIdle(); |
268 | 272 |
269 EXPECT_EQ(2U, success_callback_count_); | 273 EXPECT_EQ(2U, success_callback_count_); |
270 EXPECT_EQ(0U, error_callback_count_); | 274 EXPECT_EQ(0U, error_callback_count_); |
271 | 275 |
272 EXPECT_EQ(1U, fake_delegate_paired_.connections_); | 276 EXPECT_EQ(1U, fake_delegate_paired_.connections_); |
273 | 277 |
274 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 278 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
275 dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath), | 279 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath), |
276 FakeBluetoothProfileManagerClient::kRfcommUuid, | 280 bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, |
277 base::Bind( | 281 base::Bind( |
278 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 282 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, |
279 base::Unretained(this)), | 283 base::Unretained(this)), |
280 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 284 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
281 base::Unretained(this))); | 285 base::Unretained(this))); |
282 | 286 |
283 message_loop_.RunUntilIdle(); | 287 message_loop_.RunUntilIdle(); |
284 | 288 |
285 EXPECT_EQ(3U, success_callback_count_); | 289 EXPECT_EQ(3U, success_callback_count_); |
286 EXPECT_EQ(0U, error_callback_count_); | 290 EXPECT_EQ(0U, error_callback_count_); |
287 | 291 |
288 EXPECT_EQ(1U, fake_delegate_autopair_.connections_); | 292 EXPECT_EQ(1U, fake_delegate_autopair_.connections_); |
289 | 293 |
290 // Incoming connections look the same from BlueZ. | 294 // Incoming connections look the same from BlueZ. |
291 DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( | 295 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile( |
292 dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath), | 296 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath), |
293 FakeBluetoothProfileManagerClient::kRfcommUuid, | 297 bluez::FakeBluetoothProfileManagerClient::kRfcommUuid, |
294 base::Bind( | 298 base::Bind( |
295 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, | 299 &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback, |
296 base::Unretained(this)), | 300 base::Unretained(this)), |
297 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, | 301 base::Bind(&BluetoothAdapterProfileChromeOSTest::DBusErrorCallback, |
298 base::Unretained(this))); | 302 base::Unretained(this))); |
299 | 303 |
300 message_loop_.RunUntilIdle(); | 304 message_loop_.RunUntilIdle(); |
301 | 305 |
302 EXPECT_EQ(4U, success_callback_count_); | 306 EXPECT_EQ(4U, success_callback_count_); |
303 EXPECT_EQ(0U, error_callback_count_); | 307 EXPECT_EQ(0U, error_callback_count_); |
304 | 308 |
305 EXPECT_EQ(1U, fake_delegate_listen_.connections_); | 309 EXPECT_EQ(1U, fake_delegate_listen_.connections_); |
306 } | 310 } |
307 | 311 |
308 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) { | 312 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) { |
309 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid); | 313 BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid); |
310 BluetoothProfileManagerClient::Options options; | 314 bluez::BluetoothProfileManagerClient::Options options; |
311 BluetoothAdapterChromeOS* adapter = | 315 BluetoothAdapterChromeOS* adapter = |
312 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); | 316 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); |
313 | 317 |
314 options.require_authentication.reset(new bool(false)); | 318 options.require_authentication.reset(new bool(false)); |
315 | 319 |
316 success_callback_count_ = 0; | 320 success_callback_count_ = 0; |
317 error_callback_count_ = 0; | 321 error_callback_count_ = 0; |
318 | 322 |
319 adapter->UseProfile( | 323 adapter->UseProfile( |
320 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, | 324 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, |
(...skipping 19 matching lines...) Expand all Loading... |
340 | 344 |
341 adapter->ReleaseProfile(fake_delegate_paired_.device_path_, | 345 adapter->ReleaseProfile(fake_delegate_paired_.device_path_, |
342 profile_user_ptr_); | 346 profile_user_ptr_); |
343 adapter->ReleaseProfile(fake_delegate_autopair_.device_path_, | 347 adapter->ReleaseProfile(fake_delegate_autopair_.device_path_, |
344 profile_user_ptr_); | 348 profile_user_ptr_); |
345 | 349 |
346 message_loop_.RunUntilIdle(); | 350 message_loop_.RunUntilIdle(); |
347 } | 351 } |
348 | 352 |
349 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) { | 353 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) { |
350 BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid); | 354 BluetoothUUID uuid( |
351 BluetoothProfileManagerClient::Options options; | 355 bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid); |
| 356 bluez::BluetoothProfileManagerClient::Options options; |
352 BluetoothAdapterChromeOS* adapter = | 357 BluetoothAdapterChromeOS* adapter = |
353 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); | 358 static_cast<BluetoothAdapterChromeOS*>(adapter_.get()); |
354 | 359 |
355 options.require_authentication.reset(new bool(false)); | 360 options.require_authentication.reset(new bool(false)); |
356 | 361 |
357 success_callback_count_ = 0; | 362 success_callback_count_ = 0; |
358 error_callback_count_ = 0; | 363 error_callback_count_ = 0; |
359 | 364 |
360 adapter->UseProfile( | 365 adapter->UseProfile( |
361 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, | 366 uuid, fake_delegate_paired_.device_path_, options, &fake_delegate_paired_, |
(...skipping 12 matching lines...) Expand all Loading... |
374 base::Unretained(this))); | 379 base::Unretained(this))); |
375 | 380 |
376 message_loop_.RunUntilIdle(); | 381 message_loop_.RunUntilIdle(); |
377 | 382 |
378 EXPECT_FALSE(profile_user_ptr_); | 383 EXPECT_FALSE(profile_user_ptr_); |
379 EXPECT_EQ(0U, success_callback_count_); | 384 EXPECT_EQ(0U, success_callback_count_); |
380 EXPECT_EQ(2U, error_callback_count_); | 385 EXPECT_EQ(2U, error_callback_count_); |
381 } | 386 } |
382 | 387 |
383 } // namespace chromeos | 388 } // namespace chromeos |
OLD | NEW |