mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 01:57:00 +00:00
Bug 572955: Add some logging and cleanup and extend timeouts in browser_installssl.js and browser_updatessl.js to avoid random oranges. r=robstrong
This commit is contained in:
parent
61ea999ea5
commit
6b7fd2fcab
@ -7,10 +7,27 @@ const redirect = RELATIVE_DIR + "redirect.sjs?";
|
||||
const SUCCESS = 0;
|
||||
|
||||
var gTests = [];
|
||||
var gStart = 0;
|
||||
var gLast = 0;
|
||||
var gPendingInstall = null;
|
||||
|
||||
function test() {
|
||||
gStart = Date.now();
|
||||
requestLongerTimeout(2);
|
||||
waitForExplicitFinish();
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
if (gPendingInstall) {
|
||||
gTests = [];
|
||||
ok(false, "Timed out in the middle of downloading " + gPendingInstall.sourceURL);
|
||||
try {
|
||||
gPendingInstall.cancel();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
@ -22,6 +39,7 @@ function end_test() {
|
||||
cos.clearValidityOverride("untrusted.example.com", -1);
|
||||
cos.clearValidityOverride("expired.example.com", -1);
|
||||
|
||||
info("All tests completed in " + (Date.now() - gStart) + "ms");
|
||||
finish();
|
||||
}
|
||||
|
||||
@ -35,20 +53,26 @@ function run_install_tests(callback) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
gLast = Date.now();
|
||||
|
||||
let [url, expectedStatus, message] = gTests.shift();
|
||||
AddonManager.getInstallForURL(url, function(install) {
|
||||
gPendingInstall = install;
|
||||
install.addListener({
|
||||
onDownloadEnded: function(install) {
|
||||
is(SUCCESS, expectedStatus, message);
|
||||
run_next_install_test();
|
||||
info("Install test ran in " + (Date.now() - gLast) + "ms");
|
||||
// Don't proceed with the install
|
||||
install.cancel();
|
||||
gPendingInstall = null;
|
||||
run_next_install_test();
|
||||
return false;
|
||||
},
|
||||
|
||||
onDownloadFailed: function(install) {
|
||||
is(install.error, expectedStatus, message);
|
||||
info("Install test ran in " + (Date.now() - gLast) + "ms");
|
||||
gPendingInstall = null;
|
||||
run_next_install_test();
|
||||
}
|
||||
});
|
||||
|
@ -9,8 +9,12 @@ const redirect = RELATIVE_DIR + "redirect.sjs?";
|
||||
const SUCCESS = 0;
|
||||
|
||||
var gTests = [];
|
||||
var gStart = 0;
|
||||
var gLast = 0;
|
||||
|
||||
function test() {
|
||||
gStart = Date.now();
|
||||
requestLongerTimeout(2);
|
||||
waitForExplicitFinish();
|
||||
|
||||
run_next_test();
|
||||
@ -24,6 +28,7 @@ function end_test() {
|
||||
cos.clearValidityOverride("untrusted.example.com", -1);
|
||||
cos.clearValidityOverride("expired.example.com", -1);
|
||||
|
||||
info("All tests completed in " + (Date.now() - gStart) + "ms");
|
||||
finish();
|
||||
}
|
||||
|
||||
@ -37,6 +42,7 @@ function run_update_tests(callback) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
gLast = Date.now();
|
||||
|
||||
let [url, expectedStatus, message] = gTests.shift();
|
||||
AddonUpdateChecker.checkForUpdates("addon1@tests.mozilla.org", "extension",
|
||||
@ -44,11 +50,13 @@ function run_update_tests(callback) {
|
||||
onUpdateCheckComplete: function(updates) {
|
||||
is(updates.length, 1);
|
||||
is(SUCCESS, expectedStatus, message);
|
||||
info("Update test ran in " + (Date.now() - gLast) + "ms");
|
||||
run_next_update_test();
|
||||
},
|
||||
|
||||
onUpdateCheckError: function(status) {
|
||||
is(status, expectedStatus, message);
|
||||
info("Update test ran in " + (Date.now() - gLast) + "ms");
|
||||
run_next_update_test();
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user