Bug 587731 TEST-UNEXPECTED-FAIL | test_theme.js | false == true - copy 10 second timeout and extra debug code from test_install.js. r=dtownsend,a=test-only

This commit is contained in:
Mark Banner 2010-08-20 18:54:41 +01:00
Родитель 078db8eb44
Коммит 8d80ac7171
1 изменённых файлов: 16 добавлений и 8 удалений

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

@ -4,6 +4,10 @@
Components.utils.import("resource://gre/modules/NetUtil.jsm");
// The maximum allowable time since install. If an add-on claims to have been
// installed longer ago than this the the test will fail.
const MAX_INSTALL_TIME = 10000;
// This verifies that themes behave as expected
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
@ -277,10 +281,12 @@ function run_test_3() {
do_check_true("findUpdates" in p1);
do_check_eq(p1.installDate.getTime(), p1.updateDate.getTime());
// 5 seconds leeway seems like a lot, but tests can run slow and really if
// this is within 5 seconds it is fine. If it is going to be wrong then it
// is likely to be hours out at least
do_check_true((Date.now() - p1.installDate.getTime()) < 5000);
// Should have been installed sometime in the last few seconds.
let difference = Date.now() - p1.installDate.getTime();
if (difference > MAX_INSTALL_TIME)
do_throw("Add-on was installed " + difference + "ms ago");
else if (difference < 0)
do_throw("Add-on was installed " + difference + "ms in the future");
AddonManager.getAddonsByTypes(["theme"], function(addons) {
let seen = false;
@ -346,10 +352,12 @@ function run_test_4() {
do_check_eq(p2.permissions, AddonManager.PERM_CAN_UNINSTALL);
do_check_eq(p2.installDate.getTime(), p2.updateDate.getTime());
// 5 seconds leeway seems like a lot, but tests can run slow and really if
// this is within 5 seconds it is fine. If it is going to be wrong then it
// is likely to be hours out at least
do_check_true((Date.now() - p2.installDate.getTime()) < 5000);
// Should have been installed sometime in the last few seconds.
let difference = Date.now() - p2.installDate.getTime();
if (difference > MAX_INSTALL_TIME)
do_throw("Add-on was installed " + difference + "ms ago");
else if (difference < 0)
do_throw("Add-on was installed " + difference + "ms in the future");
do_check_neq(null, p1);
do_check_false(p1.appDisabled);