Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Unified Diff: tests/standalone/io/web_socket_test.dart

Issue 12428006: Add some Websocket tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/web_socket_test.dart
diff --git a/tests/standalone/io/web_socket_test.dart b/tests/standalone/io/web_socket_test.dart
index f1f32b073fd2346c3d2a0629b11f8382b7ee376e..b49e32e2222cd6e959b8c96ad4afefd22ac6703c 100644
--- a/tests/standalone/io/web_socket_test.dart
+++ b/tests/standalone/io/web_socket_test.dart
@@ -186,6 +186,43 @@ class SecurityConfiguration {
}
+ void testImmediateCloseServer() {
+ createServer().then((server) {
+ server.listen((request) {
+ WebSocketTransformer.upgrade(request)
+ .then((webSocket) {
+ webSocket.close();
+ webSocket.listen((_) { }, onDone: server.close);
Søren Gjesse 2013/03/05 11:21:37 Expect no messages.
Anders Johnsen 2013/03/05 11:30:58 Done.
+ });
+ });
+
+ createClient(server.port).then((webSocket) {
+ webSocket.listen((_) { }, onDone: webSocket.close);
Søren Gjesse 2013/03/05 11:21:37 Ditto.
Anders Johnsen 2013/03/05 11:30:58 Done.
+ });
+ });
+ }
+
+
+ void testImmediateCloseClient() {
+ createServer().then((server) {
+ server.listen((request) {
+ WebSocketTransformer.upgrade(request)
+ .then((webSocket) {
+ webSocket.listen((_) { }, onDone: () {
Søren Gjesse 2013/03/05 11:21:37 Ditto.
Anders Johnsen 2013/03/05 11:30:58 Done.
+ server.close();
+ webSocket.close();
+ });
+ });
+ });
+
+ createClient(server.port).then((webSocket) {
+ webSocket.close();
+ webSocket.listen((_) { }, onDone: webSocket.close);
Søren Gjesse 2013/03/05 11:21:37 Ditto.
Anders Johnsen 2013/03/05 11:30:58 Done.
+ });
+ });
+ }
+
+
void testNoUpgrade() {
createServer().then((server) {
// Create a server which always responds with NOT_FOUND.
@@ -349,6 +386,8 @@ class SecurityConfiguration {
testMessageLength(65536);
testDoubleCloseClient();
testDoubleCloseServer();
+ testImmediateCloseServer();
+ testImmediateCloseClient();
testNoUpgrade();
testUsePOST();
testConnections(10, 3002, "Got tired");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698