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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/es6/debug-promises-update-parent-event.js
diff --git a/test/mjsunit/es6/debug-promises-update-parent-event.js b/test/mjsunit/es6/debug-promises-update-parent-event.js
new file mode 100644
index 0000000000000000000000000000000000000000..f65379621ba436cc3ac45ebd9466b1063ca40944
--- /dev/null
+++ b/test/mjsunit/es6/debug-promises-update-parent-event.js
@@ -0,0 +1,41 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-debug-as debug
+
+Debug = debug.Debug;
+
+var exception = null;
+var result = [];
+
+function listener(event, exec_state, event_data, data) {
+ if (!(event_data instanceof debug.UpdatePromiseParentEvent)) return;
+ try {
+ assertTrue(event_data.promise().isPromise());
+ assertTrue(event_data.parentPromise().isPromise());
+ result.push({ promise: event_data.promise().value(),
+ parentPromise: event_data.parentPromise().value() });
+ } catch (e) {
+ print(e + e.stack);
+ exception = e;
+ }
+}
+
+Debug.setListener(listener);
+
+var p1 = new Promise(function(resolve, reject) { resolve(1) });
+var p2 = p1.then().then();
+var p3 = p2.then();
+var p4 = p1.then();
+
+assertEquals(4, result.length);
+assertSame(p1, result[0].parentPromise);
+assertSame(p2, result[1].promise);
+assertSame(p3, result[2].promise);
+assertSame(p2, result[2].parentPromise);
+assertSame(p4, result[3].promise);
+assertSame(p1, result[3].parentPromise);
+
+assertNull(exception);
+Debug.setListener(null);
« 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