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

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

Issue 12435002: Fix web_socket_protocol_processor_test to pass in checked mode. (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 | « no previous file | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "dart:utf"; 5 import "dart:utf";
6 import "dart:math"; 6 import "dart:math";
7 import "dart:async"; 7 import "dart:async";
8 import "dart:collection"; 8 import "dart:collection";
9 import "dart:scalarlist"; 9 import "dart:scalarlist";
10 10
(...skipping 12 matching lines...) Expand all
23 // collect the message and expect it to be equal to the 23 // collect the message and expect it to be equal to the
24 // expectedMessage field when fully received. 24 // expectedMessage field when fully received.
25 class WebSocketMessageCollector { 25 class WebSocketMessageCollector {
26 List<int> expectedMessage; 26 List<int> expectedMessage;
27 27
28 int messageCount = 0; 28 int messageCount = 0;
29 int closeCount = 0; 29 int closeCount = 0;
30 30
31 var data; 31 var data;
32 32
33 WebSocketMessageCollector(_WebSocketProtocolTransformer transformer, 33 WebSocketMessageCollector(Stream stream,
34 [List<int> this.expectedMessage = null]) { 34 [List<int> this.expectedMessage = null]) {
35 transformer.listen(onMessageData, onDone: onClosed, onError: onError); 35 stream.listen(onMessageData, onDone: onClosed, onError: onError);
36 } 36 }
37 37
38 void onMessageData(buffer) { 38 void onMessageData(buffer) {
39 if (buffer is String) { 39 if (buffer is String) {
40 buffer = _encodeString(buffer); 40 buffer = _encodeString(buffer);
41 } 41 }
42 Expect.listEquals(expectedMessage, buffer); 42 Expect.listEquals(expectedMessage, buffer);
43 messageCount++; 43 messageCount++;
44 data = buffer; 44 data = buffer;
45 } 45 }
46 46
47 void onClosed(int status, String reason) { 47 void onClosed() {
48 closeCount++; 48 closeCount++;
49 } 49 }
50 50
51 void onError(e) { 51 void onError(e) {
52 Expect.fail("Unexpected error $e"); 52 Expect.fail("Unexpected error $e");
53 } 53 }
54 54
55 } 55 }
56 56
57 57
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 runTest(65534, 65537, 1); 222 runTest(65534, 65537, 1);
223 print("Fragment messages test, messages $messageCount, frames $frameCount"); 223 print("Fragment messages test, messages $messageCount, frames $frameCount");
224 Expect.equals(messageCount, mc.messageCount); 224 Expect.equals(messageCount, mc.messageCount);
225 Expect.equals(0, mc.closeCount); 225 Expect.equals(0, mc.closeCount);
226 } 226 }
227 227
228 void main() { 228 void main() {
229 testFullMessages(); 229 testFullMessages();
230 testFragmentedMessages(); 230 testFragmentedMessages();
231 } 231 }
OLDNEW
« 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