summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/Promise-native-resolve.html
blob: 8697898c75361ac57266ca60dccb15cbad1bf873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise resolve inside Blink.');

window.jsTestIsAsync = true;

var result;
var resolve;
var promise = new Promise(function(res) { resolve = res; });
var blinkPromise = internals.createResolvedPromise(promise);

promise.then(function(value) {
    return blinkPromise;
}).then(function(value) {
    result = value;
    shouldBe('result', '42');
}).then(finishJSTest, finishJSTest);

resolve(42);

</script>
</body>
</html>