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

Unified Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc

Issue 1287753002: bluetooth: Remove callback from BluetoothGattConnection::Disconnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge TOT Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
index 21132adbbc872f94977c9f88fa46fb259dbdc229..8c720894a3ac43e85161e5968a5da66061b173fe 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_apitest.cc
@@ -246,15 +246,7 @@ BluetoothGattConnection* CreateGattConnection(
bool expect_disconnect) {
testing::NiceMock<MockBluetoothGattConnection>* conn =
new testing::NiceMock<MockBluetoothGattConnection>(device_address);
-
- if (expect_disconnect) {
- EXPECT_CALL(*conn, Disconnect(_))
- .Times(1)
- .WillOnce(InvokeCallbackArgument<0>());
- } else {
- EXPECT_CALL(*conn, Disconnect(_)).Times(0);
- }
-
+ EXPECT_CALL(*conn, Disconnect()).Times(expect_disconnect ? 1 : 0);
return conn;
}
@@ -1212,15 +1204,12 @@ IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, ConnectInProgress) {
.WillRepeatedly(Return(device0_.get()));
BluetoothDevice::GattConnectionCallback connect_callback;
- base::Closure disconnect_callback;
testing::NiceMock<MockBluetoothGattConnection>* conn =
new testing::NiceMock<MockBluetoothGattConnection>(
kTestLeDeviceAddress0);
scoped_ptr<BluetoothGattConnection> conn_ptr(conn);
- EXPECT_CALL(*conn, Disconnect(_))
- .Times(1)
- .WillOnce(SaveArg<0>(&disconnect_callback));
+ EXPECT_CALL(*conn, Disconnect()).Times(1);
EXPECT_CALL(*device0_, CreateGattConnection(_, _))
.Times(1)
@@ -1231,13 +1220,15 @@ IN_PROC_BROWSER_TEST_F(BluetoothLowEnergyApiTest, ConnectInProgress) {
"bluetooth_low_energy/connect_in_progress")));
EXPECT_TRUE(listener.WaitUntilSatisfied());
- ASSERT_EQ("ready", listener.message()) << listener.message();
- connect_callback.Run(conn_ptr.Pass());
-
+ ASSERT_EQ("After 2nd connect fails due to 1st connect being in progress.",
+ listener.message())
+ << listener.message();
listener.Reset();
+
+ connect_callback.Run(conn_ptr.Pass());
EXPECT_TRUE(listener.WaitUntilSatisfied());
- ASSERT_EQ("ready", listener.message()) << listener.message();
- disconnect_callback.Run();
+ ASSERT_EQ("After 2nd call to disconnect.", listener.message())
+ << listener.message();
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698