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-debugger-buttons.js | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js (limited to 'devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js') diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js b/devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js new file mode 100644 index 0000000000..14c71bb4f9 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-debugger-buttons.js @@ -0,0 +1,124 @@ +/* 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 . */ + +/** + * Test debugger buttons + * 1. resume + * 2. stepOver + * 3. stepIn + * 4. stepOver to the end of a function + * 5. stepUp at the end of a function + */ + +"use strict"; + +add_task(async function () { + const dbg = await initDebugger("doc-debugger-statements.html"); + + let onReloaded = reload(dbg, "doc-debugger-statements.html"); + await waitForPaused(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 11 + ); + + info("resume"); + await clickResume(dbg); + await waitForPaused(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 16 + ); + + info("step over"); + await clickStepOver(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 17 + ); + + info("step into"); + await clickStepIn(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 22 + ); + + info("step over"); + await clickStepOver(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 24 + ); + + info("step out"); + await clickStepOut(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 18 + ); + + await resume(dbg); + + info("Wait for reload to complete after resume"); + await onReloaded; + + info("Toggle debugger statement off"); + const toggleCheckbox = findElementWithSelector( + dbg, + ".breakpoints-debugger-statement input" + ); + toggleCheckbox.click(); + await waitFor(() => !toggleCheckbox.checked); + + await reload(dbg, "doc-debugger-statements.html"); + assertNotPaused(dbg); + + info("Re-enable debugger statement"); + toggleCheckbox.click(); + await waitFor(() => toggleCheckbox.checked); + + onReloaded = reload(dbg, "doc-debugger-statements.html"); + await waitForPaused(dbg); + assertPausedAtSourceAndLine( + dbg, + findSource(dbg, "doc-debugger-statements.html").id, + 11 + ); + await resume(dbg); + await waitForPaused(dbg); + await resume(dbg); + await onReloaded; +}); + +function clickButton(dbg, button) { + const resumeFired = waitForDispatch(dbg.store, "COMMAND"); + clickElement(dbg, button); + return resumeFired; +} + +async function clickStepOver(dbg) { + await clickButton(dbg, "stepOver"); + return waitForPaused(dbg); +} + +async function clickStepIn(dbg) { + await clickButton(dbg, "stepIn"); + return waitForPaused(dbg); +} + +async function clickStepOut(dbg) { + await clickButton(dbg, "stepOut"); + return waitForPaused(dbg); +} + +async function clickResume(dbg) { + return clickButton(dbg, "resume"); +} -- cgit v1.2.3