summaryrefslogtreecommitdiffstats
path: root/devtools/client/shared/test
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/shared/test')
-rw-r--r--devtools/client/shared/test/browser_autocomplete_popup_input.js5
-rw-r--r--devtools/client/shared/test/browser_cubic-bezier-02.js2
-rw-r--r--devtools/client/shared/test/browser_cubic-bezier-06.js2
-rw-r--r--devtools/client/shared/test/browser_dbg_listworkers.js4
-rw-r--r--devtools/client/shared/test/browser_inplace-editor-01.js6
-rw-r--r--devtools/client/shared/test/browser_key_shortcuts.js2
-rw-r--r--devtools/client/shared/test/browser_spectrum.js7
-rw-r--r--devtools/client/shared/test/browser_tableWidget_basic.js3
-rw-r--r--devtools/client/shared/test/browser_telemetry_button_eyedropper.js2
-rw-r--r--devtools/client/shared/test/browser_treeWidget_basic.js6
-rw-r--r--devtools/client/shared/test/doc_event-listeners-01.html8
-rw-r--r--devtools/client/shared/test/doc_event-listeners-03.html4
-rw-r--r--devtools/client/shared/test/doc_layoutHelpers_getBoxQuads2-c-and-e.html2
-rw-r--r--devtools/client/shared/test/doc_native-event-handler.html2
-rw-r--r--devtools/client/shared/test/highlighter-test-actor.js2
-rw-r--r--devtools/client/shared/test/shared-head.js39
16 files changed, 68 insertions, 28 deletions
diff --git a/devtools/client/shared/test/browser_autocomplete_popup_input.js b/devtools/client/shared/test/browser_autocomplete_popup_input.js
index a7d04f1c9c..32fc6da25e 100644
--- a/devtools/client/shared/test/browser_autocomplete_popup_input.js
+++ b/devtools/client/shared/test/browser_autocomplete_popup_input.js
@@ -19,7 +19,8 @@ add_task(async function () {
const { doc } = await createHost();
const input = doc.createElement("input");
- doc.body.append(input, doc.createElement("input"));
+ const prevInput = doc.createElement("input");
+ doc.body.append(prevInput, input, doc.createElement("input"));
const onSelectCalled = [];
const onClickCalled = [];
@@ -189,7 +190,9 @@ add_task(async function () {
);
EventUtils.synthesizeKey("KEY_Tab", { shiftKey: true });
is(onClickCalled.length, 3, "onClick wasn't called");
+
is(hasFocus(input), false, "input does not have the focus anymore");
+ is(hasFocus(prevInput), true, "Shift+Tab moves the focus to prevInput");
const onPopupClose = popup.once("popup-closed");
popup.hidePopup();
diff --git a/devtools/client/shared/test/browser_cubic-bezier-02.js b/devtools/client/shared/test/browser_cubic-bezier-02.js
index 3ce0af2f99..55fcb39c83 100644
--- a/devtools/client/shared/test/browser_cubic-bezier-02.js
+++ b/devtools/client/shared/test/browser_cubic-bezier-02.js
@@ -103,7 +103,7 @@ async function curveCanBeClicked(widget, win, doc, offsets) {
is(bezier.P1[1], 0.75, "P1 progress coordinate remained unchanged");
}
-async function pointsCanBeMovedWithKeyboard(widget, win, doc, offsets) {
+async function pointsCanBeMovedWithKeyboard(widget) {
info("Checking that points respond to keyboard events");
const singleStep = 3;
diff --git a/devtools/client/shared/test/browser_cubic-bezier-06.js b/devtools/client/shared/test/browser_cubic-bezier-06.js
index 9cb00e8bf7..269610b69f 100644
--- a/devtools/client/shared/test/browser_cubic-bezier-06.js
+++ b/devtools/client/shared/test/browser_cubic-bezier-06.js
@@ -63,7 +63,7 @@ function adjustingBezierUpdatesPreset(widget, win, doc, rect) {
is(widget.presets._activePreset, null, "There is no active preset");
}
-async function selectingPresetUpdatesBezier(widget, win, doc, rect) {
+async function selectingPresetUpdatesBezier(widget, win, doc) {
info("Checking that selecting a preset updates bezier curve");
info("Listening for the new coordinates event");
diff --git a/devtools/client/shared/test/browser_dbg_listworkers.js b/devtools/client/shared/test/browser_dbg_listworkers.js
index fcdcf8e5dd..fc54139134 100644
--- a/devtools/client/shared/test/browser_dbg_listworkers.js
+++ b/devtools/client/shared/test/browser_dbg_listworkers.js
@@ -42,7 +42,7 @@ add_task(async function test() {
is(workers[1].url, WORKER2_URL);
onWorkerListChanged = waitForWorkerListChanged(target);
- await SpecialPowers.spawn(tab.linkedBrowser, [WORKER2_URL], workerUrl => {
+ await SpecialPowers.spawn(tab.linkedBrowser, [WORKER2_URL], () => {
content.worker1.terminate();
});
await onWorkerListChanged;
@@ -52,7 +52,7 @@ add_task(async function test() {
is(workers[0].url, WORKER2_URL);
onWorkerListChanged = waitForWorkerListChanged(target);
- await SpecialPowers.spawn(tab.linkedBrowser, [WORKER2_URL], workerUrl => {
+ await SpecialPowers.spawn(tab.linkedBrowser, [WORKER2_URL], () => {
content.worker2.terminate();
});
await onWorkerListChanged;
diff --git a/devtools/client/shared/test/browser_inplace-editor-01.js b/devtools/client/shared/test/browser_inplace-editor-01.js
index b919fca946..e6bc604392 100644
--- a/devtools/client/shared/test/browser_inplace-editor-01.js
+++ b/devtools/client/shared/test/browser_inplace-editor-01.js
@@ -96,7 +96,7 @@ function testAdvanceCharCommit(doc) {
createInplaceEditorAndClick(
{
advanceChars: ":",
- start(editor) {
+ start() {
EventUtils.sendString("Test:");
},
done: onDone("Test", true, resolve),
@@ -114,7 +114,7 @@ function testAdvanceCharsFunction(doc) {
createInplaceEditorAndClick(
{
initial: "",
- advanceChars(charCode, text, insertionPoint) {
+ advanceChars(charCode, text) {
if (charCode !== KeyboardEvent.DOM_VK_COLON) {
return false;
}
@@ -126,7 +126,7 @@ function testAdvanceCharsFunction(doc) {
// Just to make sure we check it somehow.
return !!text.length;
},
- start(editor) {
+ start() {
for (const ch of ":Test:") {
EventUtils.sendChar(ch);
}
diff --git a/devtools/client/shared/test/browser_key_shortcuts.js b/devtools/client/shared/test/browser_key_shortcuts.js
index d48666ddca..6dafe3df2c 100644
--- a/devtools/client/shared/test/browser_key_shortcuts.js
+++ b/devtools/client/shared/test/browser_key_shortcuts.js
@@ -438,7 +438,7 @@ async function testTabCharacterShortcut(shortcuts) {
info("Test tab character shortcut");
- once(shortcuts, "CmdOrCtrl+Alt+I", event => {
+ once(shortcuts, "CmdOrCtrl+Alt+I", () => {
ok(false, "This handler must not be executed");
});
diff --git a/devtools/client/shared/test/browser_spectrum.js b/devtools/client/shared/test/browser_spectrum.js
index 6189b1f0af..32ed6a79e0 100644
--- a/devtools/client/shared/test/browser_spectrum.js
+++ b/devtools/client/shared/test/browser_spectrum.js
@@ -245,12 +245,7 @@ function setSpectrumProps(spectrum, props, updateUI = true) {
}
}
-function testAriaAttributesOnSpectrumElements(
- spectrum,
- colorName,
- rgbString,
- alpha
-) {
+function testAriaAttributesOnSpectrumElements(spectrum, colorName, rgbString) {
for (const slider of [spectrum.dragger, spectrum.hueSlider]) {
is(
slider.getAttribute("aria-describedby"),
diff --git a/devtools/client/shared/test/browser_tableWidget_basic.js b/devtools/client/shared/test/browser_tableWidget_basic.js
index a8b737b9d0..5cdf67206e 100644
--- a/devtools/client/shared/test/browser_tableWidget_basic.js
+++ b/devtools/client/shared/test/browser_tableWidget_basic.js
@@ -1,6 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
+// We test sorting of strings, which Assert.greater/less etc. don't do.
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
// Tests that the table widget api works fine
"use strict";
diff --git a/devtools/client/shared/test/browser_telemetry_button_eyedropper.js b/devtools/client/shared/test/browser_telemetry_button_eyedropper.js
index 88d019de91..0606cec886 100644
--- a/devtools/client/shared/test/browser_telemetry_button_eyedropper.js
+++ b/devtools/client/shared/test/browser_telemetry_button_eyedropper.js
@@ -23,7 +23,7 @@ add_task(async function () {
gBrowser.removeCurrentTab();
});
-async function testButton(toolbox, Telemetry) {
+async function testButton(toolbox) {
info("Calling the eyedropper button's callback");
// We call the button callback directly because we don't need to test the UI here, we're
// only concerned about testing the telemetry probe.
diff --git a/devtools/client/shared/test/browser_treeWidget_basic.js b/devtools/client/shared/test/browser_treeWidget_basic.js
index 48702b9b8d..bc52a07c8e 100644
--- a/devtools/client/shared/test/browser_treeWidget_basic.js
+++ b/devtools/client/shared/test/browser_treeWidget_basic.js
@@ -34,7 +34,7 @@ add_task(async function () {
gBrowser.removeCurrentTab();
});
-function populateTree(tree, doc) {
+function populateTree(tree) {
tree.add([
{
id: "level1",
@@ -179,7 +179,7 @@ function testTreeItemInsertedCorrectly(tree, doc) {
/**
* Populate the unsorted tree.
*/
-function populateUnsortedTree(tree, doc) {
+function populateUnsortedTree(tree) {
tree.sorted = false;
tree.add([{ id: "g-1", label: "g-1" }]);
@@ -191,7 +191,7 @@ function populateUnsortedTree(tree, doc) {
/**
* Test if the nodes are inserted correctly in the unsorted tree.
*/
-function testUnsortedTreeItemInsertedCorrectly(tree, doc) {
+function testUnsortedTreeItemInsertedCorrectly(tree) {
ok(tree.root.items.has("g-1"), "g-1 top level element exists");
is(
diff --git a/devtools/client/shared/test/doc_event-listeners-01.html b/devtools/client/shared/test/doc_event-listeners-01.html
index 5a9c2d53b6..653676b623 100644
--- a/devtools/client/shared/test/doc_event-listeners-01.html
+++ b/devtools/client/shared/test/doc_event-listeners-01.html
@@ -15,19 +15,19 @@
"use strict";
window.addEventListener("load", function() {
- function initialSetup(event) {
+ function initialSetup() {
// eslint-disable-next-line no-debugger
debugger;
const button = document.querySelector("button");
button.onclick = clickHandler;
}
- function clickHandler(event) {
+ function clickHandler() {
window.foobar = "clickHandler";
}
- function changeHandler(event) {
+ function changeHandler() {
window.foobar = "changeHandler";
}
- function keyupHandler(event) {
+ function keyupHandler() {
window.foobar = "keyupHandler";
}
diff --git a/devtools/client/shared/test/doc_event-listeners-03.html b/devtools/client/shared/test/doc_event-listeners-03.html
index 2660f9f141..1d45b575e1 100644
--- a/devtools/client/shared/test/doc_event-listeners-03.html
+++ b/devtools/client/shared/test/doc_event-listeners-03.html
@@ -17,14 +17,14 @@
"use strict";
window.addEventListener("load", function() {
- function initialSetup(event) {
+ function initialSetup() {
const button = document.getElementById("initialSetup");
button.removeEventListener("click", initialSetup);
// eslint-disable-next-line no-debugger
debugger;
}
- function clicker(event) {
+ function clicker() {
window.foobar = "clicker";
}
diff --git a/devtools/client/shared/test/doc_layoutHelpers_getBoxQuads2-c-and-e.html b/devtools/client/shared/test/doc_layoutHelpers_getBoxQuads2-c-and-e.html
index 7917c82411..d31aa30e73 100644
--- a/devtools/client/shared/test/doc_layoutHelpers_getBoxQuads2-c-and-e.html
+++ b/devtools/client/shared/test/doc_layoutHelpers_getBoxQuads2-c-and-e.html
@@ -2,7 +2,7 @@
<meta charset=utf-8>
<script>
'use strict';
-window.onmessage = event => {
+window.onmessage = () => {
const innerNode = window.document.getElementById("inner-node");
const wrappedNode = SpecialPowers.wrap(innerNode);
const wrappedQuads = wrappedNode.getBoxQuadsFromWindowOrigin();
diff --git a/devtools/client/shared/test/doc_native-event-handler.html b/devtools/client/shared/test/doc_native-event-handler.html
index f08d7c01f1..45203f3444 100644
--- a/devtools/client/shared/test/doc_native-event-handler.html
+++ b/devtools/client/shared/test/doc_native-event-handler.html
@@ -9,7 +9,7 @@
"use strict";
/* exported initialSetup */
- function initialSetup(event) {
+ function initialSetup() {
// eslint-disable-next-line no-debugger
debugger;
}
diff --git a/devtools/client/shared/test/highlighter-test-actor.js b/devtools/client/shared/test/highlighter-test-actor.js
index 8a7b404df1..8d02d79784 100644
--- a/devtools/client/shared/test/highlighter-test-actor.js
+++ b/devtools/client/shared/test/highlighter-test-actor.js
@@ -209,7 +209,7 @@ var highlighterTestSpec = protocol.generateActorSpec({
});
class HighlighterTestActor extends protocol.Actor {
- constructor(conn, targetActor, options) {
+ constructor(conn, targetActor) {
super(conn, highlighterTestSpec);
this.targetActor = targetActor;
diff --git a/devtools/client/shared/test/shared-head.js b/devtools/client/shared/test/shared-head.js
index 2c8df188a6..aa47b35edd 100644
--- a/devtools/client/shared/test/shared-head.js
+++ b/devtools/client/shared/test/shared-head.js
@@ -54,6 +54,45 @@ if (DEBUG_ALLOCATIONS) {
});
}
+// When DEBUG_STEP environment variable is set,
+// automatically start a tracer which will log all line being executed
+// in the running test (and nothing else) and also pause its execution
+// for the given amount of milliseconds.
+//
+// Be careful that these pause have significant side effect.
+// This will pause the test script event loop and allow running the other
+// tasks queued in the parent process's main thread event loop queue.
+//
+// Passing any non-number value, like `DEBUG_STEP=true` will still
+// log the executed lines without any pause, and without this side effect.
+//
+// For now, the tracer can only work once per thread.
+// So when using this feature you will not be able to use the JS tracer
+// in any other way on parent process's main thread.
+const DEBUG_STEP = Services.env.get("DEBUG_STEP");
+if (DEBUG_STEP) {
+ // Use a custom loader with `invisibleToDebugger` flag for the allocation tracker
+ // as it instantiates custom Debugger API instances and has to be running in a distinct
+ // compartments from DevTools and system scopes (JSMs, XPCOM,...)
+ const {
+ useDistinctSystemPrincipalLoader,
+ releaseDistinctSystemPrincipalLoader,
+ } = ChromeUtils.importESModule(
+ "resource://devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs"
+ );
+ const requester = {};
+ const loader = useDistinctSystemPrincipalLoader(requester);
+
+ const stepper = loader.require(
+ "resource://devtools/shared/test-helpers/test-stepper.js"
+ );
+ stepper.start(globalThis, gTestPath, DEBUG_STEP);
+ registerCleanupFunction(() => {
+ stepper.stop();
+ releaseDistinctSystemPrincipalLoader(requester);
+ });
+}
+
const { loader, require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs"
);