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

Side by Side Diff: test/inspector/debugger/async-instrumentation.js

Issue 2891213002: [inspector] Refactor protocol-test.js (Closed)
Patch Set: comments addressed 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
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 InspectorTest.log('Checks async instrumentation enabled in the middle.'); 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks async instru mentation enabled in the middle.');
6 6
7 InspectorTest.addScript(` 7 contextGroup.addScript(`
8 function foo() { 8 function foo() {
9 // asyncTaskStarted 9 // asyncTaskStarted
10 debugger; 10 debugger;
11 // asyncTaskFinished 11 // asyncTaskFinished
12 debugger; 12 debugger;
13 } 13 }
14 14
15 function test() { 15 function test() {
16 debugger; 16 debugger;
17 var resolve1; 17 var resolve1;
18 var p1 = new Promise(resolve => resolve1 = resolve); 18 var p1 = new Promise(resolve => resolve1 = resolve);
19 var p2 = p1.then(foo); 19 var p2 = p1.then(foo);
20 resolve1(); // asyncTaskScheduled 20 resolve1(); // asyncTaskScheduled
21 debugger; 21 debugger;
22 return p2; 22 return p2;
23 } 23 }
24 24
25 //# sourceURL=test.js`, 7, 26); 25 //# sourceURL=test.js`, 7, 26);
26 26
27 InspectorTest.setupScriptMap(); 27 session.setupScriptMap();
28 Protocol.Debugger.onPaused(message => { 28 Protocol.Debugger.onPaused(message => {
29 if (enableOnPause-- === 0) 29 if (enableOnPause-- === 0)
30 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); 30 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
31 InspectorTest.logCallFrames(message.params.callFrames); 31 session.logCallFrames(message.params.callFrames);
32 var asyncStackTrace = message.params.asyncStackTrace; 32 var asyncStackTrace = message.params.asyncStackTrace;
33 while (asyncStackTrace) { 33 while (asyncStackTrace) {
34 InspectorTest.log(`-- ${asyncStackTrace.description} --`); 34 InspectorTest.log(`-- ${asyncStackTrace.description} --`);
35 InspectorTest.logCallFrames(asyncStackTrace.callFrames); 35 session.logCallFrames(asyncStackTrace.callFrames);
36 asyncStackTrace = asyncStackTrace.parent; 36 asyncStackTrace = asyncStackTrace.parent;
37 } 37 }
38 InspectorTest.log(''); 38 InspectorTest.log('');
39 Protocol.Debugger.resume(); 39 Protocol.Debugger.resume();
40 }); 40 });
41 41
42 Protocol.Debugger.enable(); 42 Protocol.Debugger.enable();
43 var enableOnPause = 0; 43 var enableOnPause = 0;
44 InspectorTest.runTestSuite([ 44 InspectorTest.runTestSuite([
45 function beforeAsyncTaskScheduled(next) { 45 function beforeAsyncTaskScheduled(next) {
(...skipping 13 matching lines...) Expand all
59 }, 59 },
60 60
61 function afterAsyncTaskStarted(next) { 61 function afterAsyncTaskStarted(next) {
62 enableOnPause = 3; 62 enableOnPause = 3;
63 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js', 63 Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr1.js',
64 awaitPromise: true }) 64 awaitPromise: true })
65 .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 })) 65 .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
66 .then(next); 66 .then(next);
67 } 67 }
68 ]); 68 ]);
OLDNEW
« no previous file with comments | « test/inspector/debugger/async-for-await-of-promise-stack.js ('k') | test/inspector/debugger/async-promise-late-then.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698