Bug 888550 - Use a dynamic port in search/ xpcshell tests so they can be run in parallel. r=MattN
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
"use strict";
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
let gHttpServer;
|
||||
let gBaseUrl;
|
||||
|
||||
Components.utils.import("resource://testing-common/httpd.js");
|
||||
|
||||
@@ -67,7 +69,7 @@ add_test(function simple_callback_test() {
|
||||
do_throw("search callback returned error: " + errorCode);
|
||||
}
|
||||
}
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine(gBaseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false, searchCallback);
|
||||
});
|
||||
@@ -85,7 +87,7 @@ add_test(function duplicate_failure_test() {
|
||||
}
|
||||
}
|
||||
// Re-add the same engine added in the previous test
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine(gBaseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false, searchCallback);
|
||||
});
|
||||
@@ -111,12 +113,13 @@ add_test(function load_failure_test() {
|
||||
function run_test() {
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
gHttpServer = new HttpServer();
|
||||
gHttpServer.start(-1);
|
||||
gHttpServer.registerDirectory("/", do_get_cwd());
|
||||
gBaseUrl = "http://localhost:" + gHttpServer.identity.primaryPort;
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
httpServer.stop(function() {});
|
||||
gHttpServer.stop(function() {});
|
||||
});
|
||||
|
||||
run_next_test();
|
||||
|
||||
@@ -77,8 +77,9 @@ function run_test() {
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
let baseUrl = "http://localhost:" + httpServer.identity.primaryPort;
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
httpServer.stop(function() {});
|
||||
@@ -89,10 +90,10 @@ function run_test() {
|
||||
|
||||
Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
|
||||
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine(baseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
Services.search.addEngine("http://localhost:4444/data/engine2.xml",
|
||||
Services.search.addEngine(baseUrl + "/data/engine2.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ function run_test()
|
||||
do_load_manifest("data/chrome.manifest");
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
|
||||
let search = Services.search;
|
||||
@@ -93,8 +93,9 @@ function run_test()
|
||||
Services.obs.addObserver(observer, "browser-search-engine-modified", false);
|
||||
|
||||
// Add an engine, check if it appears in the cache
|
||||
search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
search.addEngine("http://localhost:" + httpServer.identity.primaryPort +
|
||||
"/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ function run_test()
|
||||
do_load_manifest("data/chrome.manifest");
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
let baseUrl = "http://localhost:" + httpServer.identity.primaryPort;
|
||||
|
||||
let search = Services.search;
|
||||
|
||||
@@ -93,12 +94,12 @@ function run_test()
|
||||
|
||||
do_test_pending();
|
||||
|
||||
search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
search.addEngine(baseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
search.addEngine("http://localhost:4444/data/engine.src",
|
||||
search.addEngine(baseUrl + "/data/engine.src",
|
||||
Ci.nsISearchEngine.DATA_TEXT,
|
||||
"http://localhost:4444/data/ico-size-16x16-png.ico",
|
||||
baseUrl + "/data/ico-size-16x16-png.ico",
|
||||
false);
|
||||
|
||||
do_timeout(120000, function() {
|
||||
|
||||
@@ -64,7 +64,7 @@ function run_test() {
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
@@ -76,7 +76,9 @@ function run_test() {
|
||||
|
||||
Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
|
||||
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine("http://localhost:" +
|
||||
httpServer.identity.primaryPort +
|
||||
"/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,9 @@ function run_test() {
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
let baseUrl = "http://localhost:" + httpServer.identity.primaryPort;
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
httpServer.stop(function() {});
|
||||
@@ -120,10 +121,10 @@ function run_test() {
|
||||
|
||||
Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
|
||||
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine(baseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
Services.search.addEngine("http://localhost:4444/data/engine2.xml",
|
||||
Services.search.addEngine(baseUrl + "/data/engine2.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ function run_test() {
|
||||
do_load_manifest("data/chrome.manifest");
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
|
||||
do_register_cleanup(function cleanup() {
|
||||
@@ -66,7 +66,9 @@ function run_test() {
|
||||
do_test_pending();
|
||||
Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
|
||||
|
||||
Services.search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
Services.search.addEngine("http://localhost:" +
|
||||
httpServer.identity.primaryPort +
|
||||
"/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,9 @@ function run_test() {
|
||||
updateAppInfo();
|
||||
|
||||
let httpServer = new HttpServer();
|
||||
httpServer.start(4444);
|
||||
httpServer.start(-1);
|
||||
httpServer.registerDirectory("/", do_get_cwd());
|
||||
let baseUrl = "http://localhost:" + httpServer.identity.primaryPort;
|
||||
|
||||
function getSearchMetadata() {
|
||||
// Check that search-metadata.json has been created
|
||||
@@ -109,12 +110,12 @@ function run_test() {
|
||||
|
||||
do_test_pending();
|
||||
|
||||
search.addEngine("http://localhost:4444/data/engine.xml",
|
||||
search.addEngine(baseUrl + "/data/engine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML,
|
||||
null, false);
|
||||
search.addEngine("http://localhost:4444/data/engine.src",
|
||||
search.addEngine(baseUrl + "/data/engine.src",
|
||||
Ci.nsISearchEngine.DATA_TEXT,
|
||||
"http://localhost:4444/data/ico-size-16x16-png.ico",
|
||||
baseUrl + "/data/ico-size-16x16-png.ico",
|
||||
false);
|
||||
|
||||
do_timeout(120000, function() {
|
||||
|
||||
Reference in New Issue
Block a user