| Index: device/bluetooth/bluetooth_chromeos_unittest.cc
|
| diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
|
| index 7da63b789c4de98ae3c903bcf58f45763f4fbe95..9664b08450e30d539912e9ae447f33c0a7ee6fe4 100644
|
| --- a/device/bluetooth/bluetooth_chromeos_unittest.cc
|
| +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
|
| @@ -324,7 +324,8 @@ class BluetoothChromeOSTest : public testing::Test {
|
| QuitMessageLoop();
|
| }
|
|
|
| - void ProfileRegisteredCallback(BluetoothAdapterProfileChromeOS*) {
|
| + void ProfileRegisteredCallback(BluetoothAdapterProfileChromeOS* profile) {
|
| + adapter_profile_ = profile;
|
| ++callback_count_;
|
| QuitMessageLoop();
|
| }
|
| @@ -426,6 +427,7 @@ class BluetoothChromeOSTest : public testing::Test {
|
| enum BluetoothDevice::ConnectErrorCode last_connect_error_;
|
| std::string last_client_error_;
|
| ScopedVector<BluetoothDiscoverySession> discovery_sessions_;
|
| + BluetoothAdapterProfileChromeOS *adapter_profile_;
|
|
|
| private:
|
| // Some tests use a message loop since background processing is simulated;
|
| @@ -3188,6 +3190,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
|
|
|
| EXPECT_EQ(dbus::ObjectPath(""), adapter_chrome_os->object_path());
|
|
|
| + adapter_profile_ = NULL;
|
| +
|
| FakeBluetoothProfileServiceProviderDelegate profile_delegate;
|
| adapter_chrome_os->UseProfile(
|
| BluetoothUUID(), dbus::ObjectPath(""),
|
| @@ -3196,11 +3200,10 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
|
| base::Unretained(this)),
|
| base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
|
| base::Unretained(this)));
|
| - base::MessageLoop::current()->Run();
|
| - EXPECT_EQ(1, callback_count_--) << "UseProfile error";
|
| - EXPECT_EQ(0, error_callback_count_) << "UseProfile error";
|
|
|
| - adapter_chrome_os->ReleaseProfile(BluetoothUUID());
|
| + EXPECT_FALSE(adapter_profile_) << "UseProfile error";
|
| + EXPECT_EQ(0, callback_count_) << "UseProfile error";
|
| + EXPECT_EQ(1, error_callback_count_--) << "UseProfile error";
|
|
|
| // Protected and private methods:
|
|
|
| @@ -3258,6 +3261,8 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
|
| // OnStopDiscovery tested in Shutdown_OnStopDiscovery
|
| // OnStopDiscoveryError tested in Shutdown_OnStopDiscoveryError
|
|
|
| + adapter_profile_ = NULL;
|
| +
|
| // OnRegisterProfile SetProfileDelegate, OnRegisterProfileError, require
|
| // UseProfile to be set first, do so again here just before calling them.
|
| adapter_chrome_os->UseProfile(
|
| @@ -3268,14 +3273,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
|
| base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
|
| base::Unretained(this)));
|
|
|
| - adapter_chrome_os->OnRegisterProfile(
|
| - BluetoothUUID(), dbus::ObjectPath(""), &profile_delegate,
|
| - base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
|
| - base::Unretained(this)),
|
| - base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
|
| - base::Unretained(this)));
|
| - EXPECT_EQ(1, callback_count_--) << "OnRegisterProfile error";
|
| - EXPECT_EQ(1, error_callback_count_--) << "OnRegisterProfile error";
|
| + EXPECT_FALSE(adapter_profile_) << "UseProfile error";
|
| + EXPECT_EQ(0, callback_count_) << "UseProfile error";
|
| + EXPECT_EQ(1, error_callback_count_--) << "UseProfile error";
|
|
|
| adapter_chrome_os->SetProfileDelegate(
|
| BluetoothUUID(), dbus::ObjectPath(""), &profile_delegate,
|
| @@ -3286,13 +3286,9 @@ TEST_F(BluetoothChromeOSTest, Shutdown) {
|
| EXPECT_EQ(0, callback_count_) << "SetProfileDelegate error";
|
| EXPECT_EQ(1, error_callback_count_--) << "SetProfileDelegate error";
|
|
|
| - adapter_chrome_os->OnRegisterProfileError(
|
| - BluetoothUUID(),
|
| - base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
|
| - base::Unretained(this)),
|
| - "", "");
|
| + adapter_chrome_os->OnRegisterProfileError(BluetoothUUID(), "", "");
|
| EXPECT_EQ(0, callback_count_) << "OnRegisterProfileError error";
|
| - EXPECT_EQ(1, error_callback_count_--) << "OnRegisterProfileError error";
|
| + EXPECT_EQ(0, error_callback_count_) << "OnRegisterProfileError error";
|
|
|
| adapter_chrome_os->ProcessQueuedDiscoveryRequests();
|
|
|
|
|