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

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

Issue 1884133005: bluetooth: Separate readValue tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-read-value
Patch Set: Fix typo Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/readValue.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/bluetooth/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 return setBluetoothFakeAdapter('HeartRateAdapter')
12 .then(() => requestDeviceWithKeyDown({
13 filters: [{services: ['heart_rate']}]}))
14 .then(device => device.gatt.connect())
15 .then(gattServer => gattServer.getPrimaryService('heart_rate'))
16 .then(service => service.getCharacteristic('body_sensor_location'))
17 .then(characteristic => {
18 return assert_event_fires_after_promise(characteristic,
19 'readValue',
20 'characteristicvaluechanged');
21 }).then(results => {
22 let read_value = results[0].buffer;
23 let event_value = results[1].buffer;
24 // TODO(ortuno): The DataView used to resolve the promise
25 // should be the same DataView as 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 fire an event.');
32
33 promise_test(() => {
34 return setBluetoothFakeAdapter('HeartRateAdapter')
35 .then(() => requestDeviceWithKeyDown({
36 filters: [{services: ['heart_rate']}]}))
37 .then(device => device.gatt.connect())
38 .then(gattServer => gattServer.getPrimaryService('heart_rate'))
39 .then(service => service.getCharacteristic('body_sensor_location'))
40 .then(characteristic => {
41 return assert_event_fires_after_promise(characteristic,
42 'readValue',
43 'characteristicvaluechanged',
44 3 /* attach 3 listeners */);
45 }).then(results => {
46 let read_value = results[0].buffer;
47 let event_values = results.slice(1).map(v => v.buffer);
48 for (let event_value of event_values) {
49 // TODO(ortuno): The DataView used to resolve the promise
50 // should be the same DataView as the one saved in the
51 // characteristic.
52 // http://crbug.com/543347
53 // assert_equals(event.target.value, value);
54 assert_array_equals(event_value, read_value);
55 }
56 });
57 }, 'Add multiple event listeners then readValue().');
58 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/readValue.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698