| Index: third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html
|
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html
|
| similarity index 61%
|
| copy from third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html
|
| copy to third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/gen-characteristic-device-disconnects-invalidates-objects.html
|
| index 542b18cefd1a23ec7ed25049809dbd52a4e4698c..16c8306991bd77a39771a4ca1cb97973f1a393fb 100644
|
| --- a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html
|
| +++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic/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
|
| - .getPrimaryServices()
|
| - .then(s => {
|
| + let characteristics;
|
| + return gattServer.getPrimaryService('health_thermometer')
|
| + .then(service => service.getCharacteristic('measurement_interval'))
|
| + .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>
|
|
|