Chromium Code Reviews| Index: device/bluetooth/bluetooth_chromeos_unittest.cc |
| diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc |
| index 0c25a402f9dadcd5ac3170d8cd770c6ab57ecf1f..c4744216038f14aa246b97a28bd109382c2b84ab 100644 |
| --- a/device/bluetooth/bluetooth_chromeos_unittest.cc |
| +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc |
| @@ -3312,4 +3312,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()); |
|
armansito
2015/01/16 21:57:18
Probably also make a calls to the asynchronous met
scheib
2015/01/16 22:28:27
Done.
|
| +} |
| + |
| } // namespace chromeos |