OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 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 | 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 stepping with blackboxed frames on stack'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks stepping wit
h blackboxed frames on stack'); |
6 | 6 |
7 InspectorTest.addScript( | 7 contextGroup.addScript( |
8 ` | 8 ` |
9 function frameworkCall(funcs) { | 9 function frameworkCall(funcs) { |
10 for (var f of funcs) f(); | 10 for (var f of funcs) f(); |
11 } | 11 } |
12 | 12 |
13 function frameworkBreakAndCall(funcs) { | 13 function frameworkBreakAndCall(funcs) { |
14 inspector.breakProgram('', ''); | 14 inspector.breakProgram('', ''); |
15 for (var f of funcs) f(); | 15 for (var f of funcs) f(); |
16 } | 16 } |
17 //# sourceURL=framework.js`, | 17 //# sourceURL=framework.js`, |
18 8, 4); | 18 8, 4); |
19 | 19 |
20 InspectorTest.addScript( | 20 contextGroup.addScript( |
21 ` | 21 ` |
22 function userFoo() { | 22 function userFoo() { |
23 return 1; | 23 return 1; |
24 } | 24 } |
25 | 25 |
26 function userBoo() { | 26 function userBoo() { |
27 return 2; | 27 return 2; |
28 } | 28 } |
29 | 29 |
30 function testStepFromUser() { | 30 function testStepFromUser() { |
31 frameworkCall([userFoo, userBoo]) | 31 frameworkCall([userFoo, userBoo]) |
32 } | 32 } |
33 | 33 |
34 function testStepFromFramework() { | 34 function testStepFromFramework() { |
35 frameworkBreakAndCall([userFoo, userBoo]); | 35 frameworkBreakAndCall([userFoo, userBoo]); |
36 } | 36 } |
37 //# sourceURL=user.js`, | 37 //# sourceURL=user.js`, |
38 21, 4); | 38 21, 4); |
39 | 39 |
40 InspectorTest.setupScriptMap(); | 40 session.setupScriptMap(); |
41 | 41 |
42 Protocol.Debugger.enable() | 42 Protocol.Debugger.enable() |
43 .then( | 43 .then( |
44 () => Protocol.Debugger.setBlackboxPatterns( | 44 () => Protocol.Debugger.setBlackboxPatterns( |
45 {patterns: ['framework\.js']})) | 45 {patterns: ['framework\.js']})) |
46 .then(() => InspectorTest.runTestSuite(testSuite)); | 46 .then(() => InspectorTest.runTestSuite(testSuite)); |
47 | 47 |
48 var testSuite = [ | 48 var testSuite = [ |
49 function testStepIntoFromUser(next) { | 49 function testStepIntoFromUser(next) { |
50 InspectorTest.contextGroup.schedulePauseOnNextStatement('', ''); | 50 contextGroup.schedulePauseOnNextStatement('', ''); |
51 test('testStepFromUser()', [ | 51 test('testStepFromUser()', [ |
52 'print', // before testStepFromUser call | 52 'print', // before testStepFromUser call |
53 'stepInto', 'stepInto', 'print', // userFoo | 53 'stepInto', 'stepInto', 'print', // userFoo |
54 'stepInto', 'stepInto', 'print', // userBoo | 54 'stepInto', 'stepInto', 'print', // userBoo |
55 'stepInto', 'stepInto', 'print' // testStepFromUser | 55 'stepInto', 'stepInto', 'print' // testStepFromUser |
56 ]).then(next); | 56 ]).then(next); |
57 }, | 57 }, |
58 | 58 |
59 function testStepOverFromUser(next) { | 59 function testStepOverFromUser(next) { |
60 InspectorTest.contextGroup.schedulePauseOnNextStatement('', ''); | 60 contextGroup.schedulePauseOnNextStatement('', ''); |
61 test('testStepFromUser()', [ | 61 test('testStepFromUser()', [ |
62 'print', // before testStepFromUser call | 62 'print', // before testStepFromUser call |
63 'stepInto', 'stepInto', 'print', // userFoo | 63 'stepInto', 'stepInto', 'print', // userFoo |
64 'stepOver', 'stepOver', 'print', // userBoo | 64 'stepOver', 'stepOver', 'print', // userBoo |
65 'stepOver', 'stepOver', 'print' // testStepFromUser | 65 'stepOver', 'stepOver', 'print' // testStepFromUser |
66 ]).then(next); | 66 ]).then(next); |
67 }, | 67 }, |
68 | 68 |
69 function testStepOutFromUser(next) { | 69 function testStepOutFromUser(next) { |
70 InspectorTest.contextGroup.schedulePauseOnNextStatement('', ''); | 70 contextGroup.schedulePauseOnNextStatement('', ''); |
71 test('testStepFromUser()', [ | 71 test('testStepFromUser()', [ |
72 'print', // before testStepFromUser call | 72 'print', // before testStepFromUser call |
73 'stepInto', 'stepInto', 'print', // userFoo | 73 'stepInto', 'stepInto', 'print', // userFoo |
74 'stepOut', 'print' // testStepFromUser | 74 'stepOut', 'print' // testStepFromUser |
75 ]).then(next); | 75 ]).then(next); |
76 }, | 76 }, |
77 | 77 |
78 function testStepIntoFromFramework(next) { | 78 function testStepIntoFromFramework(next) { |
79 test('testStepFromFramework()', [ | 79 test('testStepFromFramework()', [ |
80 'print', // frameworkBreakAndCall | 80 'print', // frameworkBreakAndCall |
(...skipping 13 matching lines...) Expand all Loading... |
94 'print', // frameworkBreakAndCall | 94 'print', // frameworkBreakAndCall |
95 'stepOut', 'print', // testStepFromFramework | 95 'stepOut', 'print', // testStepFromFramework |
96 ]).then(next); | 96 ]).then(next); |
97 } | 97 } |
98 ]; | 98 ]; |
99 | 99 |
100 function test(entryExpression, actions) { | 100 function test(entryExpression, actions) { |
101 Protocol.Debugger.onPaused(message => { | 101 Protocol.Debugger.onPaused(message => { |
102 var action = actions.shift() || 'resume'; | 102 var action = actions.shift() || 'resume'; |
103 if (action === 'print') { | 103 if (action === 'print') { |
104 InspectorTest.logCallFrames(message.params.callFrames); | 104 session.logCallFrames(message.params.callFrames); |
105 InspectorTest.log(''); | 105 InspectorTest.log(''); |
106 action = actions.shift() || 'resume'; | 106 action = actions.shift() || 'resume'; |
107 } | 107 } |
108 if (action) InspectorTest.log(`Executing ${action}...`); | 108 if (action) InspectorTest.log(`Executing ${action}...`); |
109 Protocol.Debugger[action](); | 109 Protocol.Debugger[action](); |
110 }); | 110 }); |
111 return Protocol.Runtime.evaluate( | 111 return Protocol.Runtime.evaluate( |
112 {expression: entryExpression + '//# sourceURL=expr.js'}); | 112 {expression: entryExpression + '//# sourceURL=expr.js'}); |
113 } | 113 } |
OLD | NEW |