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

Side by Side Diff: test/mjsunit/es6/debug-promises-update-parent-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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --expose-debug-as debug
6
7 Debug = debug.Debug;
8
9 var exception = null;
10 var result = [];
11
12 function listener(event, exec_state, event_data, data) {
13 if (!(event_data instanceof debug.UpdatePromiseParentEvent)) return;
14 try {
15 assertTrue(event_data.promise().isPromise());
16 assertTrue(event_data.parentPromise().isPromise());
17 result.push({ promise: event_data.promise().value(),
18 parentPromise: event_data.parentPromise().value() });
19 } catch (e) {
20 print(e + e.stack);
21 exception = e;
22 }
23 }
24
25 Debug.setListener(listener);
26
27 var p1 = new Promise(function(resolve, reject) { resolve(1) });
28 var p2 = p1.then().then();
29 var p3 = p2.then();
30 var p4 = p1.then();
31
32 assertEquals(4, result.length);
33 assertSame(p1, result[0].parentPromise);
34 assertSame(p2, result[1].promise);
35 assertSame(p3, result[2].promise);
36 assertSame(p2, result[2].parentPromise);
37 assertSame(p4, result[3].promise);
38 assertSame(p1, result[3].parentPromise);
39
40 assertNull(exception);
41 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/debug-promises-new-event.js ('k') | test/mjsunit/es6/debug-promises-update-status-event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698