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

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

Issue 12380029: Keep track of closing socket, in WebSocket, so we don't write once the socket is closed. (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
« sdk/lib/io/websocket_impl.dart ('K') | « sdk/lib/io/websocket_impl.dart ('k') | 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 e3f58e6b82a5a60d4cc3a1db7e384f549eb0ef2d..c20ee068cb1063a77fa5616a6093dff5294c0786 100644
--- a/tests/standalone/io/web_socket_test.dart
+++ b/tests/standalone/io/web_socket_test.dart
@@ -164,6 +164,50 @@ class SecurityConfiguration {
}
+ void testDoubleCloseClient() {
+ createServer().then((server) {
+ server.transform(new WebSocketTransformer()).listen((webSocket) {
+ webSocket.listen((event) {
+ if (event is CloseEvent) {
+ webSocket.close();
+ }
+ });
+ });
+
+ createClient(server.port).then((webSocket) {
+ webSocket.listen((event) {
+ if (event is CloseEvent) {
+ webSocket.close();
+ }
+ });
+ webSocket.close();
+ });
+ });
+ }
+
+
+ void testDoubleCloseServer() {
+ createServer().then((server) {
+ server.transform(new WebSocketTransformer()).listen((webSocket) {
+ webSocket.listen((event) {
+ if (event is CloseEvent) {
+ webSocket.close();
+ }
+ });
+ webSocket.close();
+ });
+
+ createClient(server.port).then((webSocket) {
+ webSocket.listen((event) {
+ if (event is CloseEvent) {
+ webSocket.close();
+ }
+ });
+ });
+ });
+ }
+
+
void testNoUpgrade() {
createServer().then((server) {
// Create a server which always responds with NOT_FOUND.
@@ -279,6 +323,8 @@ class SecurityConfiguration {
testMessageLength(127);
testMessageLength(65535);
testMessageLength(65536);
+ testDoubleCloseClient();
+ testDoubleCloseServer();
testNoUpgrade();
testUsePOST();
testW3CInterface(10, 3002, "Got tired");
« sdk/lib/io/websocket_impl.dart ('K') | « sdk/lib/io/websocket_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698