Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: LayoutTests/fast/js/resources/Promise-simple-in-workers.js

Issue 23567043: Promise init callback takes resolve and reject functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 importScripts('./js-test-pre.js'); 1 importScripts('./js-test-pre.js');
2 2
3 description('Test Promise.'); 3 description('Test Promise.');
4 4
5 var global = this; 5 var global = this;
6 6
7 global.jsTestIsAsync = true; 7 global.jsTestIsAsync = true;
8 8
9 var resolver; 9 var resolve;
10 10
11 var firstPromise = new Promise(function(newResolver) { 11 var firstPromise = new Promise(function(newResolve) {
12 global.thisInInit = this; 12 global.thisInInit = this;
13 resolver = newResolver; 13 resolve = newResolve;
14 }); 14 });
15 15
16 var secondPromise = firstPromise.then(function(result) { 16 var secondPromise = firstPromise.then(function(result) {
17 global.thisInFulfillCallback = this; 17 global.thisInFulfillCallback = this;
18 shouldBeTrue('thisInFulfillCallback === secondPromise'); 18 shouldBeTrue('thisInFulfillCallback === secondPromise');
19 global.result = result; 19 global.result = result;
20 shouldBeEqualToString('result', 'hello'); 20 shouldBeEqualToString('result', 'hello');
21 finishJSTest(); 21 finishJSTest();
22 }); 22 });
23 23
24 shouldBeTrue('thisInInit === firstPromise'); 24 shouldBeTrue('thisInInit === firstPromise');
25 25
26 resolver.fulfill('hello'); 26 resolve('hello');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698