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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/script-tests/server/device-disconnects-invalidates-objects.js

Issue 2680783002: bluetooth: show better error messages for services, characteristics and descriptors (Closed)
Patch Set: Added UUID to DESCRIPTOR_NOT_FOUND, INVALID_DESCRIPTOR and INVALID_CHARACTERISTIC. Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
1 'use strict'; 1 'use strict';
2 promise_test(() => { 2 promise_test(() => {
3 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') 3 return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
4 .then(() => requestDeviceWithKeyDown({ 4 .then(() => requestDeviceWithKeyDown({
5 filters: [{services: ['health_thermometer']}], 5 filters: [{services: ['health_thermometer']}],
6 optionalServices: [request_disconnection_service_uuid]})) 6 optionalServices: [request_disconnection_service_uuid]}))
7 .then(device => device.gatt.connect()) 7 .then(device => device.gatt.connect())
8 .then(gattServer => { 8 .then(gattServer => {
9 let services; 9 let services;
10 return gattServer 10 return gattServer
(...skipping 10 matching lines...) Expand all
21 .then(() => gattServer.connect()) 21 .then(() => gattServer.connect())
22 .then(() => services); 22 .then(() => services);
23 }) 23 })
24 .then(services => { 24 .then(services => {
25 let promises = Promise.resolve(); 25 let promises = Promise.resolve();
26 for (let service of services) { 26 for (let service of services) {
27 if (service.uuid == request_disconnection_service_uuid) { 27 if (service.uuid == request_disconnection_service_uuid) {
28 continue; 28 continue;
29 } 29 }
30 let error = new DOMException( 30 let error = new DOMException(
31 'Service is no longer valid. Remember to retrieve the service ' + 31 'Service with UUID ' + service.uuid +
32 ' is no longer valid. Remember to retrieve the service ' +
32 'again after reconnecting.', 33 'again after reconnecting.',
33 'InvalidStateError'); 34 'InvalidStateError');
34 promises = promises.then(() => 35 promises = promises.then(() =>
35 assert_promise_rejects_with_message( 36 assert_promise_rejects_with_message(
36 service.getCharacteristic('measurement_interval'), 37 service.getCharacteristic('measurement_interval'),
37 error)); 38 error));
38 promises = promises.then(() => 39 promises = promises.then(() =>
39 assert_promise_rejects_with_message( 40 assert_promise_rejects_with_message(
40 service.getCharacteristics(), 41 service.getCharacteristics(),
41 error)); 42 error));
42 promises = promises.then(() => 43 promises = promises.then(() =>
43 assert_promise_rejects_with_message( 44 assert_promise_rejects_with_message(
44 service.getCharacteristics('measurement_interval'), 45 service.getCharacteristics('measurement_interval'),
45 error)); 46 error));
46 } 47 }
47 return promises; 48 return promises;
48 }); 49 });
49 }, 'Calls on services after device disconnects and we reconnect. ' + 50 }, 'Calls on services after device disconnects and we reconnect. ' +
50 'Should reject with InvalidStateError.'); 51 'Should reject with InvalidStateError.');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698