Chromium Code Reviews| 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; |
| } |
| } |