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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 2008113002: Notify the BluetoothAdapter::Observer when a bluetooth peripheral disconnects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 4 years, 7 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_device_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc
index 0b075e250d02187bba5c4bd989889af0079a1a9c..4a2e20c15ab79e40d47bd45994eac080b8533497 100644
--- a/device/bluetooth/bluetooth_device_unittest.cc
+++ b/device/bluetooth/bluetooth_device_unittest.cc
@@ -472,6 +472,7 @@ TEST_F(BluetoothTest, BluetoothGattConnection_DisconnectGatt_Cleanup) {
GetConnectErrorCallback(Call::NOT_EXPECTED));
TestBluetoothAdapterObserver observer(adapter_);
SimulateGattConnection(device);
+ EXPECT_EQ(1, observer.device_changed_count());
scheib 2016/05/24 23:34:34 These additions are fine, but I sought a simpler t
Jeffrey Yasskin 2016/05/25 00:08:12 Done.
EXPECT_TRUE(device->IsConnected());
// Discover services
@@ -486,6 +487,7 @@ TEST_F(BluetoothTest, BluetoothGattConnection_DisconnectGatt_Cleanup) {
// Disconnect from the device
device->DisconnectGatt();
SimulateGattDisconnection(device);
+ EXPECT_EQ(2, observer.device_changed_count());
EXPECT_FALSE(device->IsConnected());
EXPECT_FALSE(device->IsGattServicesDiscoveryComplete());
EXPECT_EQ(0u, device->GetGattServices().size());
@@ -494,6 +496,7 @@ TEST_F(BluetoothTest, BluetoothGattConnection_DisconnectGatt_Cleanup) {
device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED),
GetConnectErrorCallback(Call::NOT_EXPECTED));
SimulateGattConnection(device);
+ EXPECT_EQ(3, observer.device_changed_count());
EXPECT_TRUE(device->IsConnected());
// Verify that service discovery can be done again
@@ -552,6 +555,7 @@ TEST_F(BluetoothTest, GattServices_ObserversCalls) {
TestBluetoothAdapterObserver observer(adapter_);
ResetEventCounts();
SimulateGattConnection(device);
+ EXPECT_EQ(1, observer.device_changed_count());
EXPECT_EQ(1, gatt_discovery_attempts_);
std::vector<std::string> services;
@@ -561,6 +565,9 @@ TEST_F(BluetoothTest, GattServices_ObserversCalls) {
EXPECT_EQ(1, observer.gatt_services_discovered_count());
EXPECT_EQ(2, observer.gatt_service_added_count());
+
+ SimulateGattDisconnection(device);
+ EXPECT_EQ(2, observer.device_changed_count());
}
#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698