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

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

Issue 258823012: Expose promise value through promise mirror. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/mirror-promises.js
diff --git a/test/mjsunit/es6/mirror-promises.js b/test/mjsunit/es6/mirror-promises.js
index c0eb5bf9bb286f4dfd55e25b4cef8db54c86f547..5a21a6b9e621487b56745829ad03fbac1b16845f 100644
--- a/test/mjsunit/es6/mirror-promises.js
+++ b/test/mjsunit/es6/mirror-promises.js
@@ -17,7 +17,7 @@ MirrorRefCache.prototype.lookup = function(handle) {
return this.refs_[handle];
}
-function testPromiseMirror(promise, status) {
+function testPromiseMirror(promise, status, value) {
// Create mirror and JSON representation.
var mirror = debug.MakeMirror(promise);
var serializer = debug.MakeMirrorSerializer();
@@ -39,6 +39,7 @@ function testPromiseMirror(promise, status) {
assertEquals("Object", mirror.className());
assertEquals("#<Promise>", mirror.toText());
assertSame(promise, mirror.value());
+ assertEquals(value, mirror.promiseValue());
// Parse JSON representation and check.
var fromJSON = eval('(' + json + ')');
@@ -47,7 +48,7 @@ function testPromiseMirror(promise, status) {
assertEquals('function', refs.lookup(fromJSON.constructorFunction.ref).type);
assertEquals('Promise', refs.lookup(fromJSON.constructorFunction.ref).name);
assertEquals(status, fromJSON.status);
-
+ assertEquals(value, fromJSON.promiseValue);
}
// Test a number of different promises.
@@ -55,6 +56,14 @@ var resolved = new Promise(function(resolve, reject) { resolve() });
var rejected = new Promise(function(resolve, reject) { reject() });
var pending = new Promise(function(resolve, reject) {});
-testPromiseMirror(resolved, "resolved");
-testPromiseMirror(rejected, "rejected");
-testPromiseMirror(pending, "pending");
+testPromiseMirror(resolved, "resolved", undefined);
+testPromiseMirror(rejected, "rejected", undefined);
+testPromiseMirror(pending, "pending", undefined);
+
+var resolvedv = new Promise(function(resolve, reject) { resolve('resolve') });
+var rejectedv = new Promise(function(resolve, reject) { reject('reject') });
+var thrownv = new Promise(function(resolve, reject) { throw 'throw' });
+
+testPromiseMirror(resolvedv, "resolved", 'resolve');
+testPromiseMirror(rejectedv, "rejected", 'reject');
+testPromiseMirror(thrownv, "rejected", 'throw');
« no previous file with comments | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698