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 |
5 async_test(function(t) { | 6 async_test(function(t) { |
6 navigator.bluetooth.requestDevice() | 7 navigator.bluetooth.requestDevice() |
7 .then( | 8 .then( |
8 t.step_func(function() { assert_unreached( | 9 t.step_func(function() { assert_unreached('Expected no default implementat
ion.'); }), |
9 'bluetooth.requestDevice() should not succeed until implemented.'); }), | 10 t.step_func(function(e) { |
10 t.step_func(function() { t.done() })); | 11 assert_equals(e.name, 'NotSupportedError'); |
11 }, 'navigator.bluetooth.requestDevice not yet supported'); | 12 t.done(); |
| 13 })); |
| 14 }, 'NotSupportedError.'); |
| 15 |
| 16 async_test(function(t) { |
| 17 internals.resetBluetoothMock(navigator); |
| 18 internals.bluetoothRequestDeviceWillReject(navigator, 'NotFoundError'); |
| 19 navigator.bluetooth.requestDevice() |
| 20 .then( |
| 21 t.step_func(function() { assert_unreached('Mock was set to reject.'); }), |
| 22 t.step_func(function(e) { |
| 23 assert_equals(e.name, 'NotFoundError'); |
| 24 t.done(); |
| 25 })); |
| 26 }, 'Reject with NotFoundError.'); |
| 27 |
| 28 async_test(function(t) { |
| 29 internals.resetBluetoothMock(navigator); |
| 30 internals.bluetoothRequestDeviceWillReject(navigator, 'SecurityError'); |
| 31 navigator.bluetooth.requestDevice() |
| 32 .then( |
| 33 t.step_func(function() { assert_unreached('Mock was set to reject.'); }), |
| 34 t.step_func(function(e) { |
| 35 assert_equals(e.name, 'SecurityError'); |
| 36 t.done(); |
| 37 })); |
| 38 }, 'Reject with SecurityError.'); |
| 39 |
| 40 async_test(function(t) { |
| 41 internals.resetBluetoothMock(navigator); |
| 42 navigator.bluetooth.requestDevice() |
| 43 .then( |
| 44 t.step_func(function() { t.done() }), |
| 45 t.step_func(function() { assert_unreached('Mock was set to resolve.'); }))
; |
| 46 }, 'Mock will resolve.'); |
12 </script> | 47 </script> |
OLD | NEW |