From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../test/mochitest/browser_dbg-pause-points.js | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js b/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js new file mode 100644 index 0000000000..456e4e10f5 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-points.js @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +"use strict"; + +requestLongerTimeout(2); + +async function testCase(dbg, { name, steps }) { + info(` ### Execute testCase "${name}"`); + + const { + selectors: { getTopFrame, getCurrentThread }, + } = dbg; + const locations = []; + + const recordFrame = state => { + const { line, column } = getTopFrame(getCurrentThread()).location; + locations.push([line, column]); + info(`Break on ${line}:${column}`); + }; + + info("Trigger the expected debugger statement"); + const onPaused = waitForPaused(dbg); + invokeInTab(name); + await onPaused; + recordFrame(); + + info("Start stepping over"); + for (let i = 0; i < steps.length - 1; i++) { + await dbg.actions.stepOver(); + await waitForPaused(dbg); + recordFrame(); + } + + is(formatSteps(locations), formatSteps(steps), name); + + await resume(dbg); +} + +add_task(async function test() { + const dbg = await initDebugger("doc-pause-points.html", "pause-points.js"); + + await selectSource(dbg, "pause-points.js"); + await testCase(dbg, { + name: "statements", + steps: [ + [9, 2], + [10, 4], + [10, 13], + [11, 2], + [11, 21], + [12, 2], + [12, 12], + [13, 0], + ], + }); + + await testCase(dbg, { + name: "expressions", + steps: [ + [40, 2], + [41, 2], + [42, 12], + [43, 0], + ], + }); + + await testCase(dbg, { + name: "sequences", + steps: [ + [23, 2], + [25, 12], + [29, 12], + [34, 2], + [37, 0], + ], + }); + + await testCase(dbg, { + name: "flow", + steps: [ + [16, 2], + [17, 12], + [18, 10], + [19, 8], + [19, 17], + [19, 8], + [19, 17], + [19, 8], + ], + }); +}); + +function formatSteps(steps) { + return steps.map(loc => `(${loc.join(",")})`).join(", "); +} -- cgit v1.2.3