summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/Promise-already-resolved.html
blob: e139b10f534bccd4d1089b631d306a792bce9356 (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
31
32
<!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;

new Promise(function(resolve, reject) {
  var anotherResolve;
  resolve(new Promise(function(r) { anotherResolve = r; }));
  resolve('resolve');
  reject('reject');

  anotherResolve('foo');
}).then(function(result) {
  window.result = result;
  shouldBeEqualToString('result', 'foo');
  finishJSTest();
}, function() {
  testFailed('rejected');
  finishJSTest();
});

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