| Index: tests/standalone/io/web_socket_error_test.dart
|
| diff --git a/tests/standalone/io/web_socket_error_test.dart b/tests/standalone/io/web_socket_error_test.dart
|
| index cc16bde50f693029fad0be59ab9905b8448ca57b..69c7855e68a30d1827c184ba07c964aca10f11be 100644
|
| --- a/tests/standalone/io/web_socket_error_test.dart
|
| +++ b/tests/standalone/io/web_socket_error_test.dart
|
| @@ -94,8 +94,107 @@ class SecurityConfiguration {
|
| });
|
| }
|
|
|
| + void testAddErrorServer() {
|
| + asyncStart();
|
| + asyncStart();
|
| + asyncStart();
|
| + asyncStart();
|
| + createServer().then((server) {
|
| + server.transform(new WebSocketTransformer()).listen((webSocket) {
|
| + webSocket.listen(
|
| + (message) {
|
| + webSocket.addError("ERROR");
|
| + },
|
| + onDone: () {
|
| + Expect.equals(WebSocketStatus.ABNORMAL_CLOSURE,
|
| + webSocket.closeCode);
|
| + server.close();
|
| + },
|
| + onError: (e) {
|
| + Expect.equals("ERROR", e);
|
| + asyncEnd();
|
| + });
|
| +
|
| + webSocket.done.then((_) {
|
| + Expect.fail("unexpected done completion");
|
| + }).catchError((e) {
|
| + Expect.equals("ERROR", e);
|
| + asyncEnd();
|
| + });
|
| + }, onDone: () {
|
| + asyncEnd();
|
| + });
|
| +
|
| + createClient(server.port).then((webSocket) {
|
| + webSocket.add("message");
|
| + webSocket.listen(
|
| + (message) {
|
| + Expect.fail("unexpected message");
|
| + },
|
| + onDone: () {
|
| + Expect.equals(WebSocketStatus.ABNORMAL_CLOSURE,
|
| + webSocket.closeCode);
|
| + server.close();
|
| + asyncEnd();
|
| + },
|
| + onError: (e) {
|
| + Expect.fail("unexpected onError");
|
| + });
|
| +
|
| + });
|
| + });
|
| + }
|
| +
|
| + void testAddErrorClient() {
|
| + asyncStart();
|
| + asyncStart();
|
| + asyncStart();
|
| + asyncStart();
|
| + createServer().then((server) {
|
| + server.transform(new WebSocketTransformer()).listen((webSocket) {
|
| + webSocket.listen(
|
| + (message) {
|
| + Expect.fail("unexpected message");
|
| + },
|
| + onDone: () {
|
| + Expect.equals(WebSocketStatus.ABNORMAL_CLOSURE,
|
| + webSocket.closeCode);
|
| + asyncEnd();
|
| + });
|
| + }, onDone: () {
|
| + asyncEnd();
|
| + });
|
| +
|
| + createClient(server.port).then((webSocket) {
|
| + webSocket.addError("ERROR");
|
| + webSocket.listen(
|
| + (message) {
|
| + Expect.fail("unexpected message");
|
| + },
|
| + onDone: () {
|
| + Expect.equals(WebSocketStatus.ABNORMAL_CLOSURE,
|
| + webSocket.closeCode);
|
| + server.close();
|
| + },
|
| + onError: (e) {
|
| + Expect.equals("ERROR", e);
|
| + asyncEnd();
|
| + });
|
| +
|
| + webSocket.done.then((_) {
|
| + Expect.fail("unexpected done completion");
|
| + }).catchError((e) {
|
| + Expect.equals("ERROR", e);
|
| + asyncEnd();
|
| + });
|
| + });
|
| + });
|
| + }
|
| +
|
| void runTests() {
|
| testForceCloseServerEnd(10);
|
| + testAddErrorServer();
|
| + testAddErrorClient();
|
| }
|
| }
|
|
|
|
|