Bug 650965 - Test for removal of node using waitForAndContinue. r=mfinkle

This commit is contained in:
Wes Johnston 2011-04-26 15:23:18 -07:00
Родитель a4f0d95631
Коммит 11c490eb56
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -372,14 +372,15 @@ function installFromURLBar(aAddon) {
is(updateButton.disabled, false, "Update button is enabled");
ExtensionsView.uninstall(elt);
setTimeout(function() {
elt = get_addon_element(aAddon.id);
ok(!elt || !elt.addon, "Addon element removed during uninstall");
if (elt && !elt.addon)
info("Element is still visible in search area");
waitForAndContinue(function() {
let elt = get_addon_element(aAddon.id);
ok(!elt, "Addon element removed during uninstall");
Browser.closeTab(gCurrentTab);
close_manager(run_next_test);
}, 0);
}, function() {
let elt = get_addon_element(aAddon.id);
return !elt;
});
} else {
ok(!elt, "Extension not in list");
AddonManager.getAllInstalls(function(aInstalls) {

Просмотреть файл

@ -2,6 +2,7 @@
Common Helpers functions
=============================================================================*/
const kDefaultWait = 2000;
// Wait for a condition and call a supplied callback if condition is met within
// alloted time. If condition is not met, cause a hard failure, stopping the test.
function waitFor(callback, test, timeout) {
@ -11,7 +12,7 @@ function waitFor(callback, test, timeout) {
}
timeout = timeout || Date.now();
if (Date.now() - timeout > 1000)
if (Date.now() - timeout > kDefaultWait)
throw "waitFor timeout";
setTimeout(waitFor, 50, callback, test, timeout);
};
@ -26,7 +27,7 @@ function waitForAndContinue(callback, test, timeout) {
}
timeout = timeout || Date.now();
if (Date.now() - timeout > 1000) {
if (Date.now() - timeout > kDefaultWait) {
callback();
return;
}