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

Unified Diff: test/inspector/debugger/promise-chain-when-limit-hit.js

Issue 2844753002: [inspector] better stacks for promises (Closed)
Patch Set: ac Created 3 years, 8 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/inspector/debugger/promise-chain-when-limit-hit.js
diff --git a/test/inspector/debugger/promise-chain-when-limit-hit.js b/test/inspector/debugger/promise-chain-when-limit-hit.js
new file mode 100644
index 0000000000000000000000000000000000000000..53ff71780cb95d2237b2279c5d1dfe42962af505
--- /dev/null
+++ b/test/inspector/debugger/promise-chain-when-limit-hit.js
@@ -0,0 +1,51 @@
+// Copyright 2017 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.
+
+(async function test(){
+ InspectorTest.log('Checks correctness of promise chains when limit hit');
+ await Protocol.Runtime.enable();
+ await Protocol.Debugger.enable();
+ Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128});
+
+ await setMaxAsyncTaskStacks(3);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ await setMaxAsyncTaskStacks(4);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ await setMaxAsyncTaskStacks(5);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ await setMaxAsyncTaskStacks(6);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ await setMaxAsyncTaskStacks(7);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ await setMaxAsyncTaskStacks(8);
+ runWithAsyncChainPromise(3, 'console.trace()');
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+
+ InspectorTest.completeTest();
+})();
+
+function runWithAsyncChainPromise(len, source) {
+ InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`);
+ let then = '.then(() => 1)';
+ let pause = `.then(() => { ${source} })`;
+ Protocol.Runtime.evaluate({
+ expression: `Promise.resolve()${then.repeat(len - 1)}${pause}`
+ });
+}
+
+async function setMaxAsyncTaskStacks(max) {
+ let expression = `inspector.setMaxAsyncTaskStacks(${max})`;
+ InspectorTest.log(expression);
+ await Protocol.Runtime.evaluate({expression});
+}

Powered by Google App Engine
This is Rietveld 408576698