| Index: LayoutTests/fast/js/Promise-fulfill.html
|
| diff --git a/LayoutTests/fast/js/Promise-fulfill.html b/LayoutTests/fast/js/Promise-fulfill.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9f5fc237f154805c83ee6c692c7b82123351bde0
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/js/Promise-fulfill.html
|
| @@ -0,0 +1,60 @@
|
| +<!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 resolverSync;
|
| +var promiseSync = new Promise(function(r) { resolverSync = r; });
|
| +var promiseSyncState = 'pending';
|
| +var promiseSyncResult = undefined;
|
| +promiseSync.then(function(result) {
|
| + promiseSyncState = 'fulfilled';
|
| + promiseSyncResult = result;
|
| +}, function(result) {
|
| + promiseSyncState = 'rejected';
|
| + promiseSyncResult = result;
|
| +});
|
| +
|
| +var resolverAsync;
|
| +var promiseAsync = new Promise(function(r) { resolverAsync = r; });
|
| +var promiseAsyncState = 'pending';
|
| +var promiseAsyncResult = undefined;
|
| +promiseAsync.then(function(result) {
|
| + promiseAsyncState = 'fulfilled';
|
| + promiseAsyncResult = result;
|
| +}, function(result) {
|
| + promiseAsyncState = 'rejected';
|
| + promiseAsyncResult = result;
|
| +});
|
| +
|
| +shouldBeEqualToString('promiseSyncState', 'pending');
|
| +shouldBeEqualToString('promiseAsyncState', 'pending');
|
| +
|
| +resolverSync.fulfill('hello', true);
|
| +resolverAsync.fulfill('hello');
|
| +
|
| +shouldBeEqualToString('promiseSyncState', 'fulfilled');
|
| +shouldBeEqualToString('promiseSyncResult', 'hello');
|
| +shouldBeEqualToString('promiseAsyncState', 'pending');
|
| +
|
| +promiseAsync.then(function() {
|
| + shouldBeEqualToString('promiseAsyncState', 'fulfilled');
|
| + shouldBeEqualToString('promiseAsyncResult', 'hello');
|
| + finishJSTest();
|
| +}, function() {
|
| + debug('FAIL promiseAsync is rejected.');
|
| + finishJSTest();
|
| +});
|
| +
|
| +</script>
|
| +<script src="resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|