1 importScripts('../../../resources/js-test.js');
3 description('Test Promise.');
8 var promise
= new Promise(function(r
) { resolve
= r
; });
9 var promiseState
= 'pending';
10 var promiseResult
= undefined;
11 promise
.then(function(result
) {
12 promiseState
= 'fulfilled';
13 promiseResult
= result
;
15 promiseState
= 'rejected';
16 promiseResult
= result
;
19 shouldBeEqualToString('promiseState', 'pending');
23 shouldBeEqualToString('promiseState', 'pending');
25 promise
.then(function() {
26 shouldBeEqualToString('promiseState', 'fulfilled');
27 shouldBeEqualToString('promiseResult', 'hello');
30 testFailed('promise is rejected.');