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

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: Address comments 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..9d1113a027d8480d8e556a8317c5b524496610b1
--- /dev/null
+++ b/test/mjsunit/es6/debug-promises-update-parent-event.js
@@ -0,0 +1,35 @@
+// 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 promise, parentPromise;
+
+function listener(event, exec_state, event_data, data) {
+ if (!(event_data instanceof debug.UpdatePromiseParentEvent)) return;
+ try {
+ assertTrue(event_data.promise().isPromise());
+ promise = event_data.promise().value();
+
+ assertTrue(event_data.parentPromise().isPromise());
+ 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();
+assertSame(parentPromise, p2);
aandrey 2014/07/22 11:58:49 how many UpdatePromiseParentEvent happened by this
Alexandra Mikhaylova 2014/07/22 12:47:22 There should be 3 UpdatePromiseParentEvent's (adde
+assertSame(promise, p3);
+
+assertNull(exception);
+Debug.setListener(null);

Powered by Google App Engine
This is Rietveld 408576698