| 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 breakProgram,(schedule|cancel)PauseOnNextStatement tes
t API"); | 5 let {session, contextGroup, Protocol} = InspectorTest.start("Checks breakProgram
,(schedule|cancel)PauseOnNextStatement test API"); |
| 6 | 6 |
| 7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
| 8 function callBreakProgram() { | 8 function callBreakProgram() { |
| 9 inspector.breakProgram('reason', JSON.stringify({a: 42})); | 9 inspector.breakProgram('reason', JSON.stringify({a: 42})); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function foo() { | 12 function foo() { |
| 13 return 42; | 13 return 42; |
| 14 }`, 7, 26); | 14 }`, 7, 26); |
| 15 | 15 |
| 16 InspectorTest.setupScriptMap(); | 16 session.setupScriptMap(); |
| 17 Protocol.Debugger.onPaused(message => { | 17 Protocol.Debugger.onPaused(message => { |
| 18 InspectorTest.log('Stack:'); | 18 InspectorTest.log('Stack:'); |
| 19 InspectorTest.logCallFrames(message.params.callFrames); | 19 session.logCallFrames(message.params.callFrames); |
| 20 delete message.params.callFrames; | 20 delete message.params.callFrames; |
| 21 InspectorTest.log('Other data:'); | 21 InspectorTest.log('Other data:'); |
| 22 InspectorTest.logMessage(message); | 22 InspectorTest.logMessage(message); |
| 23 InspectorTest.log(''); | 23 InspectorTest.log(''); |
| 24 Protocol.Debugger.resume(); | 24 Protocol.Debugger.resume(); |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 Protocol.Debugger.enable(); | 27 Protocol.Debugger.enable(); |
| 28 | 28 |
| 29 InspectorTest.runTestSuite([ | 29 InspectorTest.runTestSuite([ |
| 30 function testBreakProgram(next) { | 30 function testBreakProgram(next) { |
| 31 Protocol.Runtime.evaluate({ expression: 'callBreakProgram()'}) | 31 Protocol.Runtime.evaluate({ expression: 'callBreakProgram()'}) |
| 32 .then(next); | 32 .then(next); |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 function testSchedulePauseOnNextStatement(next) { | 35 function testSchedulePauseOnNextStatement(next) { |
| 36 InspectorTest.contextGroup.schedulePauseOnNextStatement('reason', JSON.strin
gify({a: 42})); | 36 contextGroup.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42}))
; |
| 37 Protocol.Runtime.evaluate({ expression: 'foo()//# sourceURL=expr1.js'}) | 37 Protocol.Runtime.evaluate({ expression: 'foo()//# sourceURL=expr1.js'}) |
| 38 .then(() => Protocol.Runtime.evaluate({ | 38 .then(() => Protocol.Runtime.evaluate({ |
| 39 expression: 'foo()//# sourceURL=expr2.js'})) | 39 expression: 'foo()//# sourceURL=expr2.js'})) |
| 40 .then(() => InspectorTest.contextGroup.cancelPauseOnNextStatement()) | 40 .then(() => contextGroup.cancelPauseOnNextStatement()) |
| 41 .then(next); | 41 .then(next); |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 function testCancelPauseOnNextStatement(next) { | 44 function testCancelPauseOnNextStatement(next) { |
| 45 InspectorTest.contextGroup.schedulePauseOnNextStatement('reason', JSON.strin
gify({a: 42})); | 45 contextGroup.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42}))
; |
| 46 InspectorTest.contextGroup.cancelPauseOnNextStatement(); | 46 contextGroup.cancelPauseOnNextStatement(); |
| 47 Protocol.Runtime.evaluate({ expression: 'foo()'}) | 47 Protocol.Runtime.evaluate({ expression: 'foo()'}) |
| 48 .then(next); | 48 .then(next); |
| 49 } | 49 } |
| 50 ]); | 50 ]); |
| OLD | NEW |