Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / bluetooth / idl-BluetoothDevice.html
bloba25c0fd8b32f142d4086ec50faadb3bae9627dc9
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 test(() => {
7 assert_throws(null, () => new BluetoothDevice(),
8 'the constructor should not be callable with "new"');
9 assert_throws(null, () => BluetoothDevice(),
10 'the constructor should not be callable');
11 }, 'BluetoothDevice IDL test');
13 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
14 'window.testRunner is required for the following tests.');
16 promise_test(() => {
17 testRunner.setBluetoothMockDataSet('GlucoseHeartRateAdapter');
18 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
19 .then(function(device) {
20 assert_equals(device.constructor.name, 'BluetoothDevice');
22 // Attempt (and fail) to overwrite all members, verifying they are
23 // readonly.
24 device.instanceID = 'overwritten';
25 device.name = 'overwritten';
26 device.deviceClass = 'overwritten';
27 device.vendorIDSource = 'overwritten';
28 device.vendorID = 'overwritten';
29 device.productID = 'overwritten';
30 device.productVersion = 'overwritten';
31 device.paired = 'overwritten';
32 device.uuids = 'overwritten';
33 assert_equals(device.instanceID, '00:00:00:00:00:03');
34 assert_equals(device.name, 'Heart Rate Device');
35 assert_equals(device.deviceClass, 0x1F00);
36 assert_equals(device.vendorIDSource, 'bluetooth');
37 assert_equals(device.vendorID, 0xFFFF);
38 assert_equals(device.productID, 1);
39 assert_equals(device.productVersion, 2);
40 assert_equals(device.paired, true);
41 assert_equals(device.uuids[0], generic_access.uuid);
42 assert_equals(device.uuids[1], heart_rate.uuid);
43 });
44 }, 'BluetoothDevice attributes.');
45 </script>