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

Side by Side Diff: third_party/WebKit/LayoutTests/bluetooth/requestDevice/unnamed-device.html

Issue 2014473002: bluetooth: Web Bluetooth can filter by empty device names, doesn't leak MACs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-GetNameOrEmpty-
Patch Set: Merge Created 4 years, 5 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/bluetooth-helpers.js"></script>
5 <script>
6 'use strict';
7 promise_test(() => {
8 return setBluetoothFakeAdapter('UnnamedHeartRateAdapter')
9 .then(() => requestDeviceWithKeyDown({
10 filters: [{services: ['heart_rate']}],
11 optionalServices: ['generic_access']}))
12 .then(device => {
13 assert_equals(device.name, '');
14 return device.gatt.connect();
15 })
16 .then(gattServer => gattServer.getPrimaryService('generic_access'))
17 .then(service => service.getCharacteristic('gap.device_name'))
18 .then(characteristic => characteristic.readValue())
19 .then(value => {
20 let decoder = new TextDecoder('utf-8');
21 let value_str = decoder.decode(value);
22 assert_equals(value_str, '');
23 });
24 }, 'An unnamed device can be obtained by advertised service UUID.');
25
26 promise_test(() => {
27 return setBluetoothFakeAdapter('UnnamedHeartRateAdapter')
28 .then(() => requestDeviceWithKeyDown({
29 filters: [{name: ['']}],
30 optionalServices: ['generic_access']}))
31 .then(device => {
32 assert_equals(device.name, '');
33 return device.gatt.connect();
34 })
35 .then(gattServer => gattServer.getPrimaryService('generic_access'))
36 .then(service => service.getCharacteristic('gap.device_name'))
37 .then(characteristic => characteristic.readValue())
38 .then(value => {
39 let decoder = new TextDecoder('utf-8');
40 let value_str = decoder.decode(value);
41 assert_equals(value_str, '');
42 });
43 }, 'An unnamed device can be obtained by empty name.');
ortuno 2016/07/21 17:42:29 Hmm well the spec says that if the device is not p
scheib 2016/07/30 02:38:14 Renamed adapter to be 'EmptyNameHeartRateAdapter',
44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698