summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js')
-rw-r--r--testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js b/testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js
new file mode 100644
index 0000000000..aaf0f14436
--- /dev/null
+++ b/testing/web-platform/tests/bluetooth/script-tests/service/service-is-removed.js
@@ -0,0 +1,20 @@
+'use strict';
+const test_desc = 'Service is removed before FUNCTION_NAME call. ' +
+ 'Reject with InvalidStateError.';
+const expected = new DOMException('GATT Service no longer exists.',
+ 'InvalidStateError');
+let service, fake_service, fake_peripheral;
+
+bluetooth_test(() => getHealthThermometerService()
+ .then(_ => ({service, fake_service, fake_peripheral} = _))
+ .then(() => fake_service.remove())
+ .then(() => fake_peripheral.simulateGATTServicesChanged())
+ .then(() => assert_promise_rejects_with_message(
+ service.CALLS([
+ getCharacteristic('measurement_interval')|
+ getCharacteristics()|
+ getCharacteristics('measurement_interval')[UUID]
+ ]),
+ expected,
+ 'Service got removed.')),
+ test_desc);