diff --git a/dom/promise/tests/test_promise_utils.html b/dom/promise/tests/test_promise_utils.html index 16fbc0d9ed1..225481244c9 100644 --- a/dom/promise/tests/test_promise_utils.html +++ b/dom/promise/tests/test_promise_utils.html @@ -202,15 +202,23 @@ function promiseRacePromiseArray() { } var arr = [ - timeoutPromise(50), - timeoutPromise(20), - timeoutPromise(30), - timeoutPromise(100) + new Promise(function(resolve) { + resolve("first"); + }), + Promise.resolve("second"), + new Promise(function() {}), + new Promise(function(resolve) { + setTimeout(function() { + setTimeout(function() { + resolve("fourth"); + }, 0); + }, 0); + }), ]; var p = Promise.race(arr); p.then(function(winner) { - is(winner, 20, "Fastest timeout should win."); + is(winner, "first", "First queued resolution should win the race."); runTest(); }); } diff --git a/dom/workers/test/promise_worker.js b/dom/workers/test/promise_worker.js index 718a0e3c755..2af938d6c67 100644 --- a/dom/workers/test/promise_worker.js +++ b/dom/workers/test/promise_worker.js @@ -565,15 +565,23 @@ function promiseRacePromiseArray() { } var arr = [ - timeoutPromise(50), - timeoutPromise(20), - timeoutPromise(30), - timeoutPromise(100) + new Promise(function(resolve) { + resolve("first"); + }), + Promise.resolve("second"), + new Promise(function() {}), + new Promise(function(resolve) { + setTimeout(function() { + setTimeout(function() { + resolve("fourth"); + }, 0); + }, 0); + }), ]; var p = Promise.race(arr); p.then(function(winner) { - is(winner, 20, "Fastest timeout should win."); + is(winner, "first", "First queued resolution should win the race."); runTest(); }); }