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

Unified Diff: components/proximity_auth/ble/bluetooth_low_energy_connection.h

Issue 1144333007: Adding unit tests for BLE connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing compilation on OS X and Windows 2 Created 5 years, 6 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: components/proximity_auth/ble/bluetooth_low_energy_connection.h
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection.h b/components/proximity_auth/ble/bluetooth_low_energy_connection.h
index c2f88eb3cc6c0ddc72ca76ef426f7f9f67f2a724..41ff41482257bdd88b56d339fd727adef4acf889 100644
--- a/components/proximity_auth/ble/bluetooth_low_energy_connection.h
+++ b/components/proximity_auth/ble/bluetooth_low_energy_connection.h
@@ -59,11 +59,25 @@ class BluetoothLowEnergyConnection : public Connection,
kDisconnectSignal = 3,
};
+ // The sub-state of a proximity_auth::BluetoothLowEnergyConnection class
+ // extends the IN_PROGRESS state of proximity_auth::Connection::Status.
+ enum class SubStatus {
+ DISCONNECTED,
+ WAITING_GATT_CONNECTION,
+ GATT_CONNECTION_ESTABLISHED,
+ WAITING_CHARACTERISTICS,
+ CHARACTERISTICS_FOUND,
+ WAITING_NOTIFY_SESSION,
+ NOTIFY_SESSION_READY,
+ WAITING_RESPONSE_SIGNAL,
+ CONNECTED,
+ };
+
// Constructs a Bluetooth low energy connection to the service with
// |remote_service_| on the |remote_device|. The |adapter| must be already
// initaalized and ready. The GATT connection may alreaady be established and
- // pass through |gatt_connection|. If |gatt_connection| is NULL, a subsequent
- // call to Connect() must be made.
+ // pass through |gatt_connection|. A subsequent call to Connect() must be
+ // made.
BluetoothLowEnergyConnection(
const RemoteDevice& remote_device,
scoped_refptr<device::BluetoothAdapter> adapter,
@@ -80,23 +94,17 @@ class BluetoothLowEnergyConnection : public Connection,
void Disconnect() override;
protected:
- // The sub-state of a proximity_auth::BluetoothLowEnergyConnection class
- // extends the IN_PROGRESS state of proximity_auth::Connection::Status.
- enum class SubStatus {
- DISCONNECTED,
- WAITING_GATT_CONNECTION,
- GATT_CONNECTION_ESTABLISHED,
- WAITING_CHARACTERISTICS,
- CHARACTERISTICS_FOUND,
- WAITING_NOTIFY_SESSION,
- NOTIFY_SESSION_READY,
- WAITING_RESPONSE_SIGNAL,
- CONNECTED,
- };
-
+ // Exposed for testing.
void SetSubStatus(SubStatus status);
SubStatus sub_status() { return sub_status_; }
+ // Virtual for testing.
+ virtual BluetoothLowEnergyCharacteristicsFinder* CreateCharacteristicsFinder(
+ const BluetoothLowEnergyCharacteristicsFinder::SuccessCallback&
+ success_callback,
+ const BluetoothLowEnergyCharacteristicsFinder::ErrorCallback&
+ error_callback);
+
// proximity_auth::Connection
void SendMessageImpl(scoped_ptr<WireMessage> message) override;
scoped_ptr<WireMessage> DeserializeWireMessage(

Powered by Google App Engine
This is Rietveld 408576698