Index: device/bluetooth/bluetooth_socket_chromeos_unittest.cc |
diff --git a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc |
index 79d43ae8bb5f25d5cd67d181ba018614a8c4d18e..1a4aa96853b9937e6bcf82ae6a04dd853112ebc7 100644 |
--- a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc |
+++ b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc |
@@ -12,7 +12,6 @@ |
#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" |
#include "chromeos/dbus/fake_bluetooth_input_client.h" |
#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
-#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" |
#include "device/bluetooth/bluetooth_adapter.h" |
#include "device/bluetooth/bluetooth_adapter_chromeos.h" |
#include "device/bluetooth/bluetooth_adapter_factory.h" |
@@ -145,9 +144,6 @@ |
void CreateServiceSuccessCallback(scoped_refptr<BluetoothSocket> socket) { |
++success_callback_count_; |
last_socket_ = socket; |
- |
- if (message_loop_.is_running()) |
- message_loop_.Quit(); |
} |
void AcceptSuccessCallback(const BluetoothDevice* device, |
@@ -191,6 +187,7 @@ |
base::Unretained(this)), |
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
base::Unretained(this))); |
+ |
message_loop_.Run(); |
EXPECT_EQ(1U, success_callback_count_); |
@@ -299,8 +296,6 @@ |
base::Unretained(this)), |
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
base::Unretained(this))); |
- |
- message_loop_.Run(); |
EXPECT_EQ(1U, success_callback_count_); |
EXPECT_EQ(0U, error_callback_count_); |
@@ -330,8 +325,6 @@ |
base::Bind(&base::DoNothing), |
base::Bind(&DoNothingDBusErrorCallback)); |
- message_loop_.RunUntilIdle(); |
- |
server_socket->Accept( |
base::Bind(&BluetoothSocketChromeOSTest::AcceptSuccessCallback, |
base::Unretained(this)), |
@@ -369,8 +362,6 @@ |
base::Unretained(this)), |
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
base::Unretained(this))); |
- |
- message_loop_.RunUntilIdle(); |
fake_bluetooth_device_client->ConnectProfile( |
static_cast<BluetoothDeviceChromeOS*>(device)->object_path(), |
@@ -406,8 +397,6 @@ |
server_socket->Disconnect( |
base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
base::Unretained(this))); |
- |
- message_loop_.RunUntilIdle(); |
EXPECT_EQ(1U, success_callback_count_); |
} |
@@ -427,7 +416,6 @@ |
base::Unretained(this)), |
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
base::Unretained(this))); |
- message_loop_.Run(); |
EXPECT_EQ(1U, success_callback_count_); |
EXPECT_EQ(0U, error_callback_count_); |
@@ -451,8 +439,6 @@ |
// Make the adapter visible. This should register a profile. |
fake_bluetooth_adapter_client->SetVisible(true); |
- message_loop_.RunUntilIdle(); |
- |
profile_service_provider = |
fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
FakeBluetoothProfileManagerClient::kRfcommUuid); |
@@ -462,8 +448,6 @@ |
socket->Disconnect( |
base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
base::Unretained(this))); |
- |
- message_loop_.RunUntilIdle(); |
EXPECT_EQ(1U, success_callback_count_); |
} |
@@ -481,7 +465,6 @@ |
base::Unretained(this)), |
base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback, |
base::Unretained(this))); |
- message_loop_.Run(); |
EXPECT_EQ(1U, success_callback_count_); |
EXPECT_EQ(0U, error_callback_count_); |
@@ -505,13 +488,13 @@ |
// Make the adapter invisible, and fiddle with the profile fake to unregister |
// the profile since this doesn't happen automatically. |
fake_bluetooth_adapter_client->SetVisible(false); |
- |
- message_loop_.RunUntilIdle(); |
+ fake_bluetooth_profile_manager_client->UnregisterProfile( |
+ static_cast<BluetoothSocketChromeOS*>(socket.get())->object_path(), |
+ base::Bind(&base::DoNothing), |
+ base::Bind(&DoNothingDBusErrorCallback)); |
// Then make the adapter visible again. This should re-register the profile. |
fake_bluetooth_adapter_client->SetVisible(true); |
- |
- message_loop_.RunUntilIdle(); |
profile_service_provider = |
fake_bluetooth_profile_manager_client->GetProfileServiceProvider( |
@@ -523,8 +506,6 @@ |
base::Bind(&BluetoothSocketChromeOSTest::ImmediateSuccessCallback, |
base::Unretained(this))); |
- message_loop_.RunUntilIdle(); |
- |
EXPECT_EQ(1U, success_callback_count_); |
} |