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

Unified Diff: test/mjsunit/es6/promises.js

Issue 1488783002: Clean up promises and fix an edge case bug (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor code cleanup; disable some soon-to-be-obsolete mjsunit tests Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/promise.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/promises.js
diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js
index d02f7b7ef3e869e3ffede7bba2a9f3308044a601..10e47c43d5c320cf44322344f5c5ed29407513a1 100644
--- a/test/mjsunit/es6/promises.js
+++ b/test/mjsunit/es6/promises.js
@@ -193,8 +193,9 @@ function assertAsyncDone(iteration) {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
+ // Note: Chain now has then-style semantics, here and in future tests.
p3.chain(
- function(x) { assertAsync(x === p2, "resolved/chain") },
+ function(x) { assertAsync(x === 5, "resolved/chain") },
assertUnreachable
)
assertAsyncRan()
@@ -216,8 +217,8 @@ function assertAsyncDone(iteration) {
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "rejected/chain") },
- assertUnreachable
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "rejected/chain") }
)
assertAsyncRan()
})();
@@ -233,17 +234,16 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
-/* TODO(caitp): remove tests once PromiseChain is removed, per bug 3237
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(function(x) { return x }, assertUnreachable).chain(
- function(x) { assertAsync(x === p1, "resolved/chain/chain") },
+ function(x) { assertAsync(x === 5, "resolved/chain/chain") },
assertUnreachable
)
assertAsyncRan()
-})();*/
+})();
(function() {
var p1 = Promise.accept(5)
@@ -371,7 +371,7 @@ function assertAsyncDone(iteration) {
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "resolved/thenable/chain") },
+ function(x) { assertAsync(x === 5, "resolved/thenable/chain") },
assertUnreachable
)
assertAsyncRan()
@@ -393,8 +393,8 @@ function assertAsyncDone(iteration) {
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "rejected/thenable/chain") },
- assertUnreachable
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "rejected/thenable/chain") }
)
assertAsyncRan()
})();
@@ -416,7 +416,7 @@ function assertAsyncDone(iteration) {
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "chain/resolve") },
+ function(x) { assertAsync(x === 5, "chain/resolve") },
assertUnreachable
)
deferred.resolve(5)
@@ -426,8 +426,8 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.accept(p1)
- var p3 = Promise.accept(p2)
+ var p2 = Promise.resolve(p1)
+ var p3 = Promise.resolve(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve") },
assertUnreachable
@@ -442,8 +442,8 @@ function assertAsyncDone(iteration) {
var p2 = Promise.accept(p1)
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "chain/reject") },
- assertUnreachable
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "chain/reject") }
)
deferred.reject(5)
assertAsyncRan()
@@ -492,7 +492,7 @@ function assertAsyncDone(iteration) {
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "chain/resolve/thenable") },
+ function(x) { assertAsync(x === 5, "chain/resolve/thenable") },
assertUnreachable
)
deferred.resolve(5)
@@ -518,8 +518,8 @@ function assertAsyncDone(iteration) {
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var p3 = Promise.accept(p2)
p3.chain(
- function(x) { assertAsync(x === p2, "chain/reject/thenable") },
- assertUnreachable
+ assertUnreachable,
+ function(x) { assertAsync(x === 5, "chain/reject/thenable") }
)
deferred.reject(5)
assertAsyncRan()
@@ -538,19 +538,18 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
-/* TODO(caitp): remove tests once PromiseChain is removed, per bug v8:3237
(function() {
var p1 = Promise.accept(5)
var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p3 = deferred.promise
p3.chain(
- function(x) { assertAsync(x === p2, "chain/resolve2") },
+ function(x) { assertAsync(x === 5, "chain/resolve2") },
assertUnreachable
)
deferred.resolve(p2)
assertAsyncRan()
-})(); */
+})();
(function() {
var p1 = Promise.accept(5)
@@ -591,19 +590,18 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
-/* TODO(caitp): remove tests once PromiseChain is removed, per bug v8:3237
(function() {
var p1 = Promise.accept(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var deferred = Promise.defer()
var p3 = deferred.promise
p3.chain(
- function(x) { assertAsync(x === p2, "chain/resolve/thenable2") },
+ function(x) { assertAsync(x === 5, "chain/resolve/thenable2") },
assertUnreachable
)
deferred.resolve(p2)
assertAsyncRan()
-})(); */
+})();
(function() {
var p1 = Promise.accept(5)
@@ -638,19 +636,17 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
-/* TODO(caitp): remove tests once PromiseChain is removed, per bug v8:3237
(function() {
var deferred = Promise.defer()
var p = deferred.promise
deferred.resolve(p)
p.chain(
- function(x) { assertAsync(x === p, "cyclic/deferred/chain") },
- assertUnreachable
+ assertUnreachable,
+ function(r) { assertAsync(r instanceof TypeError, "cyclic/deferred/then") }
)
assertAsyncRan()
-})();*/
+})();
-/* TODO(caitp): remove tests once PromiseChain is removed, per bug v8:3237
(function() {
var deferred = Promise.defer()
var p = deferred.promise
@@ -660,7 +656,7 @@ function assertAsyncDone(iteration) {
function(r) { assertAsync(r instanceof TypeError, "cyclic/deferred/then") }
)
assertAsyncRan()
-})();*/
+})();
(function() {
Promise.all([]).chain(
@@ -763,7 +759,6 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
-
(function() {
'use strict';
var getCalls = 0;
« no previous file with comments | « src/js/promise.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698