Bug 755196 - Allow httpd.js to be loaded as a testing module; r=mcmanus

This commit is contained in:
Gregory Szorc 2012-06-29 13:28:04 -07:00
parent 8e71f71a3c
commit f85dc8cb5b
4 changed files with 53 additions and 5 deletions

View File

@ -6,10 +6,10 @@
$(warning httpserver XPI_NAME=$(XPI_NAME))
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = netwerk/test/httpserver
include $(DEPTH)/config/autoconf.mk
@ -36,4 +36,6 @@ XPIDLSRCS = \
XPCSHELL_TESTS = test
TESTING_JS_MODULES = httpd.js
include $(topsrcdir)/config/rules.mk

View File

@ -10,6 +10,34 @@
* httpd.js.
*/
const EXPORTED_SYMBOLS = [
"HTTP_400",
"HTTP_401",
"HTTP_402",
"HTTP_403",
"HTTP_404",
"HTTP_405",
"HTTP_406",
"HTTP_407",
"HTTP_408",
"HTTP_409",
"HTTP_410",
"HTTP_411",
"HTTP_412",
"HTTP_413",
"HTTP_414",
"HTTP_415",
"HTTP_417",
"HTTP_500",
"HTTP_501",
"HTTP_502",
"HTTP_503",
"HTTP_504",
"HTTP_505",
"HttpError",
"HttpServer",
];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Cc = Components.classes;
@ -762,7 +790,7 @@ nsHttpServer.prototype =
// Bug 508125: Add a GC here else we'll use gigabytes of memory running
// mochitests. We can't rely on xpcshell doing an automated GC, as that
// would interfere with testing GC stuff...
gc();
Components.utils.forceGC();
},
/**
@ -776,6 +804,7 @@ nsHttpServer.prototype =
}
};
var HttpServer = nsHttpServer;
//
// RFC 2396 section 3.2.2:

View File

@ -0,0 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Ensure httpd.js can be imported as a module and that a server starts.
*/
function run_test() {
Components.utils.import("resource://testing-common/httpd.js");
let server = new HttpServer();
server.start(8080);
do_test_pending();
server.stop(do_test_finished);
}

View File

@ -14,6 +14,7 @@ tail =
[test_headers.js]
[test_host.js]
[test_linedata.js]
[test_load_module.js]
[test_name_scheme.js]
[test_processasync.js]
[test_qi.js]