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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/getCharacteristic.html

Issue 1723723002: bluetooth: Implement Service.getCharacteristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Merge with ToT Created 4 years, 9 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/bluetooth-helpers.js"></script> 4 <script src="resources/bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 'use strict'; 6 'use strict';
7 7
8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, 8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
9 'window.testRunner is required for the following tests.'); 9 'window.testRunner is required for the following tests.');
10 10
(...skipping 22 matching lines...) Expand all
33 .then(service => { 33 .then(service => {
34 testRunner.setBluetoothMockDataSet('MissingServiceHeartRateAdapter'); 34 testRunner.setBluetoothMockDataSet('MissingServiceHeartRateAdapter');
35 return assert_promise_rejects_with_message( 35 return assert_promise_rejects_with_message(
36 service.getCharacteristic('gap.device_name'), 36 service.getCharacteristic('gap.device_name'),
37 new DOMException('GATT Service no longer exists.', 37 new DOMException('GATT Service no longer exists.',
38 'InvalidStateError'), 38 'InvalidStateError'),
39 'Service got removed.'); 39 'Service got removed.');
40 }); 40 });
41 }, 'Service is removed. Reject with InvalidStateError.'); 41 }, 'Service is removed. Reject with InvalidStateError.');
42 42
43
44 promise_test(() => { 43 promise_test(() => {
45 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); 44 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
46 let expected = new DOMException('Characteristic not found in device.', 45 let expected = new DOMException('No Characteristics with specified UUID found in Service.',
47 'NotFoundError'); 46 'NotFoundError');
48 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}], 47 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}],
49 optionalServices: ['generic_access']}) 48 optionalServices: ['generic_access']})
50 .then(device => device.gatt.connect()) 49 .then(device => device.gatt.connect())
51 .then(gattServer => gattServer.getPrimaryService('generic_access')) 50 .then(gattServer => gattServer.getPrimaryService('generic_access'))
52 .then(service => Promise.all( 51 .then(service => Promise.all(
53 [assert_promise_rejects_with_message( 52 [assert_promise_rejects_with_message(
54 service.getCharacteristic(battery_level.alias), expected), 53 service.getCharacteristic(battery_level.alias), expected),
55 assert_promise_rejects_with_message( 54 assert_promise_rejects_with_message(
56 service.getCharacteristic(battery_level.name), expected), 55 service.getCharacteristic(battery_level.name), expected),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 '\'00001234-0000-1000-8000-00805f9b34fb\'), ' + 118 '\'00001234-0000-1000-8000-00805f9b34fb\'), ' +
120 'or recognized standard name from ' + 119 'or recognized standard name from ' +
121 'https://developer.bluetooth.org/gatt/characteristics/' + 120 'https://developer.bluetooth.org/gatt/characteristics/' +
122 'Pages/CharacteristicsHome.aspx' + 121 'Pages/CharacteristicsHome.aspx' +
123 ' e.g. \'aerobic_heart_rate_lower_limit\'.', 122 ' e.g. \'aerobic_heart_rate_lower_limit\'.',
124 'SyntaxError'), 123 'SyntaxError'),
125 'Wrong Characteristic name passed.'); 124 'Wrong Characteristic name passed.');
126 }); 125 });
127 }, 'Wrong Characteristic name. Reject with SyntaxError.'); 126 }, 'Wrong Characteristic name. Reject with SyntaxError.');
128 </script> 127 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698