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

Side by Side Diff: test/mjsunit/es6/debug-promises-update-status-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, 4 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 | « test/mjsunit/es6/debug-promises-update-parent-event.js ('k') | tools/generate-runtime-tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 promise, status, value;
11 var newPromise = 0, updatePromise = 0, counter = 0;
12
13 function listener(event, exec_state, event_data, data) {
14 if (event_data instanceof debug.NewPromiseEvent) {
15 newPromise = counter;
16 counter++;
17 return;
18 }
19 if (!(event_data instanceof debug.UpdatePromiseStatusEvent)) return;
20 try {
21 updatePromise = counter;
22 assertTrue(newPromise < updatePromise);
23 counter++;
24
25 assertTrue(event_data.promise().isPromise());
26 promise = event_data.promise().value();
27
28 status = event_data.status();
29
30 value = event_data.value().value();
31 } catch (e) {
32 print(e + e.stack);
33 exception = e;
34 }
35 }
36
37 Debug.setListener(listener);
38
39 var p1 = new Promise(function(resolve, reject) { resolve(1) });
40 assertSame(promise, p1);
41 assertEquals(status, 1);
42 assertEquals(value, 1);
43
44 var p2 = new Promise(function(resolve, reject) { reject(2) });
45 assertSame(promise, p2);
46 assertEquals(status, -1);
47 assertEquals(value, 2);
48
49 assertNull(exception);
50 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/debug-promises-update-parent-event.js ('k') | tools/generate-runtime-tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698