Bug 435743: Refactor SSL tests to me more readable. r=robstrong

This commit is contained in:
Dave Townsend 2010-09-07 12:13:00 -07:00
parent 1a21b14aac
commit 17774372e2
2 changed files with 220 additions and 512 deletions

View File

@ -5,6 +5,14 @@
const xpi = RELATIVE_DIR + "addons/browser_installssl.xpi";
const redirect = RELATIVE_DIR + "redirect.sjs?";
const SUCCESS = 0;
const NETWORK_FAILURE = AddonManager.ERROR_NETWORK_FAILURE;
const HTTP = "http://example.com/";
const HTTPS = "https://example.com/";
const NOCERT = "https://nocert.example.com/";
const SELFSIGNED = "https://self-signed.example.com/";
const UNTRUSTED = "https://untrusted.example.com/";
const EXPIRED = "https://expired.example.com/";
var gTests = [];
var gStart = 0;
@ -43,8 +51,8 @@ function end_test() {
finish();
}
function add_install_test(url, expectedStatus, message) {
gTests.push([url, expectedStatus, message]);
function add_install_test(mainURL, redirectURL, expectedStatus) {
gTests.push([mainURL, redirectURL, expectedStatus]);
}
function run_install_tests(callback) {
@ -55,7 +63,18 @@ function run_install_tests(callback) {
}
gLast = Date.now();
let [url, expectedStatus, message] = gTests.shift();
let [mainURL, redirectURL, expectedStatus] = gTests.shift();
if (redirectURL) {
var url = mainURL + redirect + redirectURL + xpi;
var message = "Should have seen the right result for an install redirected from " +
mainURL + " to " + redirectURL;
}
else {
url = mainURL + xpi;
message = "Should have seen the right result for an install from " +
mainURL;
}
AddonManager.getInstallForURL(url, function(install) {
gPendingInstall = install;
install.addListener({
@ -91,292 +110,128 @@ function addCertOverrides() {
addCertOverride("expired.example.com", Ci.nsICertOverrideService.ERROR_TIME);
}
// Runs tests with built-in certificates required, no certificate exceptions
// and no hashes
add_test(function() {
// Tests that a simple update.rdf retrieval works as expected.
add_install_test("http://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http install url");
add_install_test("https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https install url from a non built-in CA");
add_install_test("https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for nocert https install url");
add_install_test("https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for self-signed https install url");
add_install_test("https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for untrusted https install url");
add_install_test("https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for expired https install url");
// Tests that a simple install works as expected.
add_install_test(HTTP, null, SUCCESS);
add_install_test(HTTPS, null, NETWORK_FAILURE);
add_install_test(NOCERT, null, NETWORK_FAILURE);
add_install_test(SELFSIGNED, null, NETWORK_FAILURE);
add_install_test(UNTRUSTED, null, NETWORK_FAILURE);
add_install_test(EXPIRED, null, NETWORK_FAILURE);
// Tests that redirecting from http to other servers works as expected
add_install_test("http://example.com/" + redirect + "http://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to http redirect");
add_install_test("http://example.com/" + redirect + "https://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to https redirect for a non built-in CA");
add_install_test("http://example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a http to nocert https redirect");
add_install_test("http://example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a http to self-signed https redirect");
add_install_test("http://example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a http to untrusted https install url");
add_install_test("http://example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a http to expired https install url");
add_install_test(HTTP, HTTP, SUCCESS);
add_install_test(HTTP, HTTPS, SUCCESS);
add_install_test(HTTP, NOCERT, NETWORK_FAILURE);
add_install_test(HTTP, SELFSIGNED, NETWORK_FAILURE);
add_install_test(HTTP, UNTRUSTED, NETWORK_FAILURE);
add_install_test(HTTP, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from valid https to other servers works as expected
add_install_test("https://example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to http redirect");
add_install_test("https://example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to https redirect for a non built-in CA");
add_install_test("https://example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to nocert https redirect");
add_install_test("https://example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to self-signed https redirect");
add_install_test("https://example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to untrusted https redirect");
add_install_test("https://example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to expired https redirect");
add_install_test(HTTPS, HTTP, NETWORK_FAILURE);
add_install_test(HTTPS, HTTPS, NETWORK_FAILURE);
add_install_test(HTTPS, NOCERT, NETWORK_FAILURE);
add_install_test(HTTPS, SELFSIGNED, NETWORK_FAILURE);
add_install_test(HTTPS, UNTRUSTED, NETWORK_FAILURE);
add_install_test(HTTPS, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from nocert https to other servers works as expected
add_install_test("https://nocert.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to http redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to nocert https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to self-signed https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to untrusted https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to expired https redirect");
add_install_test(NOCERT, HTTP, NETWORK_FAILURE);
add_install_test(NOCERT, HTTPS, NETWORK_FAILURE);
add_install_test(NOCERT, NOCERT, NETWORK_FAILURE);
add_install_test(NOCERT, SELFSIGNED, NETWORK_FAILURE);
add_install_test(NOCERT, UNTRUSTED, NETWORK_FAILURE);
add_install_test(NOCERT, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from self-signed https to other servers works as expected
add_install_test("https://self-signed.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to http redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to nocert https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to self-signed https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to untrusted https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to expired https redirect");
add_install_test(SELFSIGNED, HTTP, NETWORK_FAILURE);
add_install_test(SELFSIGNED, HTTPS, NETWORK_FAILURE);
add_install_test(SELFSIGNED, NOCERT, NETWORK_FAILURE);
add_install_test(SELFSIGNED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(SELFSIGNED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(SELFSIGNED, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from untrusted https to other servers works as expected
add_install_test("https://untrusted.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to http redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to nocert https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to self-signed https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to untrusted https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to expired https redirect");
add_install_test(UNTRUSTED, HTTP, NETWORK_FAILURE);
add_install_test(UNTRUSTED, HTTPS, NETWORK_FAILURE);
add_install_test(UNTRUSTED, NOCERT, NETWORK_FAILURE);
add_install_test(UNTRUSTED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(UNTRUSTED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(UNTRUSTED, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from expired https to other servers works as expected
add_install_test("https://expired.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to http redirect");
add_install_test("https://expired.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to nocert https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to self-signed https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to untrusted https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to expired https redirect");
add_install_test(EXPIRED, HTTP, NETWORK_FAILURE);
add_install_test(EXPIRED, HTTPS, NETWORK_FAILURE);
add_install_test(EXPIRED, NOCERT, NETWORK_FAILURE);
add_install_test(EXPIRED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(EXPIRED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(EXPIRED, EXPIRED, NETWORK_FAILURE);
run_install_tests(run_next_test);
});
// Runs tests with built-in certificates required, all certificate exceptions
// and no hashes
add_test(function() {
addCertOverrides();
// Tests that a simple update.rdf retrieval works as expected.
add_install_test("http://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http install url");
add_install_test("https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https install url from a non built-in CA");
add_install_test("https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for nocert https install url");
add_install_test("https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for self-signed https install url");
add_install_test("https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for untrusted https install url");
add_install_test("https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for expired https install url");
// Tests that a simple install works as expected.
add_install_test(HTTP, null, SUCCESS);
add_install_test(HTTPS, null, NETWORK_FAILURE);
add_install_test(NOCERT, null, NETWORK_FAILURE);
add_install_test(SELFSIGNED, null, NETWORK_FAILURE);
add_install_test(UNTRUSTED, null, NETWORK_FAILURE);
add_install_test(EXPIRED, null, NETWORK_FAILURE);
// Tests that redirecting from http to other servers works as expected
add_install_test("http://example.com/" + redirect + "http://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to http redirect");
add_install_test("http://example.com/" + redirect + "https://example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to https redirect for a non built-in CA");
add_install_test("http://example.com/" + redirect + "https://nocert.example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to nocert https redirect");
add_install_test("http://example.com/" + redirect + "https://self-signed.example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to self-signed https redirect");
add_install_test("http://example.com/" + redirect + "https://untrusted.example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to untrusted https install url");
add_install_test("http://example.com/" + redirect + "https://expired.example.com/" + xpi,
SUCCESS,
"Should have seen no failure for a http to expired https install url");
add_install_test(HTTP, HTTP, SUCCESS);
add_install_test(HTTP, HTTPS, SUCCESS);
add_install_test(HTTP, NOCERT, SUCCESS);
add_install_test(HTTP, SELFSIGNED, SUCCESS);
add_install_test(HTTP, UNTRUSTED, SUCCESS);
add_install_test(HTTP, EXPIRED, SUCCESS);
// Tests that redirecting from valid https to other servers works as expected
add_install_test("https://example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to http redirect");
add_install_test("https://example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to https redirect for a non built-in CA");
add_install_test("https://example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to nocert https redirect");
add_install_test("https://example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to self-signed https redirect");
add_install_test("https://example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to untrusted https redirect");
add_install_test("https://example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a https to expired https redirect");
add_install_test(HTTPS, HTTP, NETWORK_FAILURE);
add_install_test(HTTPS, HTTPS, NETWORK_FAILURE);
add_install_test(HTTPS, NOCERT, NETWORK_FAILURE);
add_install_test(HTTPS, SELFSIGNED, NETWORK_FAILURE);
add_install_test(HTTPS, UNTRUSTED, NETWORK_FAILURE);
add_install_test(HTTPS, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from nocert https to other servers works as expected
add_install_test("https://nocert.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to http redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to nocert https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to self-signed https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to untrusted https redirect");
add_install_test("https://nocert.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a nocert https to expired https redirect");
add_install_test(NOCERT, HTTP, NETWORK_FAILURE);
add_install_test(NOCERT, HTTPS, NETWORK_FAILURE);
add_install_test(NOCERT, NOCERT, NETWORK_FAILURE);
add_install_test(NOCERT, SELFSIGNED, NETWORK_FAILURE);
add_install_test(NOCERT, UNTRUSTED, NETWORK_FAILURE);
add_install_test(NOCERT, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from self-signed https to other servers works as expected
add_install_test("https://self-signed.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to http redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to nocert https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to self-signed https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to untrusted https redirect");
add_install_test("https://self-signed.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a self-signed https to expired https redirect");
add_install_test(SELFSIGNED, HTTP, NETWORK_FAILURE);
add_install_test(SELFSIGNED, HTTPS, NETWORK_FAILURE);
add_install_test(SELFSIGNED, NOCERT, NETWORK_FAILURE);
add_install_test(SELFSIGNED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(SELFSIGNED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(SELFSIGNED, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from untrusted https to other servers works as expected
add_install_test("https://untrusted.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to http redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to nocert https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to self-signed https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to untrusted https redirect");
add_install_test("https://untrusted.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a untrusted https to expired https redirect");
add_install_test(UNTRUSTED, HTTP, NETWORK_FAILURE);
add_install_test(UNTRUSTED, HTTPS, NETWORK_FAILURE);
add_install_test(UNTRUSTED, NOCERT, NETWORK_FAILURE);
add_install_test(UNTRUSTED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(UNTRUSTED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(UNTRUSTED, EXPIRED, NETWORK_FAILURE);
// Tests that redirecting from expired https to other servers works as expected
add_install_test("https://expired.example.com/" + redirect + "http://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to http redirect");
add_install_test("https://expired.example.com/" + redirect + "https://example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://nocert.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to nocert https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://self-signed.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to self-signed https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://untrusted.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to untrusted https redirect");
add_install_test("https://expired.example.com/" + redirect + "https://expired.example.com/" + xpi,
AddonManager.ERROR_NETWORK_FAILURE,
"Should have seen a failure for a expired https to expired https redirect");
add_install_test(EXPIRED, HTTP, NETWORK_FAILURE);
add_install_test(EXPIRED, HTTPS, NETWORK_FAILURE);
add_install_test(EXPIRED, NOCERT, NETWORK_FAILURE);
add_install_test(EXPIRED, SELFSIGNED, NETWORK_FAILURE);
add_install_test(EXPIRED, UNTRUSTED, NETWORK_FAILURE);
add_install_test(EXPIRED, EXPIRED, NETWORK_FAILURE);
run_install_tests(run_next_test);
});

View File

@ -7,6 +7,14 @@ Components.utils.import("resource://gre/modules/AddonUpdateChecker.jsm");
const updaterdf = RELATIVE_DIR + "browser_updatessl.rdf";
const redirect = RELATIVE_DIR + "redirect.sjs?";
const SUCCESS = 0;
const DOWNLOAD_ERROR = AddonUpdateChecker.ERROR_DOWNLOAD_ERROR;
const HTTP = "http://example.com/";
const HTTPS = "https://example.com/";
const NOCERT = "https://nocert.example.com/";
const SELFSIGNED = "https://self-signed.example.com/";
const UNTRUSTED = "https://untrusted.example.com/";
const EXPIRED = "https://expired.example.com/";
var gTests = [];
var gStart = 0;
@ -32,8 +40,8 @@ function end_test() {
finish();
}
function add_update_test(url, expectedStatus, message) {
gTests.push([url, expectedStatus, message]);
function add_update_test(mainURL, redirectURL, expectedStatus) {
gTests.push([mainURL, redirectURL, expectedStatus]);
}
function run_update_tests(callback) {
@ -44,7 +52,18 @@ function run_update_tests(callback) {
}
gLast = Date.now();
let [url, expectedStatus, message] = gTests.shift();
let [mainURL, redirectURL, expectedStatus] = gTests.shift();
if (redirectURL) {
var url = mainURL + redirect + redirectURL + updaterdf;
var message = "Should have seen the right result for an update check redirected from " +
mainURL + " to " + redirectURL;
}
else {
url = mainURL + updaterdf;
message = "Should have seen the right result for an update check from " +
mainURL;
}
AddonUpdateChecker.checkForUpdates("addon1@tests.mozilla.org", "extension",
null, url, {
onUpdateCheckComplete: function(updates) {
@ -73,292 +92,126 @@ function addCertOverrides() {
addCertOverride("expired.example.com", Ci.nsICertOverrideService.ERROR_TIME);
}
// Runs tests with built-in certificates required and no certificate exceptions.
add_test(function() {
// Tests that a simple update.rdf retrieval works as expected.
add_update_test("http://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http update url");
add_update_test("https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https update url from a non built-in CA");
add_update_test("https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for nocert https update url");
add_update_test("https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for self-signed https update url");
add_update_test("https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for untrusted https update url");
add_update_test("https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for expired https update url");
add_update_test(HTTP, null, SUCCESS);
add_update_test(HTTPS, null, DOWNLOAD_ERROR);
add_update_test(NOCERT, null, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, null, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, null, DOWNLOAD_ERROR);
add_update_test(EXPIRED, null, DOWNLOAD_ERROR);
// Tests that redirecting from http to other servers works as expected
add_update_test("http://example.com/" + redirect + "http://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to http redirect");
add_update_test("http://example.com/" + redirect + "https://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to https redirect for a non built-in CA");
add_update_test("http://example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a http to nocert https redirect");
add_update_test("http://example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a http to self-signed https redirect");
add_update_test("http://example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a http to untrusted https update url");
add_update_test("http://example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a http to expired https update url");
add_update_test(HTTP, HTTP, SUCCESS);
add_update_test(HTTP, HTTPS, SUCCESS);
add_update_test(HTTP, NOCERT, DOWNLOAD_ERROR);
add_update_test(HTTP, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(HTTP, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(HTTP, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from valid https to other servers works as expected
add_update_test("https://example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to http redirect");
add_update_test("https://example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to https redirect for a non built-in CA");
add_update_test("https://example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to nocert https redirect");
add_update_test("https://example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to self-signed https redirect");
add_update_test("https://example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to untrusted https redirect");
add_update_test("https://example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to expired https redirect");
add_update_test(HTTPS, HTTP, DOWNLOAD_ERROR);
add_update_test(HTTPS, HTTPS, DOWNLOAD_ERROR);
add_update_test(HTTPS, NOCERT, DOWNLOAD_ERROR);
add_update_test(HTTPS, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(HTTPS, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(HTTPS, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from nocert https to other servers works as expected
add_update_test("https://nocert.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to http redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to nocert https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to self-signed https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to untrusted https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to expired https redirect");
add_update_test(NOCERT, HTTP, DOWNLOAD_ERROR);
add_update_test(NOCERT, HTTPS, DOWNLOAD_ERROR);
add_update_test(NOCERT, NOCERT, DOWNLOAD_ERROR);
add_update_test(NOCERT, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(NOCERT, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(NOCERT, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from self-signed https to other servers works as expected
add_update_test("https://self-signed.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to http redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to nocert https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to self-signed https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to untrusted https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to expired https redirect");
add_update_test(SELFSIGNED, HTTP, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, HTTPS, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, NOCERT, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from untrusted https to other servers works as expected
add_update_test("https://untrusted.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to http redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to nocert https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to self-signed https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to untrusted https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to expired https redirect");
add_update_test(UNTRUSTED, HTTP, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, HTTPS, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, NOCERT, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from expired https to other servers works as expected
add_update_test("https://expired.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to http redirect");
add_update_test("https://expired.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to nocert https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to self-signed https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to untrusted https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to expired https redirect");
add_update_test(EXPIRED, HTTP, DOWNLOAD_ERROR);
add_update_test(EXPIRED, HTTPS, DOWNLOAD_ERROR);
add_update_test(EXPIRED, NOCERT, DOWNLOAD_ERROR);
add_update_test(EXPIRED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(EXPIRED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(EXPIRED, EXPIRED, DOWNLOAD_ERROR);
run_update_tests(run_next_test);
});
// Runs tests with built-in certificates required and all certificate exceptions.
add_test(function() {
addCertOverrides();
// Tests that a simple update.rdf retrieval works as expected.
add_update_test("http://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http update url");
add_update_test("https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https update url from a non built-in CA");
add_update_test("https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for nocert https update url");
add_update_test("https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for self-signed https update url");
add_update_test("https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for untrusted https update url");
add_update_test("https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for expired https update url");
add_update_test(HTTP, null, SUCCESS);
add_update_test(HTTPS, null, DOWNLOAD_ERROR);
add_update_test(NOCERT, null, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, null, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, null, DOWNLOAD_ERROR);
add_update_test(EXPIRED, null, DOWNLOAD_ERROR);
// Tests that redirecting from http to other servers works as expected
add_update_test("http://example.com/" + redirect + "http://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to http redirect");
add_update_test("http://example.com/" + redirect + "https://example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to https redirect for a non built-in CA");
add_update_test("http://example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to nocert https redirect");
add_update_test("http://example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to self-signed https redirect");
add_update_test("http://example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to untrusted https update url");
add_update_test("http://example.com/" + redirect + "https://expired.example.com/" + updaterdf,
SUCCESS,
"Should have seen no failure for a http to expired https update url");
add_update_test(HTTP, HTTP, SUCCESS);
add_update_test(HTTP, HTTPS, SUCCESS);
add_update_test(HTTP, NOCERT, SUCCESS);
add_update_test(HTTP, SELFSIGNED, SUCCESS);
add_update_test(HTTP, UNTRUSTED, SUCCESS);
add_update_test(HTTP, EXPIRED, SUCCESS);
// Tests that redirecting from valid https to other servers works as expected
add_update_test("https://example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to http redirect");
add_update_test("https://example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to https redirect for a non built-in CA");
add_update_test("https://example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to nocert https redirect");
add_update_test("https://example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to self-signed https redirect");
add_update_test("https://example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to untrusted https redirect");
add_update_test("https://example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a https to expired https redirect");
add_update_test(HTTPS, HTTP, DOWNLOAD_ERROR);
add_update_test(HTTPS, HTTPS, DOWNLOAD_ERROR);
add_update_test(HTTPS, NOCERT, DOWNLOAD_ERROR);
add_update_test(HTTPS, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(HTTPS, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(HTTPS, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from nocert https to other servers works as expected
add_update_test("https://nocert.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to http redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to nocert https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to self-signed https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to untrusted https redirect");
add_update_test("https://nocert.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a nocert https to expired https redirect");
add_update_test(NOCERT, HTTP, DOWNLOAD_ERROR);
add_update_test(NOCERT, HTTPS, DOWNLOAD_ERROR);
add_update_test(NOCERT, NOCERT, DOWNLOAD_ERROR);
add_update_test(NOCERT, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(NOCERT, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(NOCERT, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from self-signed https to other servers works as expected
add_update_test("https://self-signed.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to http redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to nocert https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to self-signed https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to untrusted https redirect");
add_update_test("https://self-signed.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a self-signed https to expired https redirect");
add_update_test(SELFSIGNED, HTTP, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, HTTPS, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, NOCERT, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(SELFSIGNED, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from untrusted https to other servers works as expected
add_update_test("https://untrusted.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to http redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to nocert https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to self-signed https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to untrusted https redirect");
add_update_test("https://untrusted.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a untrusted https to expired https redirect");
add_update_test(UNTRUSTED, HTTP, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, HTTPS, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, NOCERT, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(UNTRUSTED, EXPIRED, DOWNLOAD_ERROR);
// Tests that redirecting from expired https to other servers works as expected
add_update_test("https://expired.example.com/" + redirect + "http://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to http redirect");
add_update_test("https://expired.example.com/" + redirect + "https://example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://nocert.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to nocert https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://self-signed.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to self-signed https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://untrusted.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to untrusted https redirect");
add_update_test("https://expired.example.com/" + redirect + "https://expired.example.com/" + updaterdf,
AddonUpdateChecker.ERROR_DOWNLOAD_ERROR,
"Should have seen a failure for a expired https to expired https redirect");
add_update_test(EXPIRED, HTTP, DOWNLOAD_ERROR);
add_update_test(EXPIRED, HTTPS, DOWNLOAD_ERROR);
add_update_test(EXPIRED, NOCERT, DOWNLOAD_ERROR);
add_update_test(EXPIRED, SELFSIGNED, DOWNLOAD_ERROR);
add_update_test(EXPIRED, UNTRUSTED, DOWNLOAD_ERROR);
add_update_test(EXPIRED, EXPIRED, DOWNLOAD_ERROR);
run_update_tests(run_next_test);
});