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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/script-tests/server/disconnect-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 let promise; 3 let promise;
4 return setBluetoothFakeAdapter('TwoHeartRateServicesAdapter') 4 return setBluetoothFakeAdapter('TwoHeartRateServicesAdapter')
5 .then(() => requestDeviceWithKeyDown({ 5 .then(() => requestDeviceWithKeyDown({
6 filters: [{services: ['heart_rate']}]})) 6 filters: [{services: ['heart_rate']}]}))
7 .then(device => device.gatt.connect()) 7 .then(device => device.gatt.connect())
8 .then(gattServer => { 8 .then(gattServer => {
9 return gattServer 9 return gattServer
10 .CALLS([ 10 .CALLS([
11 getPrimaryService('heart_rate')| 11 getPrimaryService('heart_rate')|
12 getPrimaryServices()| 12 getPrimaryServices()|
13 getPrimaryServices('heart_rate')[UUID]]) 13 getPrimaryServices('heart_rate')[UUID]])
14 // Convert to array if necessary. 14 // Convert to array if necessary.
15 .then(s => { 15 .then(s => {
16 let services = [].concat(s); 16 let services = [].concat(s);
17 gattServer.disconnect(); 17 gattServer.disconnect();
18 return gattServer.connect() 18 return gattServer.connect()
19 .then(() => services); 19 .then(() => services);
20 }); 20 });
21 }) 21 })
22 .then(services => { 22 .then(services => {
23 let promises = Promise.resolve(); 23 let promises = Promise.resolve();
24 for (let service of services) { 24 for (let service of services) {
25 let error = new DOMException( 25 let error = new DOMException(
26 'Service is no longer valid. Remember to retrieve the service ' + 26 'Service with UUID ' + service.uuid +
27 ' is no longer valid. Remember to retrieve the service ' +
27 'again after reconnecting.', 28 'again after reconnecting.',
28 'InvalidStateError'); 29 'InvalidStateError');
29 promises = promises.then(() => 30 promises = promises.then(() =>
30 assert_promise_rejects_with_message( 31 assert_promise_rejects_with_message(
31 service.getCharacteristic('body_sensor_location'), 32 service.getCharacteristic('body_sensor_location'),
32 error)); 33 error));
33 promises = promises.then(() => 34 promises = promises.then(() =>
34 assert_promise_rejects_with_message( 35 assert_promise_rejects_with_message(
35 service.getCharacteristics(), 36 service.getCharacteristics(),
36 error)); 37 error));
37 promises = promises.then(() => 38 promises = promises.then(() =>
38 assert_promise_rejects_with_message( 39 assert_promise_rejects_with_message(
39 service.getCharacteristics('body_sensor_location'), 40 service.getCharacteristics('body_sensor_location'),
40 error)); 41 error));
41 } 42 }
42 return promises; 43 return promises;
43 }); 44 });
44 }, 'Calls on services after we disconnect and connect again. '+ 45 }, 'Calls on services after we disconnect and connect again. '+
45 'Should reject with InvalidStateError.'); 46 'Should reject with InvalidStateError.');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698