mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1110759 - Remove Iterator() from some tests. r=smaug
This commit is contained in:
parent
31f991c6d5
commit
6714d35a4b
@ -122,16 +122,12 @@ var AccessFuTest = {
|
||||
},
|
||||
|
||||
nextTest: function AccessFuTest_nextTest() {
|
||||
var testFunc;
|
||||
try {
|
||||
// Get the next test function from the iterator. If none left,
|
||||
// StopIteration exception is thrown.
|
||||
testFunc = gIterator.next()[1];
|
||||
} catch (ex) {
|
||||
// StopIteration exception.
|
||||
var result = gIterator.next();
|
||||
if (result.done) {
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
var testFunc = result.value;
|
||||
testFunc();
|
||||
},
|
||||
|
||||
@ -143,7 +139,11 @@ var AccessFuTest = {
|
||||
}
|
||||
|
||||
// Create an Iterator for gTestFuncs array.
|
||||
gIterator = Iterator(gTestFuncs); // jshint ignore:line
|
||||
gIterator = (function*() {
|
||||
for (var testFunc of gTestFuncs) {
|
||||
yield testFunc;
|
||||
}
|
||||
})();
|
||||
|
||||
// Start AccessFu and put it in stand-by.
|
||||
Components.utils.import("resource://gre/modules/accessibility/AccessFu.jsm");
|
||||
|
@ -167,7 +167,13 @@ function runSocialTestWithProvider(manifest, callback, finishcallback) {
|
||||
}
|
||||
|
||||
function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
|
||||
let testIter = Iterator(tests);
|
||||
let testIter = (function*() {
|
||||
for (let name in tests) {
|
||||
if (tests.hasOwnProperty(name)) {
|
||||
yield [name, tests[name]];
|
||||
}
|
||||
}
|
||||
})();
|
||||
let providersAtStart = Social.providers.length;
|
||||
info("runSocialTests: start test run with " + providersAtStart + " providers");
|
||||
window.focus();
|
||||
@ -182,16 +188,15 @@ function runSocialTests(tests, cbPreTest, cbPostTest, cbFinish) {
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let name, func;
|
||||
try {
|
||||
[name, func] = testIter.next();
|
||||
} catch (err if err instanceof StopIteration) {
|
||||
let result = testIter.next();
|
||||
if (result.done) {
|
||||
// out of items:
|
||||
(cbFinish || defaultFinishChecks)();
|
||||
is(providersAtStart, Social.providers.length,
|
||||
"runSocialTests: finish test run with " + Social.providers.length + " providers");
|
||||
return;
|
||||
}
|
||||
let [name, func] = result.value;
|
||||
// We run on a timeout as the frameworker also makes use of timeouts, so
|
||||
// this helps keep the debug messages sane.
|
||||
executeSoon(function() {
|
||||
|
@ -94,21 +94,17 @@ function test() {
|
||||
}
|
||||
|
||||
function runNextSpinTest() {
|
||||
try {
|
||||
var [index, test] = spinTests.next();
|
||||
test();
|
||||
} catch(e) {
|
||||
if (e == StopIteration) {
|
||||
SimpleTest.finish();
|
||||
return; // We're all done
|
||||
}
|
||||
throw e;
|
||||
var test = spinTests.shift();
|
||||
if (!test) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
test();
|
||||
}
|
||||
|
||||
const SETTIMEOUT_DELAY = 500;
|
||||
|
||||
var spinTests = Iterator([
|
||||
var spinTests = [
|
||||
// Test spining when the mouse button is kept depressed on the spin-up
|
||||
// button, then moved over the spin-down button:
|
||||
function() {
|
||||
@ -192,7 +188,7 @@ var spinTests = Iterator([
|
||||
}, false);
|
||||
synthesizeMouse(input, SPIN_DOWN_X, SPIN_DOWN_Y, { type: "mousedown" });
|
||||
}
|
||||
]);
|
||||
];
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -17,12 +17,12 @@
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runNextTest, window);
|
||||
|
||||
const kTests = Iterator([
|
||||
const kTests = [
|
||||
{ type: "text", value: "foo", key: "b", expectedNewValue: "foo" },
|
||||
{ type: "number", value: "123", key: "4", expectedNewValue: "123" },
|
||||
{ type: "number", value: "123", key: KeyEvent.DOM_VK_UP, expectedNewValue: "123" },
|
||||
{ type: "number", value: "123", key: KeyEvent.DOM_VK_DOWN, expectedNewValue: "123" },
|
||||
]);
|
||||
];
|
||||
|
||||
function sendUntrustedKeyEvent(eventType, keyCode, target) {
|
||||
var evt = document.createEvent("KeyboardEvent");
|
||||
@ -70,14 +70,11 @@ function runNextTest() {
|
||||
gotEvents.keyup = false;
|
||||
gotEvents.keypress = false;
|
||||
|
||||
try {
|
||||
var [index, test] = kTests.next();
|
||||
} catch(e) {
|
||||
if (e == StopIteration) {
|
||||
SimpleTest.finish();
|
||||
return; // We're all done
|
||||
}
|
||||
throw e;
|
||||
|
||||
var test = kTests.shift();
|
||||
if (!test) {
|
||||
SimpleTest.finish();
|
||||
return; // We're all done
|
||||
}
|
||||
|
||||
input.type = test.type;
|
||||
|
@ -13,7 +13,13 @@ let SocialService = Components.utils.import("resource://gre/modules/SocialServic
|
||||
// foo: function(cbnext) {... cbnext();}
|
||||
// }
|
||||
function runTests(tests, cbPreTest, cbPostTest, cbFinish) {
|
||||
let testIter = Iterator(tests);
|
||||
let testIter = (function*() {
|
||||
for (let name in tests) {
|
||||
if (tests.hasOwnProperty(name)) {
|
||||
yield [name, tests[name]];
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
if (cbPreTest === undefined) {
|
||||
cbPreTest = function(cb) {cb()};
|
||||
@ -23,14 +29,13 @@ function runTests(tests, cbPreTest, cbPostTest, cbFinish) {
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let name, func;
|
||||
try {
|
||||
[name, func] = testIter.next();
|
||||
} catch (err if err instanceof StopIteration) {
|
||||
let result = testIter.next();
|
||||
if (result.done) {
|
||||
// out of items:
|
||||
(cbFinish || finish)();
|
||||
return;
|
||||
}
|
||||
let [name, func] = result.value;
|
||||
// We run on a timeout as the frameworker also makes use of timeouts, so
|
||||
// this helps keep the debug messages sane.
|
||||
executeSoon(function() {
|
||||
|
@ -329,18 +329,15 @@ var tests = [
|
||||
]
|
||||
|
||||
function runTests() {
|
||||
var testIter = Iterator(tests);
|
||||
function runNextTest() {
|
||||
let name, anchorPos, test;
|
||||
try {
|
||||
let index;
|
||||
[index, [name, anchorPos, test]] = testIter.next();
|
||||
} catch (err if err instanceof StopIteration) {
|
||||
let result = tests.shift();
|
||||
if (!result) {
|
||||
// out of tests
|
||||
panel.hidePopup();
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
let [name, anchorPos, test] = result;
|
||||
SimpleTest.info("sub-test " + anchorPos + "." + name + " starting");
|
||||
// first arrange for the anchor to be where the test requires it.
|
||||
panel.hidePopup();
|
||||
|
Loading…
Reference in New Issue
Block a user