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..8d972c547dee6d924b7a0df66e42e3dbaafe9b28 |
--- /dev/null |
+++ b/test/mjsunit/es6/debug-promises-update-parent-event.js |
@@ -0,0 +1,39 @@ |
+// 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; |
+var counter = 0; |
+ |
+function listener(event, exec_state, event_data, data) { |
+ if (!(event_data instanceof debug.UpdatePromiseParentEvent)) return; |
+ try { |
+ counter++; |
+ |
+ assertTrue(event_data.promise().isPromise()); |
+ promise = event_data.promise().value(); |
+ |
+ assertTrue(event_data.parentPromise().isPromise()); |
+ parentPromise = event_data.parentPromise().value(); |
Yang
2014/07/24 08:43:58
how about, instead of using a single value for par
Alexandra Mikhaylova
2014/07/24 09:18:37
Thanks, done. Added an array of promise/parent pai
|
+ } 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(); |
Yang
2014/07/24 08:43:58
Instead of a chain of promises, how about having a
Alexandra Mikhaylova
2014/07/24 09:18:37
Done.
|
+assertSame(parentPromise, p2); |
+assertSame(promise, p3); |
+assertEquals(3, counter); |
+ |
+assertNull(exception); |
+Debug.setListener(null); |