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

Unified Diff: device/bluetooth/bluetooth_chromeos_unittest.cc

Issue 975323002: Revert of Fix BluetoothAdapterProfileChromeOS lifecycle management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_chromeos_unittest.cc
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
index 9664b08450e30d539912e9ae447f33c0a7ee6fe4..7da63b789c4de98ae3c903bcf58f45763f4fbe95 100644
--- a/device/bluetooth/bluetooth_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -324,8 +324,7 @@
QuitMessageLoop();
}
- void ProfileRegisteredCallback(BluetoothAdapterProfileChromeOS* profile) {
- adapter_profile_ = profile;
+ void ProfileRegisteredCallback(BluetoothAdapterProfileChromeOS*) {
++callback_count_;
QuitMessageLoop();
}
@@ -427,7 +426,6 @@
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;
@@ -3190,8 +3188,6 @@
EXPECT_EQ(dbus::ObjectPath(""), adapter_chrome_os->object_path());
- adapter_profile_ = NULL;
-
FakeBluetoothProfileServiceProviderDelegate profile_delegate;
adapter_chrome_os->UseProfile(
BluetoothUUID(), dbus::ObjectPath(""),
@@ -3200,10 +3196,11 @@
base::Unretained(this)),
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
base::Unretained(this)));
-
- EXPECT_FALSE(adapter_profile_) << "UseProfile error";
- EXPECT_EQ(0, callback_count_) << "UseProfile error";
- EXPECT_EQ(1, error_callback_count_--) << "UseProfile error";
+ base::MessageLoop::current()->Run();
+ EXPECT_EQ(1, callback_count_--) << "UseProfile error";
+ EXPECT_EQ(0, error_callback_count_) << "UseProfile error";
+
+ adapter_chrome_os->ReleaseProfile(BluetoothUUID());
// Protected and private methods:
@@ -3260,8 +3257,6 @@
// OnStartDiscoveryError tested in Shutdown_OnStartDiscoveryError
// 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.
@@ -3273,9 +3268,14 @@
base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
base::Unretained(this)));
- EXPECT_FALSE(adapter_profile_) << "UseProfile error";
- EXPECT_EQ(0, callback_count_) << "UseProfile error";
- EXPECT_EQ(1, error_callback_count_--) << "UseProfile error";
+ 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";
adapter_chrome_os->SetProfileDelegate(
BluetoothUUID(), dbus::ObjectPath(""), &profile_delegate,
@@ -3286,9 +3286,13 @@
EXPECT_EQ(0, callback_count_) << "SetProfileDelegate error";
EXPECT_EQ(1, error_callback_count_--) << "SetProfileDelegate error";
- adapter_chrome_os->OnRegisterProfileError(BluetoothUUID(), "", "");
+ adapter_chrome_os->OnRegisterProfileError(
+ BluetoothUUID(),
+ base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
+ base::Unretained(this)),
+ "", "");
EXPECT_EQ(0, callback_count_) << "OnRegisterProfileError error";
- EXPECT_EQ(0, error_callback_count_) << "OnRegisterProfileError error";
+ EXPECT_EQ(1, error_callback_count_--) << "OnRegisterProfileError error";
adapter_chrome_os->ProcessQueuedDiscoveryRequests();
« no previous file with comments | « device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_socket_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698