blob: 243e6022fb0c0584769d402d80a98e0bdc380f05 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise.');
window.jsTestIsAsync = true;
var value = {
then: function(fulfillCallback, rejectCallback) {
testPassed('value.then is called.');
window.thisValue = this;
shouldBe('thisValue', 'value');
rejectCallback('hello');
}
};
var promise = new Promise(function(resolve) { resolve(value); });
promise.then(function(result) {
testFailed('fulfilled');
finishJSTest();
}, function(result) {
testPassed('rejected');
window.result = result;
shouldBeEqualToString('result', 'hello');
finishJSTest();
});
debug('The promise is not rejected now.');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>