зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1368065 - Add a test for WebSocket and non-ascii char, r=qdot
This commit is contained in:
Родитель
d5b5f35f62
Коммит
d3f074c19a
|
@ -238,7 +238,7 @@ function testWebSocket5() {
|
|||
|
||||
gTestElement.textContent += "\ntestWebSocket5() completed";
|
||||
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
SimpleTest.executeSoon(testWebSocket6);
|
||||
};
|
||||
ws.onerror = function(e) {
|
||||
ok(false, "[5] onerror() should not have been called!");
|
||||
|
@ -247,6 +247,40 @@ function testWebSocket5() {
|
|||
};
|
||||
}
|
||||
|
||||
function testWebSocket6() {
|
||||
gTestElement.textContent = "Running testWebSocket6()";
|
||||
|
||||
var msgReceived = false;
|
||||
ws = new WebSocket(kUrl, "test");
|
||||
ws.onopen = function(e) {
|
||||
gTestElement.textContent += "\nSending ©";
|
||||
ws.send("©");
|
||||
gTestElement.textContent += " end";
|
||||
ws.send("end");
|
||||
};
|
||||
ws.onclose = function(e) {
|
||||
ok(msgReceived, "[6] Number of received messages");
|
||||
ok(e.wasClean, "[6] Connection closed cleanly");
|
||||
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
};
|
||||
ws.onerror = function(e) {
|
||||
ok(false, "[6] onerror() should not have been called!");
|
||||
gTestElement.textContent += "\nonerror() should not have been called!";
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
};
|
||||
|
||||
ws.onmessage = function(e) {
|
||||
if (msgReceived) {
|
||||
is(e.data, "end", "[6] Received message");
|
||||
} else {
|
||||
gTestElement.textContent += "\nReceived: " + e.data;
|
||||
is(e.data, "©", "[6] Received message");
|
||||
msgReceived = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче