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

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

Issue 2844753002: [inspector] better stacks for promises (Closed)
Patch Set: ac Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 (async function test(){
6 InspectorTest.log('Checks correctness of promise chains when limit hit');
7 await Protocol.Runtime.enable();
8 await Protocol.Debugger.enable();
9 Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128});
10
11 await setMaxAsyncTaskStacks(3);
12 runWithAsyncChainPromise(3, 'console.trace()');
13 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
14
15 await setMaxAsyncTaskStacks(4);
16 runWithAsyncChainPromise(3, 'console.trace()');
17 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
18
19 await setMaxAsyncTaskStacks(5);
20 runWithAsyncChainPromise(3, 'console.trace()');
21 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
22
23 await setMaxAsyncTaskStacks(6);
24 runWithAsyncChainPromise(3, 'console.trace()');
25 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
26
27 await setMaxAsyncTaskStacks(7);
28 runWithAsyncChainPromise(3, 'console.trace()');
29 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
30
31 await setMaxAsyncTaskStacks(8);
32 runWithAsyncChainPromise(3, 'console.trace()');
33 InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
34
35 InspectorTest.completeTest();
36 })();
37
38 function runWithAsyncChainPromise(len, source) {
39 InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`);
40 let then = '.then(() => 1)';
41 let pause = `.then(() => { ${source} })`;
42 Protocol.Runtime.evaluate({
43 expression: `Promise.resolve()${then.repeat(len - 1)}${pause}`
44 });
45 }
46
47 async function setMaxAsyncTaskStacks(max) {
48 let expression = `inspector.setMaxAsyncTaskStacks(${max})`;
49 InspectorTest.log(expression);
50 await Protocol.Runtime.evaluate({expression});
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698