Auto merge of #14113 - servo:promise_test, r=jdm

Fix some misused promise_tests.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14113)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-07 14:55:06 -06:00 committed by GitHub
commit f1c3e97fb4
3 changed files with 8 additions and 15 deletions

View file

@ -4,13 +4,8 @@
<script src="/_mozilla/mozilla/bluetooth/bluetooth-helpers.js"></script> <script src="/_mozilla/mozilla/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="/_mozilla/mozilla/bluetooth/bluetooth-helpers.js"></script> <script src="/_mozilla/mozilla/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) {