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

Side by Side Diff: test/mjsunit/es6/mirror-promises.js

Issue 273653007: Read internal properties [[PromiseStatus]] and [[PromiseValue]] of the promise. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix the test Created 6 years, 7 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 | Annotate | Revision Log
« src/mirror-debugger.js ('K') | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-debug-as debug --harmony-promises 5 // Flags: --expose-debug-as debug --harmony-promises
6 // Test the mirror object for promises. 6 // Test the mirror object for promises.
7 7
8 function MirrorRefCache(json_refs) { 8 function MirrorRefCache(json_refs) {
9 var tmp = eval('(' + json_refs + ')'); 9 var tmp = eval('(' + json_refs + ')');
10 this.refs_ = []; 10 this.refs_ = [];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 testPromiseMirror(rejected, "rejected", undefined); 60 testPromiseMirror(rejected, "rejected", undefined);
61 testPromiseMirror(pending, "pending", undefined); 61 testPromiseMirror(pending, "pending", undefined);
62 62
63 var resolvedv = new Promise(function(resolve, reject) { resolve('resolve') }); 63 var resolvedv = new Promise(function(resolve, reject) { resolve('resolve') });
64 var rejectedv = new Promise(function(resolve, reject) { reject('reject') }); 64 var rejectedv = new Promise(function(resolve, reject) { reject('reject') });
65 var thrownv = new Promise(function(resolve, reject) { throw 'throw' }); 65 var thrownv = new Promise(function(resolve, reject) { throw 'throw' });
66 66
67 testPromiseMirror(resolvedv, "resolved", 'resolve'); 67 testPromiseMirror(resolvedv, "resolved", 'resolve');
68 testPromiseMirror(rejectedv, "rejected", 'reject'); 68 testPromiseMirror(rejectedv, "rejected", 'reject');
69 testPromiseMirror(thrownv, "rejected", 'throw'); 69 testPromiseMirror(thrownv, "rejected", 'throw');
70
71 // Test internal properties of different promises.
72 var m1 = debug.MakeMirror(new Promise(
73 function(resolve, reject) { resolve(1) }));
74 var ip = m1.internalProperties();
75 assertEquals(2, ip.length);
76 assertEquals("[[PromiseStatus]]", ip[0].name());
77 assertEquals("[[PromiseValue]]", ip[1].name());
78 assertEquals("resolved", ip[0].value().value());
79 assertEquals(1, ip[1].value().value());
80
81 var m2 = debug.MakeMirror(new Promise(function(resolve, reject) { reject(2) }));
82 ip = m2.internalProperties();
83 assertEquals("rejected", ip[0].value().value());
84 assertEquals(2, ip[1].value().value());
85
86 var m3 = debug.MakeMirror(new Promise(function(resolve, reject) { }));
87 ip = m3.internalProperties();
88 assertEquals("pending", ip[0].value().value());
89 assertEquals("undefined", typeof(ip[1].value().value()));
OLDNEW
« src/mirror-debugger.js ('K') | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698