mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 11:36:57 +00:00

PR-URL: https://github.com/nodejs/node/pull/47251 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
70 lines
3.0 KiB
JavaScript
70 lines
3.0 KiB
JavaScript
// Copyright 2023 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
let {session, Protocol} =
|
|
InspectorTest.start('Tests for set-breakpoints-active');
|
|
|
|
Protocol.Debugger.enable();
|
|
Protocol.Debugger.onPaused(({params}) => {
|
|
InspectorTest.log(`Paused. (reason: ${params.reason})`);
|
|
Protocol.Debugger.resume();
|
|
});
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
async function testDeactivatedBreakpointsAfterReconnect() {
|
|
await Protocol.Debugger.setBreakpointsActive({active: true});
|
|
InspectorTest.log('Breakpoints activated.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
await Protocol.Debugger.setBreakpointsActive({active: false});
|
|
InspectorTest.log('Breakpoints deactivated.');
|
|
session.reconnect();
|
|
InspectorTest.log('Reconnected.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
},
|
|
async function testDeactivatedBreakpointsAfterDisableEnable() {
|
|
await Protocol.Debugger.setBreakpointsActive({active: true});
|
|
InspectorTest.log('Breakpoints activated.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
await Protocol.Debugger.setBreakpointsActive({active: false});
|
|
InspectorTest.log('Breakpoints deactivated.');
|
|
await Protocol.Debugger.disable();
|
|
InspectorTest.log('Disabled.');
|
|
await Protocol.Debugger.enable();
|
|
InspectorTest.log('Enabled.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
},
|
|
async function testDeactivateBreakpointsWhileDisabled() {
|
|
await Protocol.Debugger.setBreakpointsActive({active: true});
|
|
InspectorTest.log('Breakpoints activated.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
await Protocol.Debugger.disable();
|
|
InspectorTest.log('Disabled.');
|
|
await Protocol.Debugger.setBreakpointsActive({active: false});
|
|
InspectorTest.log('Breakpoints deactivated.');
|
|
await Protocol.Debugger.enable();
|
|
InspectorTest.log('Enabled.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
},
|
|
async function testActivateBreakpointsWhileDisabled() {
|
|
await Protocol.Debugger.setBreakpointsActive({active: false});
|
|
InspectorTest.log('Breakpoints deactivated.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
await Protocol.Debugger.disable();
|
|
InspectorTest.log('Disabled.');
|
|
await Protocol.Debugger.setBreakpointsActive({active: true});
|
|
InspectorTest.log('Breakpoints activated.');
|
|
await Protocol.Debugger.enable();
|
|
InspectorTest.log('Enabled.');
|
|
await Protocol.Runtime.evaluate({expression: 'debugger'});
|
|
InspectorTest.log('Debugger break executed.');
|
|
},
|
|
]);
|