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

Unified Diff: device/bluetooth/bluetooth_chromeos_unittest.cc

Issue 848613003: bluetooth: Shutdown BluetoothAdapter before DBus on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: unit test Created 5 years, 11 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 08c353e7a70866da612c1c8175a16708ec34c3d1..e6e9bd1b0697a0bc5f57b69e7ff78ce6c3b441ff 100644
--- a/device/bluetooth/bluetooth_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -3318,4 +3318,49 @@ TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) {
EXPECT_EQ(4, conn_info.max_transmit_power);
}
+// Verifies OnDBusThreadManagerShutdown shuts down the adapter as expected.
+TEST_F(BluetoothChromeOSTest, OnDBusThreadManagerShutdown) {
+ // Set up and adapter, power, discoverable, start discovery.
+ GetAdapter();
+ adapter_->SetPowered(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
+ adapter_->SetDiscoverable(true, base::Bind(&BluetoothChromeOSTest::Callback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
+ adapter_->StartDiscoverySession(
+ base::Bind(&BluetoothChromeOSTest::DiscoverySessionCallback,
+ base::Unretained(this)),
+ base::Bind(&BluetoothChromeOSTest::ErrorCallback,
+ base::Unretained(this)));
+
+ // Validate running adapter state.
+ EXPECT_NE("", adapter_->GetAddress());
+ EXPECT_NE("", adapter_->GetName());
+ EXPECT_TRUE(adapter_->IsInitialized());
+ EXPECT_TRUE(adapter_->IsPresent());
+ EXPECT_TRUE(adapter_->IsPowered());
+ EXPECT_TRUE(adapter_->IsDiscoverable());
+ EXPECT_TRUE(adapter_->IsDiscovering());
+ EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
+ adapter_.get())->object_path());
+
+ // OnDBusThreadManagerShutdown
+ static_cast<BluetoothAdapterChromeOS*>(adapter_.get())
+ ->OnDBusThreadManagerShutdown();
+
+ // Validate post shutdown state.
+ EXPECT_EQ("", adapter_->GetAddress());
+ EXPECT_EQ("", adapter_->GetName());
+ EXPECT_TRUE(adapter_->IsInitialized());
+ EXPECT_FALSE(adapter_->IsPresent());
+ EXPECT_FALSE(adapter_->IsPowered());
+ EXPECT_FALSE(adapter_->IsDiscoverable());
+ EXPECT_FALSE(adapter_->IsDiscovering());
+ EXPECT_EQ(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
+ adapter_.get())->object_path());
+}
+
} // namespace chromeos
« content/shell/browser/shell_views.cc ('K') | « device/bluetooth/bluetooth_adapter_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698