mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Add integration tests for interacting with promises from native code.
This commit is contained in:
parent
ab168204ed
commit
f89355b85d
5 changed files with 98 additions and 5 deletions
|
@ -7176,6 +7176,12 @@
|
|||
"url": "/_mozilla/mozilla/preserve_wrapper_callback.html"
|
||||
}
|
||||
],
|
||||
"mozilla/promise.html": [
|
||||
{
|
||||
"path": "mozilla/promise.html",
|
||||
"url": "/_mozilla/mozilla/promise.html"
|
||||
}
|
||||
],
|
||||
"mozilla/prototypes.html": [
|
||||
{
|
||||
"path": "mozilla/prototypes.html",
|
||||
|
|
3
tests/wpt/mozilla/meta/mozilla/promise.html.ini
Normal file
3
tests/wpt/mozilla/meta/mozilla/promise.html.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[promise.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
40
tests/wpt/mozilla/tests/mozilla/promise.html
Normal file
40
tests/wpt/mozilla/tests/mozilla/promise.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title></title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
promise_test(function() {
|
||||
var t = new TestBinding;
|
||||
return t.returnResolvedPromise('success')
|
||||
.then(function(s) {
|
||||
assert_equals(s, 'success');
|
||||
});
|
||||
}, 'Resolve callback gets argument');
|
||||
|
||||
promise_test(function(test) {
|
||||
var t = new TestBinding;
|
||||
return t.returnRejectedPromise('success')
|
||||
.then(test.unreached_func())
|
||||
.catch(function(s) {
|
||||
assert_equals(s, 'success');
|
||||
});
|
||||
}, 'Reject callback gets argument');
|
||||
|
||||
promise_test(function(test) {
|
||||
var t = new TestBinding;
|
||||
var p = t.promiseNativeHandler(function(v) {
|
||||
assert_equals(v, 'success');
|
||||
}, null);
|
||||
return Promise.resolve('success').then(p);
|
||||
}, 'Native resolve callback gets argument');
|
||||
|
||||
promise_test(function(test) {
|
||||
var t = new TestBinding;
|
||||
var p = t.promiseNativeHandler(null, function(v) {
|
||||
assert_equals(v, 'success');
|
||||
});
|
||||
p.then(test.unreached_func());
|
||||
return Promise.resolve('success').then(p);
|
||||
}, 'Native resolve callback gets argument');
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue