Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // tests the registerFile API
9 XPCOMUtils.defineLazyGetter(this, "BASE", function() {
10 return "http://localhost:" + srv.identity.primaryPort;
11 });
13 var file = do_get_file("test_registerfile.js");
15 function onStart(ch, cx)
16 {
17 do_check_eq(ch.responseStatus, 200);
18 }
20 function onStop(ch, cx, status, data)
21 {
22 // not sufficient for equality, but not likely to be wrong!
23 do_check_eq(data.length, file.fileSize);
24 }
26 XPCOMUtils.defineLazyGetter(this, "test", function() {
27 return new Test(BASE + "/foo", null, onStart, onStop);
28 });
30 var srv;
32 function run_test()
33 {
34 srv = createServer();
36 try
37 {
38 srv.registerFile("/foo", do_get_profile());
39 throw "registerFile succeeded!";
40 }
41 catch (e)
42 {
43 isException(e, Cr.NS_ERROR_INVALID_ARG);
44 }
46 srv.registerFile("/foo", file);
47 srv.start(-1);
49 runHttpTests([test], testComplete(srv));
50 }