1 // This file expects a tests array to be defined in the global scope.
6 function shouldNotOpen(e
) {
8 ok(false, "onopen shouldn't be called on test " + ws
._testNumber
+ "!");
11 function shouldCloseCleanly(e
) {
15 "the ws connection in test " + ws
._testNumber
+ " should be closed cleanly"
19 function shouldCloseNotCleanly(e
) {
23 "the ws connection in test " +
25 " shouldn't be closed cleanly"
29 function ignoreError() {}
31 function CreateTestWS(ws_location
, ws_protocol
) {
34 if (ws_protocol
== undefined) {
35 ws
= new WebSocket(ws_location
);
37 ws
= new WebSocket(ws_location
, ws_protocol
);
40 ws
._testNumber
= current_test
;
41 ok(true, "Created websocket for test " + ws
._testNumber
+ "\n");
43 ws
.onerror = function (e
) {
44 ok(false, "onerror called on test " + e
.target
._testNumber
+ "!");
51 SpecialPowers
.forceGC();
56 $("feedback").innerHTML
=
57 "executing test: " + (current_test
+ 1) + " of " + tests
.length
+ " tests.";
65 if (current_test
>= tests
.length
) {
71 tests
[current_test
++]().then(doTest
);