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 InspectorTest.log('Checks Debugger.pause'); |
| 6 |
| 7 InspectorTest.setupScriptMap(); |
| 8 Protocol.Debugger.enable(); |
| 9 InspectorTest.runAsyncTestSuite([ |
| 10 async function testPause() { |
| 11 Protocol.Debugger.pause(); |
| 12 Protocol.Runtime.evaluate({expression: 'var a = 42;'}); |
| 13 await waitPauseAndDumpLocation(); |
| 14 await Protocol.Debugger.resume(); |
| 15 }, |
| 16 |
| 17 async function testSkipFrameworks() { |
| 18 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); |
| 19 Protocol.Debugger.pause(); |
| 20 Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.
js'}); |
| 21 Protocol.Runtime.evaluate({expression: 'var a = 239;'}); |
| 22 await waitPauseAndDumpLocation(); |
| 23 await Protocol.Debugger.resume(); |
| 24 }, |
| 25 |
| 26 async function testSkipOtherContext1() { |
| 27 let contextGroupId = utils.createContextGroup(); |
| 28 Protocol.Debugger.enable({}, contextGroupId); |
| 29 Protocol.Debugger.pause(); |
| 30 Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.
js'}); |
| 31 Protocol.Runtime.evaluate({expression: 'var a = 239;'}, contextGroupId); |
| 32 Protocol.Runtime.evaluate({expression: 'var a = 1;'}); |
| 33 await waitPauseAndDumpLocation(); |
| 34 await Protocol.Debugger.resume(); |
| 35 await Protocol.Debugger.disable({}, contextGroupId); |
| 36 }, |
| 37 |
| 38 async function testSkipOtherContext2() { |
| 39 let contextGroupId = utils.createContextGroup(); |
| 40 Protocol.Debugger.enable({}, contextGroupId); |
| 41 Protocol.Debugger.pause({}, contextGroupId); |
| 42 Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.
js'}); |
| 43 Protocol.Runtime.evaluate({expression: 'var a = 239;'}, contextGroupId); |
| 44 Protocol.Runtime.evaluate({expression: 'var a = 1;'}); |
| 45 await waitPauseAndDumpLocation(); |
| 46 await Protocol.Debugger.resume(); |
| 47 await Protocol.Debugger.disable({}, contextGroupId); |
| 48 }, |
| 49 |
| 50 async function testWithNativeBreakpoint() { |
| 51 utils.schedulePauseOnNextStatement('', ''); |
| 52 await Protocol.Debugger.pause(); |
| 53 utils.cancelPauseOnNextStatement(); |
| 54 Protocol.Runtime.evaluate({expression: 'var a = 42;'}); |
| 55 await waitPauseAndDumpLocation(); |
| 56 await Protocol.Debugger.resume(); |
| 57 |
| 58 await Protocol.Debugger.pause(); |
| 59 utils.schedulePauseOnNextStatement('', ''); |
| 60 utils.cancelPauseOnNextStatement(); |
| 61 Protocol.Runtime.evaluate({expression: 'var a = 42;'}); |
| 62 await waitPauseAndDumpLocation(); |
| 63 await Protocol.Debugger.resume(); |
| 64 |
| 65 utils.schedulePauseOnNextStatement('', ''); |
| 66 utils.cancelPauseOnNextStatement(); |
| 67 await Protocol.Debugger.pause(); |
| 68 Protocol.Runtime.evaluate({expression: 'var a = 42;'}); |
| 69 await waitPauseAndDumpLocation(); |
| 70 await Protocol.Debugger.resume(); |
| 71 }, |
| 72 |
| 73 async function testDisableBreaksShouldCancelPause() { |
| 74 await Protocol.Debugger.pause(); |
| 75 await Protocol.Debugger.setBreakpointsActive({active: false}); |
| 76 Protocol.Runtime.evaluate({expression: 'var a = 42;'}) |
| 77 .then(() => Protocol.Debugger.setBreakpointsActive({active: true})) |
| 78 .then(() => Protocol.Runtime.evaluate({expression: 'debugger'})); |
| 79 await waitPauseAndDumpLocation(); |
| 80 await Protocol.Debugger.resume(); |
| 81 } |
| 82 ]); |
| 83 |
| 84 async function waitPauseAndDumpLocation() { |
| 85 var message = await Protocol.Debugger.oncePaused(); |
| 86 InspectorTest.log('paused at:'); |
| 87 await InspectorTest.logSourceLocation(message.params.callFrames[0].location); |
| 88 return message; |
| 89 } |
OLD | NEW |