Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / resources / Promise-simple-in-workers.js
blob0369668947c98cf4fc7c4e95cd5bffdce5d33fcd
1 importScripts('../../../resources/js-test.js');
3 description('Test Promise.');
5 var global = this;
7 global.jsTestIsAsync = true;
9 var resolve;
11 var firstPromise = new Promise(function(newResolve) {
12   global.thisInInit = this;
13   resolve = newResolve;
14 });
16 var secondPromise = firstPromise.then(function(result) {
17   global.thisInFulfillCallback = this;
18   shouldBeFalse('thisInFulfillCallback === secondPromise');
19   shouldBeTrue('thisInFulfillCallback === global');
20   global.result = result;
21   shouldBeEqualToString('result', 'hello');
22   finishJSTest();
23 });
25 shouldBeFalse('thisInInit === firstPromise');
26 shouldBeTrue('thisInInit === global');
28 resolve('hello');