summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/windows/uia/head.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /accessible/tests/browser/windows/uia/head.js
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/windows/uia/head.js')
-rw-r--r--accessible/tests/browser/windows/uia/head.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/accessible/tests/browser/windows/uia/head.js b/accessible/tests/browser/windows/uia/head.js
index afc50984bd..e659354c7c 100644
--- a/accessible/tests/browser/windows/uia/head.js
+++ b/accessible/tests/browser/windows/uia/head.js
@@ -4,6 +4,8 @@
"use strict";
+/* exported gIsUiaEnabled, addUiaTask */
+
// Load the shared-head file first.
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js",
@@ -16,3 +18,38 @@ loadScripts(
{ name: "common.js", dir: MOCHITESTS_DIR },
{ name: "promisified-events.js", dir: MOCHITESTS_DIR }
);
+
+let gIsUiaEnabled = false;
+
+/**
+ * This is like addAccessibleTask, but takes two additional boolean options:
+ * - uiaEnabled: Whether to run a variation of this test with Gecko UIA enabled.
+ * - uiaDisabled: Whether to run a variation of this test with UIA disabled. In
+ * this case, UIA will rely entirely on the IA2 -> UIA proxy.
+ * If both are set, the test will be run twice with different configurations.
+ * You can determine which variant is currently running using the gIsUiaEnabled
+ * variable. This is useful for conditional tests; e.g. if Gecko UIA supports
+ * something that the IA2 -> UIA proxy doesn't support.
+ */
+function addUiaTask(doc, task, options = {}) {
+ const { uiaEnabled = true, uiaDisabled = true } = options;
+
+ function addTask(shouldEnable) {
+ async function uiaTask(browser, docAcc, topDocAcc) {
+ await SpecialPowers.pushPrefEnv({
+ set: [["accessibility.uia.enable", shouldEnable]],
+ });
+ gIsUiaEnabled = shouldEnable;
+ info(shouldEnable ? "Gecko UIA enabled" : "Gecko UIA disabled");
+ await task(browser, docAcc, topDocAcc);
+ }
+ addAccessibleTask(doc, uiaTask, options);
+ }
+
+ if (uiaEnabled) {
+ addTask(true);
+ }
+ if (uiaDisabled) {
+ addTask(false);
+ }
+}