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

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

Issue 1382743002: bluetooth: Add characteristicvaluechanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-notifications-1
Patch Set: Final clean up Created 5 years, 2 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/bluetooth-helpers.js"></script>
5 <script>
6 'use strict';
7 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
8 'window.testRunner is required for the following tests.');
9
10 promise_test(() => {
11 let char;
12 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
13 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
14 .then(device => device.connectGATT())
15 .then(gattServer => gattServer.getPrimaryService('heart_rate'))
16 .then(service => service.getCharacteristic('body_sensor_location'))
17 .then(characteristic => {
18 return event_after_promise(characteristic,
19 'readValue',
20 'characteristicvaluechanged');
Jeffrey Yasskin 2015/10/15 23:00:51 Add another test that registers 2 'characteristicv
ortuno 2015/10/16 01:24:21 Done. It adds 3!
21 }).then(results => {
22 let event_value = new Uint8Array(results[0]);
23 let read_value = new Uint8Array(results[1]);
24 // TODO(ortuno): The Arraybuffer used to resolve the promise
Jeffrey Yasskin 2015/10/15 23:00:51 s/Arraybuffer/ArrayBuffer/
ortuno 2015/10/16 01:24:21 Done.
25 // should be the same ArrayBuffer than the one saved in the
26 // characteristic.
27 // http://crbug.com/543347
28 // assert_equals(event.target.value, value);
29 assert_array_equals(event_value, read_value);
30 });
31 }, 'Reading a characteristic should dispatch an event as well.');
32
33 promise_test(() => {
34 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
35 let char;
36 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
37 .then(device => device.connectGATT())
38 .then(gattServer => gattServer.getPrimaryService('heart_rate'))
39 .then(service => service.getCharacteristic('heart_rate_measurement'))
40 .then(characteristic => {
41 char = characteristic;
42 return event_after_promise(characteristic,
43 'startNotifications',
44 'characteristicvaluechanged');
45 }).then(() => char.stopNotifications())
46 .then(() => assert_no_events(char, 'characteristicvaluechanged'));
47 }, 'Starting a notification should dispatch an event.');
48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698