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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html

Issue 2544513004: Fix WebBluetooth generator to distinguish between different methods. (Closed)
Patch Set: Remove TL;DR in README Created 4 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py -->
2 <!DOCTYPE html>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
6 <script>
7 'use strict';
8 promise_test(() => {
9 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
10 .then(() => requestDeviceWithKeyDown({
11 filters: [{services: ['health_thermometer']}],
12 optionalServices: [request_disconnection_service_uuid]}))
13 .then(device => device.gatt.connect())
14 .then(gattServer => {
15 let characteristics;
16 return gattServer.getPrimaryService('health_thermometer')
17 .then(service => service.getCharacteristic('measurement_interval'))
18 .then(c => {
19 // Convert to array if necessary.
20 characteristics = [].concat(c);
21 return get_request_disconnection(gattServer);
22 })
23 .then(requestDisconnection => requestDisconnection())
24 .then(() => gattServer.connect())
25 .then(() => characteristics);
26 })
27 .then(characteristics => {
28 let promises = Promise.resolve();
29 for (let characteristic of characteristics) {
30 let error = new DOMException(
31 'Characteristic is no longer valid. Remember to retrieve the ' +
32 'characteristic again after reconnecting.',
33 'InvalidStateError');
34 promises = promises.then(() =>
35 assert_promise_rejects_with_message(
36 characteristic.readValue(),
37 error));
38 promises = promises.then(() =>
39 assert_promise_rejects_with_message(
40 characteristic.writeValue(new Uint8Array([1])),
41 error));
42 promises = promises.then(() =>
43 assert_promise_rejects_with_message(
44 characteristic.startNotifications(),
45 error));
46 promises = promises.then(() =>
47 assert_promise_rejects_with_message(
48 characteristic.stopNotifications(),
49 error));
50 }
51 return promises;
52 });
53 }, 'Calls on characteristics after device disconnects and we reconnect. ' +
54 'Should reject with InvalidStateError.');
55
56 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698