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

Unified Diff: device/bluetooth/test/fake_peripheral.h

Issue 2874873003: bluetooth: Implement simulateGATTConnectionResponse() (Closed)
Patch Set: Merge branch 'bluetooth-generate-with-headers' into bluetooth-simulate-gatt-discovery-complete Created 3 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/test/fake_peripheral.h
diff --git a/device/bluetooth/test/fake_peripheral.h b/device/bluetooth/test/fake_peripheral.h
index 56c17b2a1efd6f74e5f074963ff2d2d3ea9ee9d8..a592ec81342adb751b3924c1de460214ebc2ff26 100644
--- a/device/bluetooth/test/fake_peripheral.h
+++ b/device/bluetooth/test/fake_peripheral.h
@@ -31,6 +31,11 @@ class FakePeripheral : public device::BluetoothDevice {
// BluetoothDevice::GetUUIDs().
void SetServiceUUIDs(UUIDSet service_uuids);
+ // If |code| is kHCISuccess calls a pending success callback for
+ // CreateGattConnection. Otherwise calls a pending error callback
+ // with the ConnectErrorCode corresponding to |code|.
+ void SimulateGATTConnectionResponse(uint16_t code);
+
// BluetoothDevice overrides:
uint32_t GetBluetoothClass() const override;
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
@@ -75,6 +80,9 @@ class FakePeripheral : public device::BluetoothDevice {
const device::BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
const ConnectToServiceErrorCallback& error_callback) override;
+ void CreateGattConnection(
+ const GattConnectionCallback& callback,
+ const ConnectErrorCallback& error_callback) override;
protected:
void CreateGattConnectionImpl() override;
@@ -86,6 +94,10 @@ class FakePeripheral : public device::BluetoothDevice {
bool gatt_connected_;
UUIDSet service_uuids_;
+ using CreateGattConnectionCallbacks =
+ std::pair<GattConnectionCallback, ConnectErrorCallback>;
+ std::queue<CreateGattConnectionCallbacks> create_gatt_connection_callbacks_;
+
DISALLOW_COPY_AND_ASSIGN(FakePeripheral);
};

Powered by Google App Engine
This is Rietveld 408576698