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