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

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

Issue 1611443002: bluetooth: Update BluetoothGATTCharacteristic.value on writeValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@useDataview
Patch Set: Created 4 years, 11 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_exists(window, 'testRunner'); t.done(); }, 8 test(t => { assert_exists(window, 'testRunner'); t.done(); },
9 'window.testRunner is required for the following tests.'); 9 'window.testRunner is required for the following tests.');
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); 91 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
92 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) 92 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
93 .then(device => device.connectGATT()) 93 .then(device => device.connectGATT())
94 .then(gattServer => gattServer.getPrimaryService('generic_access')) 94 .then(gattServer => gattServer.getPrimaryService('generic_access'))
95 .then(service => service.getCharacteristic('gap.device_name')) 95 .then(service => service.getCharacteristic('gap.device_name'))
96 .then(characteristic => Promise.all( 96 .then(characteristic => Promise.all(
97 [characteristic.writeValue(new Uint8Array(1 /* length */)), 97 [characteristic.writeValue(new Uint8Array(1 /* length */)),
98 characteristic.writeValue(new ArrayBuffer(1 /* length */)), 98 characteristic.writeValue(new ArrayBuffer(1 /* length */)),
99 characteristic.writeValue(new DataView(new ArrayBuffer(1 /* length */)))] )); 99 characteristic.writeValue(new DataView(new ArrayBuffer(1 /* length */)))] ));
100 }, 'A regular write request to a writable characteristic should succeed.'); 100 }, 'A regular write request to a writable characteristic should succeed.');
101
102 promise_test(() => {
103 testRunner.setBluetoothMockDataSet('HeartRateAdapter');
104 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
105 .then(device => device.connectGATT())
106 .then(gattServer => gattServer.getPrimaryService('generic_access'))
107 .then(service => service.getCharacteristic('gap.device_name'))
108 .then(characteristic => {
109 assert_equals(characteristic.value, null);
110 let textEncoder = new TextEncoder();
111 let newValue = textEncoder.encode('foo');
112 return characteristic.writeValue(newValue).then(() => {
113 assert_array_equals(characteristic.value.buffer, newValue.buffer);
114 });
115 });
116 }, 'A regular write request to a writable characteristic should update value.');
101 </script> 117 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698