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

Unified Diff: test/inspector/debugger/async-instrumentation.js

Issue 2578923002: [inspector] async stacks for Promise.then calls... (Closed)
Patch Set: avoid calling functions Created 3 years, 11 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
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | test/inspector/debugger/async-instrumentation-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/async-instrumentation.js
diff --git a/test/inspector/debugger/async-instrumentation.js b/test/inspector/debugger/async-instrumentation.js
new file mode 100644
index 0000000000000000000000000000000000000000..b61e28a2c48c8bbb692d44f9a965e45fe9f4bae6
--- /dev/null
+++ b/test/inspector/debugger/async-instrumentation.js
@@ -0,0 +1,68 @@
+// Copyright 2016 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.
+
+print('Checks async instrumentation enabled in the middle.');
+
+InspectorTest.addScript(`
+function foo() {
+ // asyncTaskStarted
+ debugger;
+ // asyncTaskFinished
+ debugger;
+}
+
+function test() {
+ var resolve1;
+ var p1 = new Promise(resolve => resolve1 = resolve);
+ var p2 = p1.then(foo);
+ debugger;
+ resolve1(); // asyncTaskScheduled
+ debugger;
+ return p2;
+}
+
+//# sourceURL=test.js`, 7, 26);
+
+InspectorTest.setupScriptMap();
+Protocol.Debugger.onPaused(message => {
+ if (enableOnPause-- === 0)
+ Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
+ InspectorTest.logCallFrames(message.params.callFrames);
+ var asyncStackTrace = message.params.asyncStackTrace;
+ while (asyncStackTrace) {
+ InspectorTest.log(`-- ${asyncStackTrace.description} --`);
+ InspectorTest.logCallFrames(asyncStackTrace.callFrames);
+ asyncStackTrace = asyncStackTrace.parent;
+ }
+ InspectorTest.log('');
+ Protocol.Debugger.resume();
+});
+
+Protocol.Debugger.enable();
+var enableOnPause = 0;
+InspectorTest.runTestSuite([
+ function beforeAsyncTaskScheduled(next) {
+ enableOnPause = 0;
+ Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js',
+ awaitPromise: true })
+ .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
+ .then(next);
+ },
+
+ function afterAsyncTaskScheduled(next) {
+ enableOnPause = 2;
+ Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js',
+ awaitPromise: true })
+ .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
+ .then(next);
+ },
+
+ function afterAsyncTaskStarted(next) {
+ enableOnPause = 3;
+ Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js',
+ awaitPromise: true })
+ .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
+ .then(next);
+ }
+]);
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | test/inspector/debugger/async-instrumentation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698