ok(e.data instanceof Blob, "We should be receiving a Blob");
receivedBlob = e.data;
ws.close();
}
ws.onclose = function(e) {
is(ws.readyState, 3, "Close readyState is 3");
// check blob contents
var reader = new FileReader();
reader.onload = function(event) {
is(reader.result, new Array(1024*1024).join('123456789ABCDEF'), "All data matches");
}
reader.onerror = function(event) {
ok(false, "Something bad happen.");
}
reader.onloadend = function(event) {
SimpleTest.finish();
}
reader.readAsBinaryString(receivedBlob);
}
SimpleTest.requestFlakyTimeout("The web socket tests are really fragile, but avoiding timeouts might be hard, since it's testing stuff on the network. " +