| Index: third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects.html
|
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects.html
|
| similarity index 62%
|
| copy from third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-device-disconnects-invalidates-objects.html
|
| copy to third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects.html
|
| index 7f06b576bb445f8676d2349e0c212dbfd69c20df..be7e39a56f8b6633128bc136a9d95a0f9f90f117 100644
|
| --- a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService/gen-service-device-disconnects-invalidates-objects.html
|
| +++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/gen-characteristic-device-disconnects-invalidates-objects.html
|
| @@ -12,44 +12,45 @@ promise_test(() => {
|
| optionalServices: [request_disconnection_service_uuid]}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => {
|
| - let services;
|
| - return gattServer
|
| - .getPrimaryService('health_thermometer')
|
| - .then(s => {
|
| + let characteristics;
|
| + return gattServer.getPrimaryService('health_thermometer')
|
| + .then(service => service.getCharacteristics())
|
| + .then(c => {
|
| // Convert to array if necessary.
|
| - services = [].concat(s);
|
| + characteristics = [].concat(c);
|
| return get_request_disconnection(gattServer);
|
| })
|
| .then(requestDisconnection => requestDisconnection())
|
| .then(() => gattServer.connect())
|
| - .then(() => services);
|
| + .then(() => characteristics);
|
| })
|
| - .then(services => {
|
| + .then(characteristics => {
|
| let promises = Promise.resolve();
|
| - for (let service of services) {
|
| - if (service.uuid == request_disconnection_service_uuid) {
|
| - continue;
|
| - }
|
| + for (let characteristic of characteristics) {
|
| let error = new DOMException(
|
| - 'Service is no longer valid. Remember to retrieve the service ' +
|
| - 'again after reconnecting.',
|
| + 'Characteristic is no longer valid. Remember to retrieve the ' +
|
| + 'characteristic again after reconnecting.',
|
| 'InvalidStateError');
|
| promises = promises.then(() =>
|
| assert_promise_rejects_with_message(
|
| - service.getCharacteristic('measurement_interval'),
|
| + characteristic.readValue(),
|
| error));
|
| promises = promises.then(() =>
|
| assert_promise_rejects_with_message(
|
| - service.getCharacteristics(),
|
| + characteristic.writeValue(new Uint8Array([1])),
|
| error));
|
| promises = promises.then(() =>
|
| assert_promise_rejects_with_message(
|
| - service.getCharacteristics('measurement_interval'),
|
| + characteristic.startNotifications(),
|
| + error));
|
| + promises = promises.then(() =>
|
| + assert_promise_rejects_with_message(
|
| + characteristic.stopNotifications(),
|
| error));
|
| }
|
| return promises;
|
| });
|
| -}, 'Calls on services after device disconnects and we reconnect. ' +
|
| +}, 'Calls on characteristics after device disconnects and we reconnect. ' +
|
| 'Should reject with InvalidStateError.');
|
|
|
| </script>
|
|
|