mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1311739 - Fail push tests with an informative error if the H/2 server port is missing. r=dragana
MozReview-Commit-ID: 97rOKjbDlTu --HG-- extra : rebase_source : 62c385b7317a3d9d3a7ad807eca6667ae25a255b
This commit is contained in:
parent
d83be5fb40
commit
ee288ff7bb
@ -1,3 +1,14 @@
|
||||
// Returns the test H/2 server port, throwing if it's missing or invalid.
|
||||
function getTestServerPort() {
|
||||
let portEnv = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment).get("MOZHTTP2_PORT");
|
||||
let port = parseInt(portEnv, 10);
|
||||
if (!Number.isFinite(port) || port < 1 || port > 65535) {
|
||||
throw new Error(`Invalid port in MOZHTTP2_PORT env var: ${portEnv}`);
|
||||
}
|
||||
do_print(`Using HTTP/2 server on port ${port}`);
|
||||
return port;
|
||||
}
|
||||
|
||||
// Support for making sure we can talk to the invalid cert the server presents
|
||||
var CertOverrideListener = function(host, port, bits) {
|
||||
|
@ -13,10 +13,7 @@ var tlsProfile;
|
||||
var serverPort = -1;
|
||||
|
||||
function run_test() {
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
serverPort = env.get("MOZHTTP2_PORT");
|
||||
do_check_neq(serverPort, null);
|
||||
dump("using port " + serverPort + "\n");
|
||||
serverPort = getTestServerPort();
|
||||
|
||||
do_get_profile();
|
||||
setPrefs({
|
||||
|
@ -14,9 +14,7 @@ var serverURL;
|
||||
var serverPort = -1;
|
||||
|
||||
function run_test() {
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
serverPort = env.get("MOZHTTP2_PORT");
|
||||
do_check_neq(serverPort, null);
|
||||
serverPort = getTestServerPort();
|
||||
|
||||
do_get_profile();
|
||||
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
@ -16,9 +16,7 @@ var pushConnectionEnabled;
|
||||
var db;
|
||||
|
||||
function run_test() {
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
serverPort = env.get("MOZHTTP2_PORT");
|
||||
do_check_neq(serverPort, null);
|
||||
serverPort = getTestServerPort();
|
||||
|
||||
do_get_profile();
|
||||
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
@ -21,9 +21,7 @@ var prefs;
|
||||
var serverPort = -1;
|
||||
|
||||
function run_test() {
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
serverPort = env.get("MOZHTTP2_PORT");
|
||||
do_check_neq(serverPort, null);
|
||||
serverPort = getTestServerPort();
|
||||
|
||||
do_get_profile();
|
||||
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
@ -24,9 +24,7 @@ var pushConnectionEnabled;
|
||||
var serverPort = -1;
|
||||
|
||||
function run_test() {
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
serverPort = env.get("MOZHTTP2_PORT");
|
||||
do_check_neq(serverPort, null);
|
||||
serverPort = getTestServerPort();
|
||||
|
||||
do_get_profile();
|
||||
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
|
Loading…
Reference in New Issue
Block a user