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

Side by Side Diff: test/mjsunit/es6/debug-promises-new-event.js

Issue 393283007: Introduce more debug events for promises. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Check result length in the test as well Created 6 years, 5 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
« no previous file with comments | « src/promise.js ('k') | test/mjsunit/es6/debug-promises-update-parent-event.js » ('j') | 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 5 // Flags: --expose-debug-as debug
6 6
7 Debug = debug.Debug; 7 Debug = debug.Debug;
8 8
9 var exception = null; 9 var exception = null;
10 var new_promise; 10 var new_promise;
11 11
12 function listener(event, exec_state, event_data, data) { 12 function listener(event, exec_state, event_data, data) {
13 if (event != Debug.DebugEvent.PromiseEvent) return; 13 if (!(event_data instanceof debug.NewPromiseEvent)) return;
14 try { 14 try {
15 assertTrue(event_data.resolver().isFunction()); 15 assertTrue(event_data.resolver().isFunction());
16 assertEquals(resolver, event_data.resolver().value()); 16 assertEquals(resolver, event_data.resolver().value());
17 assertTrue(event_data.resolver().resolved()); 17 assertTrue(event_data.resolver().resolved());
18 assertEquals("resolver", event_data.resolver().name()); 18 assertEquals("resolver", event_data.resolver().name());
19 assertTrue(event_data.resolver().source().indexOf("Token") > 0); 19 assertTrue(event_data.resolver().source().indexOf("Token") > 0);
20 20
21 assertTrue(event_data.promise().isPromise()); 21 assertTrue(event_data.promise().isPromise());
22 new_promise = event_data.promise().value(); 22 new_promise = event_data.promise().value();
23 assertEquals("pending", event_data.promise().status()); 23 assertEquals("pending", event_data.promise().status());
24 } catch (e) { 24 } catch (e) {
25 print(e + e.stack) 25 print(e + e.stack)
26 exception = e; 26 exception = e;
27 } 27 }
28 } 28 }
29 29
30 Debug.setListener(listener); 30 Debug.setListener(listener);
31 31
32 function resolver(resolve, reject) { 32 function resolver(resolve, reject) {
33 resolve(); // Token 33 resolve(); // Token
34 } 34 }
35 35
36 var p = new Promise(resolver); 36 var p = new Promise(resolver);
37 assertEquals(new_promise, p); 37 assertEquals(new_promise, p);
38 38
39 assertNull(exception); 39 assertNull(exception);
40 Debug.setListener(null); 40 Debug.setListener(null);
OLDNEW
« no previous file with comments | « src/promise.js ('k') | test/mjsunit/es6/debug-promises-update-parent-event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698