| Index: third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-disconnect-invalidates-objects.html
|
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-disconnect-invalidates-objects.html
|
| similarity index 56%
|
| copy from third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects-with-uuid.html
|
| copy to third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-disconnect-invalidates-objects.html
|
| index 05aa4538f2c375306a8cd141b8af788d831c7ff2..3b7bbb9f97e67db5967ba040677a88a7d0e4599d 100644
|
| --- a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects-with-uuid.html
|
| +++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-disconnect-invalidates-objects.html
|
| @@ -12,44 +12,43 @@ promise_test(() => {
|
| optionalServices: [request_disconnection_service_uuid]}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => {
|
| - let services;
|
| - return gattServer
|
| - .getPrimaryServices('health_thermometer')
|
| - .then(s => {
|
| + return gattServer.getPrimaryService('health_thermometer')
|
| + .then(service => service.getCharacteristic('measurement_interval'))
|
| + .then(c => {
|
| // Convert to array if necessary.
|
| - services = [].concat(s);
|
| - return get_request_disconnection(gattServer);
|
| - })
|
| - .then(requestDisconnection => requestDisconnection())
|
| - .then(() => gattServer.connect())
|
| - .then(() => services);
|
| + let characteristics = [].concat(c);
|
| + gattServer.disconnect();
|
| + return gattServer.connect()
|
| + .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 we disconnects and connect again. ' +
|
| 'Should reject with InvalidStateError.');
|
|
|
| </script>
|
|
|