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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html

Issue 2478013002: bluetooth: Invalidate services upon disconnection (Closed)
Patch Set: Address scheib's comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-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/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html
new file mode 100644
index 0000000000000000000000000000000000000000..542b18cefd1a23ec7ed25049809dbd52a4e4698c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/getPrimaryServices/gen-service-device-disconnects-invalidates-objects.html
@@ -0,0 +1,55 @@
+<!-- Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py -->
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
+<script>
+'use strict';
+promise_test(() => {
+ return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
+ .then(() => requestDeviceWithKeyDown({
+ filters: [{services: ['health_thermometer']}],
+ optionalServices: [request_disconnection_service_uuid]}))
+ .then(device => device.gatt.connect())
+ .then(gattServer => {
+ let services;
+ return gattServer
+ .getPrimaryServices()
+ .then(s => {
+ // Convert to array if necessary.
+ services = [].concat(s);
+ return get_request_disconnection(gattServer);
+ })
+ .then(requestDisconnection => requestDisconnection())
+ .then(() => gattServer.connect())
+ .then(() => services);
+ })
+ .then(services => {
+ let promises = Promise.resolve();
+ for (let service of services) {
+ if (service.uuid == request_disconnection_service_uuid) {
+ continue;
+ }
+ let error = new DOMException(
+ 'Service is no longer valid. Remember to retrieve the service ' +
+ 'again after reconnecting.',
+ 'InvalidStateError');
+ promises = promises.then(() =>
+ assert_promise_rejects_with_message(
+ service.getCharacteristic('measurement_interval'),
+ error));
+ promises = promises.then(() =>
+ assert_promise_rejects_with_message(
+ service.getCharacteristics(),
+ error));
+ promises = promises.then(() =>
+ assert_promise_rejects_with_message(
+ service.getCharacteristics('measurement_interval'),
+ error));
+ }
+ return promises;
+ });
+}, 'Calls on services after device disconnects and we reconnect. ' +
+ 'Should reject with InvalidStateError.');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698