OLD | NEW |
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> | 4 <script> |
5 test(function() { | 5 test(function() { |
6 assert_throws(null, function() { new BluetoothDevice(); }, | 6 assert_throws(null, function() { new BluetoothDevice(); }, |
7 'the constructor should not be callable with "new"'); | 7 'the constructor should not be callable with "new"'); |
8 assert_throws(null, function() { BluetoothDevice(); }, | 8 assert_throws(null, function() { BluetoothDevice(); }, |
9 'the constructor should not be callable'); | 9 'the constructor should not be callable'); |
10 }, 'BluetoothDevice IDL test'); | 10 }, 'BluetoothDevice IDL test'); |
11 | 11 |
12 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, | 12 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, |
13 "window.testRunner is required for the following tests."); | 13 "window.testRunner is required for the following tests."); |
14 | 14 |
15 async_test(function(t) { | 15 async_test(function(t) { |
16 testRunner.setBluetoothMockDataSet('Single Empty Device'); | 16 testRunner.setBluetoothMockDataSet('Single Empty Device'); |
17 navigator.bluetooth.requestDevice() | 17 navigator.bluetooth.requestDevice() |
18 .then( | 18 .then( |
19 t.step_func(function(device) { | 19 t.step_func(function(device) { |
20 assert_equals(device.constructor.name, "BluetoothDevice"); | 20 assert_equals(device.constructor.name, "BluetoothDevice"); |
21 // Attempt (and fail) to clear all members, verifying they are readonly. | 21 |
22 device.instanceId = "" | 22 // Attempt (and fail) to overwrite all members, verifying they are reado
nly. |
23 assert_equals(device.instanceId, "Empty Mock deviceId"); | 23 device.instanceID = "overwritten"; |
| 24 |
| 25 // FIXME: Remove "Empty Mock deviceId" after crrev.com/885723002 lands. |
| 26 assert_true(device.instanceID === "Empty Mock deviceId" || |
| 27 device.instanceID === "Empty Mock Device instanceID"); |
| 28 |
24 t.done(); | 29 t.done(); |
25 }), | 30 }), |
26 t.step_func(function() { assert_unreached('Mock was set to resolve.'); }))
; | 31 t.step_func(function() { assert_unreached('Mock was set to resolve.'); }))
; |
27 }, 'BluetoothDevice attributes.'); | 32 }, 'BluetoothDevice attributes.'); |
28 </script> | 33 </script> |
OLD | NEW |