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

Side by Side Diff: tests/standalone/io/web_socket_test.dart

Issue 12387085: Improve web-socket implementation by using making _WebSocketProtocolProcessor a StreamTransformer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/web_socket_protocol_processor_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 import "dart:async"; 10 import "dart:async";
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 webSocket.send(messageText); 114 webSocket.send(messageText);
115 }); 115 });
116 116
117 for (int i = 0; i < totalConnections; i++) { 117 for (int i = 0; i < totalConnections; i++) {
118 createClient(server.port).then((webSocket) { 118 createClient(server.port).then((webSocket) {
119 webSocket.listen( 119 webSocket.listen(
120 webSocket.send, 120 webSocket.send,
121 onDone: () { 121 onDone: () {
122 Expect.equals(closeStatus == null 122 Expect.equals(closeStatus == null
123 ? WebSocketStatus.NO_STATUS_RECEIVED 123 ? WebSocketStatus.NO_STATUS_RECEIVED
124 : closeStatus, event.code); 124 : closeStatus, webSocket.closeCode);
125 Expect.equals( 125 Expect.equals(closeReason == null
126 closeReason == null ? "" : closeReason, event.reason); 126 ? ""
127 : closeReason, webSocket.closeReason);
127 }); 128 });
128 }); 129 });
129 } 130 }
130 }); 131 });
131 } 132 }
132 133
133 134
134 void testMessageLength(int messageLength) { 135 void testMessageLength(int messageLength) {
135 createServer().then((server) { 136 createServer().then((server) {
136 Uint8List originalMessage = new Uint8List(messageLength); 137 Uint8List originalMessage = new Uint8List(messageLength);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 Expect.isTrue(onopenCalled); 268 Expect.isTrue(onopenCalled);
268 Expect.isFalse(oncloseCalled); 269 Expect.isFalse(oncloseCalled);
269 Expect.equals(WebSocket.OPEN, webSocket.readyState); 270 Expect.equals(WebSocket.OPEN, webSocket.readyState);
270 webSocket.send(message); 271 webSocket.send(message);
271 }, 272 },
272 onDone: () { 273 onDone: () {
273 Expect.isTrue(onopenCalled); 274 Expect.isTrue(onopenCalled);
274 Expect.equals(10, onmessageCalled); 275 Expect.equals(10, onmessageCalled);
275 Expect.isFalse(oncloseCalled); 276 Expect.isFalse(oncloseCalled);
276 oncloseCalled = true; 277 oncloseCalled = true;
277 Expect.isTrue(event.wasClean); 278 Expect.equals(3002, webSocket.closeCode);
278 Expect.equals(3002, event.code); 279 Expect.equals("Got tired", webSocket.closeReason);
279 Expect.equals("Got tired", event.reason);
280 Expect.equals(WebSocket.CLOSED, webSocket.readyState); 280 Expect.equals(WebSocket.CLOSED, webSocket.readyState);
281 }); 281 });
282 }); 282 });
283 } 283 }
284 284
285 for (int i = 0; i < totalConnections; i++) { 285 for (int i = 0; i < totalConnections; i++) {
286 webSocketConnection(); 286 webSocketConnection();
287 } 287 }
288 }); 288 });
289 } 289 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(), 363 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(),
364 password: "dartdart"); 364 password: "dartdart");
365 } 365 }
366 366
367 367
368 main() { 368 main() {
369 new SecurityConfiguration(secure: false).runTests(); 369 new SecurityConfiguration(secure: false).runTests();
370 initializeSSL(); 370 initializeSSL();
371 new SecurityConfiguration(secure: true).runTests(); 371 new SecurityConfiguration(secure: true).runTests();
372 } 372 }
OLDNEW
« no previous file with comments | « tests/standalone/io/web_socket_protocol_processor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698