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

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

Issue 2858803003: bluetooth: Implement simulatePreconnectedPeripheral. (Closed)
Patch Set: small cleanup Created 3 years, 8 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 7fd297ea003dc779e6376faab3d023bffe31b66a..9261302f10219223d464ca82a05a75d5e6c53b8e 100644
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
@@ -100,7 +100,29 @@
// performed by the device in the Central/Observer role.
class FakeCentral {
constructor(fake_central_ptr) {
- this.fake_central_ptr = fake_central_ptr;
+ this.fake_central_ptr_ = fake_central_ptr;
+ this.peripherals_ = new Map();
+ }
+
+ // Simulates a peripheral with |address| and |name| that has already
+ // been connected to the system.
+ //
+ // Platforms offer methods to retrieve devices that have already been
+ // connected to the system or didn't connected through the UA e.g. a
scheib 2017/05/03 20:38:49 ditto
ortuno 2017/05/04 04:16:21 Done.
+ // user connected a peripheral through the system's settings. This method is
+ // intended to simulate peripherals that those methods would return.
+ async simulateSystemConnectedPeripheral({address, name}) {
+ let peripheral_id = await this.fake_central_ptr_
+ .simulateSystemConnectedPeripheral(address, name);
+ let peripheral = new FakePeripheral(peripheral_id, this);
+ this.peripherals_.set(peripheral_id, peripheral);
+ }
+ }
+
+ class FakePeripheral {
+ constructor(peripheral_id, fake_central) {
+ this.peripheral_id = peripheral_id;
+ this.fake_central = fake_central;
}
}

Powered by Google App Engine
This is Rietveld 408576698