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

Unified Diff: third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js

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: third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
index 450c27d360293c32dec0bf33b16d4700e956ae02..090cd893fa8458dfe7e869f4e9e338cc870d6a47 100644
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
@@ -139,7 +139,7 @@
let peripheral = this.peripherals_.get(address);
if (peripheral === undefined) {
- peripheral = new FakePeripheral(address, this);
+ peripheral = new FakePeripheral(address, this.fake_central_ptr_);
this.peripherals_.set(address, peripheral);
}
@@ -148,9 +148,20 @@
}
class FakePeripheral {
- constructor(address, fake_central) {
+ constructor(address, fake_central_ptr) {
this.address = address;
- this.fake_central_ = fake_central;
+ this.fake_central_ptr_ = fake_central_ptr;
+ }
+
+ // Simulates a GATT Connection request response with |code| for the
+ // peripheral. |code| could be an HCI Error Code from
+ // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a number outside that
+ // range returned by specific platforms e.g. Android returns 0x101 to signal
+ // a GATT failure
+ // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE
+ async simulateGATTConnectionResponse({code}) {
+ await this.fake_central_ptr_.simulateGATTConnectionResponse(
+ this.address, code);
}
}

Powered by Google App Engine
This is Rietveld 408576698