mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1138426 - convert accessibility setIntPref to pushPrefEnv, r=yzen
MozReview-Commit-ID: 2GKJXzkABQD --HG-- extra : rebase_source : 9cfb2131754cbdf3650b05369ef1341b265a0cd2
This commit is contained in:
parent
4c300de472
commit
5a701933c4
@ -18,7 +18,7 @@
|
||||
ok(AccessFu._enabled, "AccessFu was enabled again."));
|
||||
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
|
||||
// Start AccessFu via pref.
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 1);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]});
|
||||
}
|
||||
|
||||
// Listen for 'EventManager.stop' and enable AccessFu again.
|
||||
@ -54,7 +54,7 @@
|
||||
isnot(AccessFu._enabled, true, "AccessFu was disabled."));
|
||||
AccessFuTest.once_log("EventManager.stop", AccessFuTest.nextTest);
|
||||
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 0);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]});
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
|
@ -186,8 +186,7 @@
|
||||
new ExpectedTextSelectionChanged(0, 0)
|
||||
],
|
||||
[function() {
|
||||
SpecialPowers.setIntPref(KEYBOARD_ECHO_SETTING, 3);
|
||||
typeKey('a')();
|
||||
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 3]]}, typeKey('a')());
|
||||
},
|
||||
new ExpectedTextChanged('a'),
|
||||
new ExpectedTextSelectionChanged(1, 1),
|
||||
@ -213,8 +212,7 @@
|
||||
new ExpectedTextSelectionChanged(6, 6),
|
||||
],
|
||||
[function() {
|
||||
SpecialPowers.setIntPref(KEYBOARD_ECHO_SETTING, 2);
|
||||
typeKey('a')();
|
||||
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 2]]}, typeKey('a')());
|
||||
},
|
||||
new ExpectedTextChanged(''),
|
||||
new ExpectedTextSelectionChanged(7, 7),
|
||||
@ -228,8 +226,7 @@
|
||||
new ExpectedTextSelectionChanged(9, 9),
|
||||
],
|
||||
[function() {
|
||||
SpecialPowers.setIntPref(KEYBOARD_ECHO_SETTING, 1);
|
||||
typeKey('f')();
|
||||
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 1]]}, typeKey('f')());
|
||||
},
|
||||
new ExpectedTextChanged('f'),
|
||||
new ExpectedTextSelectionChanged(10, 10),
|
||||
@ -243,8 +240,7 @@
|
||||
new ExpectedTextSelectionChanged(12, 12),
|
||||
],
|
||||
[function() {
|
||||
SpecialPowers.setIntPref(KEYBOARD_ECHO_SETTING, 0);
|
||||
typeKey('f')();
|
||||
SpecialPowers.pushPrefEnv({"set": [[KEYBOARD_ECHO_SETTING, 0]]}, typeKey('f')());
|
||||
},
|
||||
new ExpectedTextChanged(''),
|
||||
new ExpectedTextSelectionChanged(13, 13),
|
||||
|
@ -111,15 +111,13 @@
|
||||
{"string": "link"}, "Plums"]
|
||||
}];
|
||||
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
|
||||
|
||||
// Test various explicit names vs the utterance generated from subtrees.
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expected, test.accOrElmOrID, test.oldAccOrElmOrID, 1);
|
||||
SpecialPowers.pushPrefEnv({"set": [[PREF_UTTERANCE_ORDER, 0]]}, function() {
|
||||
// Test various explicit names vs the utterance generated from subtrees.
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expected, test.accOrElmOrID, test.oldAccOrElmOrID, 1);
|
||||
});
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -10,6 +10,8 @@
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="output.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="jsatcommon.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
@ -117,20 +119,26 @@
|
||||
}];
|
||||
|
||||
// Test outputs (utterance and braille) for landmarks.
|
||||
tests.forEach(function run(test) {
|
||||
var outputOrderValues = [0, 1];
|
||||
outputOrderValues.forEach(function testOutputOrder(outputOrder) {
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
|
||||
testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
});
|
||||
function testOutputOrder(aOutputOrder) {
|
||||
return function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
|
||||
}, function() {
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
AccessFuTest.nextTest();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// If there was an original utterance order preference, revert to it.
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
AccessFuTest.addFunc(testOutputOrder(0));
|
||||
AccessFuTest.addFunc(testOutputOrder(1));
|
||||
AccessFuTest.waitForExplicitFinish();
|
||||
AccessFuTest.runTests();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -14,12 +14,12 @@
|
||||
<script type="application/javascript">
|
||||
|
||||
function startAccessFu() {
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 1);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]});
|
||||
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
|
||||
}
|
||||
|
||||
function stopAccessFu() {
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 0);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]});
|
||||
AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish());
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="./output.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="./jsatcommon.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
@ -506,22 +508,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
}];
|
||||
|
||||
// Test all possible utterance order preference values.
|
||||
tests.forEach(function run(test) {
|
||||
var utteranceOrderValues = [0, 1];
|
||||
utteranceOrderValues.forEach(
|
||||
function testUtteranceOrder(utteranceOrder) {
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, utteranceOrder);
|
||||
testOutput(test.expectedUtterance[utteranceOrder],
|
||||
test.accOrElmOrID, test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[utteranceOrder],
|
||||
test.accOrElmOrID, test.oldAccOrElmOrID, 0);
|
||||
}
|
||||
);
|
||||
});
|
||||
function testOutputOrder(aOutputOrder) {
|
||||
return function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
|
||||
}, function() {
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
AccessFuTest.nextTest();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// If there was an original utterance order preference, revert to it.
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
AccessFuTest.addFunc(testOutputOrder(0));
|
||||
AccessFuTest.addFunc(testOutputOrder(1));
|
||||
AccessFuTest.waitForExplicitFinish();
|
||||
AccessFuTest.runTests();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -10,6 +10,8 @@
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="output.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="jsatcommon.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
@ -167,20 +169,26 @@
|
||||
}];
|
||||
|
||||
// Test all possible utterance order preference values.
|
||||
tests.forEach(function run(test) {
|
||||
var outputOrderValues = [0, 1];
|
||||
outputOrderValues.forEach(function testOutputOrder(outputOrder) {
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
|
||||
testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
});
|
||||
function testOutputOrder(aOutputOrder) {
|
||||
return function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
|
||||
}, function() {
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
AccessFuTest.nextTest();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// If there was an original utterance order preference, revert to it.
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
AccessFuTest.addFunc(testOutputOrder(0));
|
||||
AccessFuTest.addFunc(testOutputOrder(1));
|
||||
AccessFuTest.waitForExplicitFinish();
|
||||
AccessFuTest.runTests();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
function prefStart() {
|
||||
// Start AccessFu via pref.
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 1);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 1]]});
|
||||
AccessFuTest.once_log("EventManager.start", AccessFuTest.nextTest);
|
||||
}
|
||||
|
||||
@ -39,18 +39,22 @@
|
||||
|
||||
function setMode(aModeIndex, aExpectedMode) {
|
||||
return function() {
|
||||
SpecialPowers.setIntPref(
|
||||
'accessibility.accessfu.quicknav_index', aModeIndex);
|
||||
_expectMode(aExpectedMode, AccessFuTest.nextTest);
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{"set": [['accessibility.accessfu.quicknav_index', aModeIndex]]},
|
||||
function() {
|
||||
_expectMode(aExpectedMode, AccessFuTest.nextTest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function reconfigureModes() {
|
||||
SpecialPowers.setCharPref('accessibility.accessfu.quicknav_modes',
|
||||
'Landmark,Button,Entry,Graphic');
|
||||
// When the modes are reconfigured, the current mode should
|
||||
// be set to the first in the new list.
|
||||
_expectMode('Landmark', AccessFuTest.nextTest);
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{"set": [['accessibility.accessfu.quicknav_modes', 'Landmark,Button,Entry,Graphic']]},
|
||||
function() {
|
||||
// When the modes are reconfigured, the current mode should
|
||||
// be set to the first in the new list.
|
||||
_expectMode('Landmark', AccessFuTest.nextTest);
|
||||
});
|
||||
}
|
||||
|
||||
function _expectMode(aExpectedMode, aCallback) {
|
||||
@ -69,7 +73,7 @@
|
||||
function prefStop() {
|
||||
ok(AccessFu._enabled, "AccessFu was started via preference.");
|
||||
AccessFuTest.once_log("EventManager.stop", () => AccessFuTest.finish());
|
||||
SpecialPowers.setIntPref("accessibility.accessfu.activate", 0);
|
||||
SpecialPowers.pushPrefEnv({"set": [['accessibility.accessfu.activate', 0]]});
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
|
@ -10,6 +10,8 @@
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="output.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="jsatcommon.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
@ -472,24 +474,28 @@
|
||||
["cell3", {"string": "cellInfoAbbr", "args": [2, 3]}, "col2", "row2"]]
|
||||
}];
|
||||
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
|
||||
|
||||
// Test outputs (utterance and braille) for tables including their
|
||||
// headers and cells.
|
||||
tests.forEach(function run(test) {
|
||||
var outputOrderValues = [0, 1];
|
||||
outputOrderValues.forEach(function testOutputOrder(outputOrder) {
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
|
||||
testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
});
|
||||
function testOutputOrder(aOutputOrder) {
|
||||
return function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
|
||||
}, function() {
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
AccessFuTest.nextTest();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// If there was an original utterance order preference, revert to it.
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
AccessFuTest.addFunc(testOutputOrder(0));
|
||||
AccessFuTest.addFunc(testOutputOrder(1));
|
||||
AccessFuTest.waitForExplicitFinish();
|
||||
AccessFuTest.runTests();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
Loading…
Reference in New Issue
Block a user