OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
11 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 11 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
12 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" | 12 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" |
13 #include "chromeos/dbus/fake_bluetooth_input_client.h" | 13 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
14 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" | 14 #include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
15 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" | |
16 #include "device/bluetooth/bluetooth_adapter.h" | 15 #include "device/bluetooth/bluetooth_adapter.h" |
17 #include "device/bluetooth/bluetooth_adapter_chromeos.h" | 16 #include "device/bluetooth/bluetooth_adapter_chromeos.h" |
18 #include "device/bluetooth/bluetooth_adapter_factory.h" | 17 #include "device/bluetooth/bluetooth_adapter_factory.h" |
19 #include "device/bluetooth/bluetooth_device.h" | 18 #include "device/bluetooth/bluetooth_device.h" |
20 #include "device/bluetooth/bluetooth_device_chromeos.h" | 19 #include "device/bluetooth/bluetooth_device_chromeos.h" |
21 #include "device/bluetooth/bluetooth_socket.h" | 20 #include "device/bluetooth/bluetooth_socket.h" |
22 #include "device/bluetooth/bluetooth_socket_chromeos.h" | 21 #include "device/bluetooth/bluetooth_socket_chromeos.h" |
23 #include "device/bluetooth/bluetooth_socket_thread.h" | 22 #include "device/bluetooth/bluetooth_socket_thread.h" |
24 #include "device/bluetooth/bluetooth_uuid.h" | 23 #include "device/bluetooth/bluetooth_uuid.h" |
25 #include "net/base/io_buffer.h" | 24 #include "net/base/io_buffer.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 ++error_callback_count_; | 137 ++error_callback_count_; |
139 last_reason_ = reason; | 138 last_reason_ = reason; |
140 last_message_ = error_message; | 139 last_message_ = error_message; |
141 | 140 |
142 message_loop_.Quit(); | 141 message_loop_.Quit(); |
143 } | 142 } |
144 | 143 |
145 void CreateServiceSuccessCallback(scoped_refptr<BluetoothSocket> socket) { | 144 void CreateServiceSuccessCallback(scoped_refptr<BluetoothSocket> socket) { |
146 ++success_callback_count_; | 145 ++success_callback_count_; |
147 last_socket_ = socket; | 146 last_socket_ = socket; |
148 | |
149 if (message_loop_.is_running()) | |
150 message_loop_.Quit(); | |
151 } | 147 } |
152 | 148 |
153 void AcceptSuccessCallback(const BluetoothDevice* device, | 149 void AcceptSuccessCallback(const BluetoothDevice* device, |
154 scoped_refptr<BluetoothSocket> socket) { | 150 scoped_refptr<BluetoothSocket> socket) { |
155 ++success_callback_count_; | 151 ++success_callback_count_; |
156 last_device_ = device; | 152 last_device_ = device; |
157 last_socket_ = socket; | 153 last_socket_ = socket; |
158 | 154 |
159 message_loop_.Quit(); | 155 message_loop_.Quit(); |
160 } | 156 } |
(...skipping 23 matching lines...) Expand all Loading... |
184 BluetoothDevice* device = adapter_->GetDevice( | 180 BluetoothDevice* device = adapter_->GetDevice( |
185 FakeBluetoothDeviceClient::kPairedDeviceAddress); | 181 FakeBluetoothDeviceClient::kPairedDeviceAddress); |
186 ASSERT_TRUE(device != NULL); | 182 ASSERT_TRUE(device != NULL); |
187 | 183 |
188 device->ConnectToService( | 184 device->ConnectToService( |
189 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), | 185 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), |
190 base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback, | 186 base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback, |
191 base::Unretained(this)), | 187 base::Unretained(this)), |
192 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 188 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
193 base::Unretained(this))); | 189 base::Unretained(this))); |
| 190 |
194 message_loop_.Run(); | 191 message_loop_.Run(); |
195 | 192 |
196 EXPECT_EQ(1U, success_callback_count_); | 193 EXPECT_EQ(1U, success_callback_count_); |
197 EXPECT_EQ(0U, error_callback_count_); | 194 EXPECT_EQ(0U, error_callback_count_); |
198 EXPECT_TRUE(last_socket_.get() != NULL); | 195 EXPECT_TRUE(last_socket_.get() != NULL); |
199 | 196 |
200 // Take ownership of the socket for the remainder of the test. | 197 // Take ownership of the socket for the remainder of the test. |
201 scoped_refptr<BluetoothSocket> socket = last_socket_; | 198 scoped_refptr<BluetoothSocket> socket = last_socket_; |
202 last_socket_ = NULL; | 199 last_socket_ = NULL; |
203 success_callback_count_ = 0; | 200 success_callback_count_ = 0; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 290 |
294 TEST_F(BluetoothSocketChromeOSTest, Listen) { | 291 TEST_F(BluetoothSocketChromeOSTest, Listen) { |
295 adapter_->CreateRfcommService( | 292 adapter_->CreateRfcommService( |
296 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), | 293 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), |
297 BluetoothAdapter::ServiceOptions(), | 294 BluetoothAdapter::ServiceOptions(), |
298 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, | 295 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, |
299 base::Unretained(this)), | 296 base::Unretained(this)), |
300 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 297 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
301 base::Unretained(this))); | 298 base::Unretained(this))); |
302 | 299 |
303 message_loop_.Run(); | |
304 | |
305 EXPECT_EQ(1U, success_callback_count_); | 300 EXPECT_EQ(1U, success_callback_count_); |
306 EXPECT_EQ(0U, error_callback_count_); | 301 EXPECT_EQ(0U, error_callback_count_); |
307 EXPECT_TRUE(last_socket_.get() != NULL); | 302 EXPECT_TRUE(last_socket_.get() != NULL); |
308 | 303 |
309 // Take ownership of the socket for the remainder of the test. | 304 // Take ownership of the socket for the remainder of the test. |
310 scoped_refptr<BluetoothSocket> server_socket = last_socket_; | 305 scoped_refptr<BluetoothSocket> server_socket = last_socket_; |
311 last_socket_ = NULL; | 306 last_socket_ = NULL; |
312 success_callback_count_ = 0; | 307 success_callback_count_ = 0; |
313 error_callback_count_ = 0; | 308 error_callback_count_ = 0; |
314 | 309 |
315 // Simulate an incoming connection by just calling the ConnectProfile method | 310 // Simulate an incoming connection by just calling the ConnectProfile method |
316 // of the underlying fake device client (from the BlueZ point of view, | 311 // of the underlying fake device client (from the BlueZ point of view, |
317 // outgoing and incoming look the same). | 312 // outgoing and incoming look the same). |
318 // | 313 // |
319 // This is done before the Accept() call to simulate a pending call at the | 314 // This is done before the Accept() call to simulate a pending call at the |
320 // point that Accept() is called. | 315 // point that Accept() is called. |
321 FakeBluetoothDeviceClient* fake_bluetooth_device_client = | 316 FakeBluetoothDeviceClient* fake_bluetooth_device_client = |
322 static_cast<FakeBluetoothDeviceClient*>( | 317 static_cast<FakeBluetoothDeviceClient*>( |
323 DBusThreadManager::Get()->GetBluetoothDeviceClient()); | 318 DBusThreadManager::Get()->GetBluetoothDeviceClient()); |
324 BluetoothDevice* device = adapter_->GetDevice( | 319 BluetoothDevice* device = adapter_->GetDevice( |
325 FakeBluetoothDeviceClient::kPairedDeviceAddress); | 320 FakeBluetoothDeviceClient::kPairedDeviceAddress); |
326 ASSERT_TRUE(device != NULL); | 321 ASSERT_TRUE(device != NULL); |
327 fake_bluetooth_device_client->ConnectProfile( | 322 fake_bluetooth_device_client->ConnectProfile( |
328 static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), | 323 static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), |
329 FakeBluetoothProfileManagerClient::kRfcommUuid, | 324 FakeBluetoothProfileManagerClient::kRfcommUuid, |
330 base::Bind(&base::DoNothing), | 325 base::Bind(&base::DoNothing), |
331 base::Bind(&DoNothingDBusErrorCallback)); | 326 base::Bind(&DoNothingDBusErrorCallback)); |
332 | 327 |
333 message_loop_.RunUntilIdle(); | |
334 | |
335 server_socket->Accept( | 328 server_socket->Accept( |
336 base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback, | 329 base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback, |
337 base::Unretained(this)), | 330 base::Unretained(this)), |
338 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 331 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
339 base::Unretained(this))); | 332 base::Unretained(this))); |
340 | 333 |
341 message_loop_.Run(); | 334 message_loop_.Run(); |
342 | 335 |
343 EXPECT_EQ(1U, success_callback_count_); | 336 EXPECT_EQ(1U, success_callback_count_); |
344 EXPECT_EQ(0U, error_callback_count_); | 337 EXPECT_EQ(0U, error_callback_count_); |
(...skipping 18 matching lines...) Expand all Loading... |
363 error_callback_count_ = 0; | 356 error_callback_count_ = 0; |
364 | 357 |
365 // Run a second connection test, this time calling Accept() before the | 358 // Run a second connection test, this time calling Accept() before the |
366 // incoming connection comes in. | 359 // incoming connection comes in. |
367 server_socket->Accept( | 360 server_socket->Accept( |
368 base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback, | 361 base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback, |
369 base::Unretained(this)), | 362 base::Unretained(this)), |
370 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 363 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
371 base::Unretained(this))); | 364 base::Unretained(this))); |
372 | 365 |
373 message_loop_.RunUntilIdle(); | |
374 | |
375 fake_bluetooth_device_client->ConnectProfile( | 366 fake_bluetooth_device_client->ConnectProfile( |
376 static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), | 367 static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), |
377 FakeBluetoothProfileManagerClient::kRfcommUuid, | 368 FakeBluetoothProfileManagerClient::kRfcommUuid, |
378 base::Bind(&base::DoNothing), | 369 base::Bind(&base::DoNothing), |
379 base::Bind(&DoNothingDBusErrorCallback)); | 370 base::Bind(&DoNothingDBusErrorCallback)); |
380 | 371 |
381 message_loop_.Run(); | 372 message_loop_.Run(); |
382 | 373 |
383 EXPECT_EQ(1U, success_callback_count_); | 374 EXPECT_EQ(1U, success_callback_count_); |
384 EXPECT_EQ(0U, error_callback_count_); | 375 EXPECT_EQ(0U, error_callback_count_); |
(...skipping 15 matching lines...) Expand all Loading... |
400 EXPECT_EQ(1U, success_callback_count_); | 391 EXPECT_EQ(1U, success_callback_count_); |
401 client_socket = NULL; | 392 client_socket = NULL; |
402 success_callback_count_ = 0; | 393 success_callback_count_ = 0; |
403 error_callback_count_ = 0; | 394 error_callback_count_ = 0; |
404 | 395 |
405 // Now close the server socket. | 396 // Now close the server socket. |
406 server_socket->Disconnect( | 397 server_socket->Disconnect( |
407 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, | 398 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
408 base::Unretained(this))); | 399 base::Unretained(this))); |
409 | 400 |
410 message_loop_.RunUntilIdle(); | |
411 | |
412 EXPECT_EQ(1U, success_callback_count_); | 401 EXPECT_EQ(1U, success_callback_count_); |
413 } | 402 } |
414 | 403 |
415 TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { | 404 TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) { |
416 // Start off with an invisible adapter, register the profile, then make | 405 // Start off with an invisible adapter, register the profile, then make |
417 // the adapter visible. | 406 // the adapter visible. |
418 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = | 407 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = |
419 static_cast<FakeBluetoothAdapterClient*>( | 408 static_cast<FakeBluetoothAdapterClient*>( |
420 DBusThreadManager::Get()->GetBluetoothAdapterClient()); | 409 DBusThreadManager::Get()->GetBluetoothAdapterClient()); |
421 fake_bluetooth_adapter_client->SetVisible(false); | 410 fake_bluetooth_adapter_client->SetVisible(false); |
422 | 411 |
423 adapter_->CreateRfcommService( | 412 adapter_->CreateRfcommService( |
424 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), | 413 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), |
425 BluetoothAdapter::ServiceOptions(), | 414 BluetoothAdapter::ServiceOptions(), |
426 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, | 415 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, |
427 base::Unretained(this)), | 416 base::Unretained(this)), |
428 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 417 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
429 base::Unretained(this))); | 418 base::Unretained(this))); |
430 message_loop_.Run(); | |
431 | 419 |
432 EXPECT_EQ(1U, success_callback_count_); | 420 EXPECT_EQ(1U, success_callback_count_); |
433 EXPECT_EQ(0U, error_callback_count_); | 421 EXPECT_EQ(0U, error_callback_count_); |
434 EXPECT_TRUE(last_socket_.get() != NULL); | 422 EXPECT_TRUE(last_socket_.get() != NULL); |
435 | 423 |
436 // Take ownership of the socket for the remainder of the test. | 424 // Take ownership of the socket for the remainder of the test. |
437 scoped_refptr<BluetoothSocket> socket = last_socket_; | 425 scoped_refptr<BluetoothSocket> socket = last_socket_; |
438 last_socket_ = NULL; | 426 last_socket_ = NULL; |
439 success_callback_count_ = 0; | 427 success_callback_count_ = 0; |
440 error_callback_count_ = 0; | 428 error_callback_count_ = 0; |
441 | 429 |
442 // But there shouldn't be a profile registered yet. | 430 // But there shouldn't be a profile registered yet. |
443 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = | 431 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = |
444 static_cast<FakeBluetoothProfileManagerClient*>( | 432 static_cast<FakeBluetoothProfileManagerClient*>( |
445 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); | 433 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); |
446 FakeBluetoothProfileServiceProvider* profile_service_provider = | 434 FakeBluetoothProfileServiceProvider* profile_service_provider = |
447 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( | 435 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
448 FakeBluetoothProfileManagerClient::kRfcommUuid); | 436 FakeBluetoothProfileManagerClient::kRfcommUuid); |
449 EXPECT_TRUE(profile_service_provider == NULL); | 437 EXPECT_TRUE(profile_service_provider == NULL); |
450 | 438 |
451 // Make the adapter visible. This should register a profile. | 439 // Make the adapter visible. This should register a profile. |
452 fake_bluetooth_adapter_client->SetVisible(true); | 440 fake_bluetooth_adapter_client->SetVisible(true); |
453 | 441 |
454 message_loop_.RunUntilIdle(); | |
455 | |
456 profile_service_provider = | 442 profile_service_provider = |
457 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( | 443 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
458 FakeBluetoothProfileManagerClient::kRfcommUuid); | 444 FakeBluetoothProfileManagerClient::kRfcommUuid); |
459 EXPECT_TRUE(profile_service_provider != NULL); | 445 EXPECT_TRUE(profile_service_provider != NULL); |
460 | 446 |
461 // Cleanup the socket. | 447 // Cleanup the socket. |
462 socket->Disconnect( | 448 socket->Disconnect( |
463 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, | 449 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
464 base::Unretained(this))); | 450 base::Unretained(this))); |
465 | 451 |
466 message_loop_.RunUntilIdle(); | |
467 | |
468 EXPECT_EQ(1U, success_callback_count_); | 452 EXPECT_EQ(1U, success_callback_count_); |
469 } | 453 } |
470 | 454 |
471 TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { | 455 TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) { |
472 // The fake adapter starts off visible by default. | 456 // The fake adapter starts off visible by default. |
473 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = | 457 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client = |
474 static_cast<FakeBluetoothAdapterClient*>( | 458 static_cast<FakeBluetoothAdapterClient*>( |
475 DBusThreadManager::Get()->GetBluetoothAdapterClient()); | 459 DBusThreadManager::Get()->GetBluetoothAdapterClient()); |
476 | 460 |
477 adapter_->CreateRfcommService( | 461 adapter_->CreateRfcommService( |
478 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), | 462 BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid), |
479 BluetoothAdapter::ServiceOptions(), | 463 BluetoothAdapter::ServiceOptions(), |
480 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, | 464 base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback, |
481 base::Unretained(this)), | 465 base::Unretained(this)), |
482 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, | 466 base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
483 base::Unretained(this))); | 467 base::Unretained(this))); |
484 message_loop_.Run(); | |
485 | 468 |
486 EXPECT_EQ(1U, success_callback_count_); | 469 EXPECT_EQ(1U, success_callback_count_); |
487 EXPECT_EQ(0U, error_callback_count_); | 470 EXPECT_EQ(0U, error_callback_count_); |
488 EXPECT_TRUE(last_socket_.get() != NULL); | 471 EXPECT_TRUE(last_socket_.get() != NULL); |
489 | 472 |
490 // Take ownership of the socket for the remainder of the test. | 473 // Take ownership of the socket for the remainder of the test. |
491 scoped_refptr<BluetoothSocket> socket = last_socket_; | 474 scoped_refptr<BluetoothSocket> socket = last_socket_; |
492 last_socket_ = NULL; | 475 last_socket_ = NULL; |
493 success_callback_count_ = 0; | 476 success_callback_count_ = 0; |
494 error_callback_count_ = 0; | 477 error_callback_count_ = 0; |
495 | 478 |
496 // Make sure the profile was registered with the daemon. | 479 // Make sure the profile was registered with the daemon. |
497 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = | 480 FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client = |
498 static_cast<FakeBluetoothProfileManagerClient*>( | 481 static_cast<FakeBluetoothProfileManagerClient*>( |
499 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); | 482 DBusThreadManager::Get()->GetBluetoothProfileManagerClient()); |
500 FakeBluetoothProfileServiceProvider* profile_service_provider = | 483 FakeBluetoothProfileServiceProvider* profile_service_provider = |
501 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( | 484 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
502 FakeBluetoothProfileManagerClient::kRfcommUuid); | 485 FakeBluetoothProfileManagerClient::kRfcommUuid); |
503 EXPECT_TRUE(profile_service_provider != NULL); | 486 EXPECT_TRUE(profile_service_provider != NULL); |
504 | 487 |
505 // Make the adapter invisible, and fiddle with the profile fake to unregister | 488 // Make the adapter invisible, and fiddle with the profile fake to unregister |
506 // the profile since this doesn't happen automatically. | 489 // the profile since this doesn't happen automatically. |
507 fake_bluetooth_adapter_client->SetVisible(false); | 490 fake_bluetooth_adapter_client->SetVisible(false); |
508 | 491 fake_bluetooth_profile_manager_client->UnregisterProfile( |
509 message_loop_.RunUntilIdle(); | 492 static_cast<BluetoothSocketChromeOS*>(socket.get())->object_path(), |
| 493 base::Bind(&base::DoNothing), |
| 494 base::Bind(&DoNothingDBusErrorCallback)); |
510 | 495 |
511 // Then make the adapter visible again. This should re-register the profile. | 496 // Then make the adapter visible again. This should re-register the profile. |
512 fake_bluetooth_adapter_client->SetVisible(true); | 497 fake_bluetooth_adapter_client->SetVisible(true); |
513 | 498 |
514 message_loop_.RunUntilIdle(); | |
515 | |
516 profile_service_provider = | 499 profile_service_provider = |
517 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( | 500 fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
518 FakeBluetoothProfileManagerClient::kRfcommUuid); | 501 FakeBluetoothProfileManagerClient::kRfcommUuid); |
519 EXPECT_TRUE(profile_service_provider != NULL); | 502 EXPECT_TRUE(profile_service_provider != NULL); |
520 | 503 |
521 // Cleanup the socket. | 504 // Cleanup the socket. |
522 socket->Disconnect( | 505 socket->Disconnect( |
523 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, | 506 base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
524 base::Unretained(this))); | 507 base::Unretained(this))); |
525 | 508 |
526 message_loop_.RunUntilIdle(); | |
527 | |
528 EXPECT_EQ(1U, success_callback_count_); | 509 EXPECT_EQ(1U, success_callback_count_); |
529 } | 510 } |
530 | 511 |
531 } // namespace chromeos | 512 } // namespace chromeos |
OLD | NEW |