Fix some misused promise_tests.

This commit is contained in:
Ms2ger 2016-11-07 16:06:59 +01:00
parent dd34b2a335
commit a059b3e320
3 changed files with 8 additions and 15 deletions

View file

@ -4,13 +4,8 @@
<script src="/bluetooth/bluetooth-helpers.js"></script> <script src="/bluetooth/bluetooth-helpers.js"></script>
<script> <script>
'use strict'; 'use strict';
promise_test(() => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.empty); window.testRunner.setBluetoothMockDataSet(adapter_type.empty);
try { return promise_rejects(t, new TypeError(), window.navigator.bluetooth.requestDevice());
window.navigator.bluetooth.requestDevice()
.then(() => assert_unreached('requestDevice() should have thrown an error'));
} catch(error) {
assert_equals('TypeError', error.name);
}
}, 'requestDevice() requires an argument.'); }, 'requestDevice() requires an argument.');
</script> </script>

View file

@ -4,13 +4,11 @@
<script src="/bluetooth/bluetooth-helpers.js"></script> <script src="/bluetooth/bluetooth-helpers.js"></script>
<script> <script>
'use strict'; 'use strict';
promise_test(() => { promise_test(t => {
window.testRunner.setBluetoothMockDataSet(adapter_type.empty); window.testRunner.setBluetoothMockDataSet(adapter_type.empty);
try { return promise_rejects(
window.navigator.bluetooth.requestDevice([{}, {optionalServices: ['wrong_service']}]) t,
.then(() => assert_unreached('requestDevice() should have thrown an error')); new TypeError(),
} catch(error) { window.navigator.bluetooth.requestDevice([{}, {optionalServices: ['wrong_service']}]));
assert_equals('TypeError', error.name);
}
}, 'RequestDeviceOptions requires a |filters| member.'); }, 'RequestDeviceOptions requires a |filters| member.');
</script> </script>

View file

@ -36,7 +36,7 @@ promise_test(function() {
}, "Test: Service Worker Registration property scope when provided a scope"); }, "Test: Service Worker Registration property scope when provided a scope");
promise_test(function (p) { promise_test(function (p) {
promise_rejects(p, new TypeError(), register_sw('./in%5Csome%5fdir/sw.js')); return promise_rejects(p, new TypeError(), register_sw('./in%5Csome%5fdir/sw.js'));
}, "Test: Throws Error when Invalid Url Path"); }, "Test: Throws Error when Invalid Url Path");
promise_test(function (p) { promise_test(function (p) {