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

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

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 years, 3 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
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:convert"; 6 import "dart:convert";
7 import "dart:math"; 7 import "dart:math";
8 import "dart:async"; 8 import "dart:async";
9 import "dart:collection"; 9 import "dart:collection";
10 import "dart:typed_data"; 10 import "dart:typed_data";
(...skipping 23 matching lines...) Expand all
34 34
35 Function onClosed; 35 Function onClosed;
36 36
37 WebSocketMessageCollector(Stream stream, 37 WebSocketMessageCollector(Stream stream,
38 [List<int> this.expectedMessage = null]) { 38 [List<int> this.expectedMessage = null]) {
39 stream.listen(onMessageData, onDone: onClosed, onError: onError); 39 stream.listen(onMessageData, onDone: onClosed, onError: onError);
40 } 40 }
41 41
42 void onMessageData(buffer) { 42 void onMessageData(buffer) {
43 if (buffer is String) { 43 if (buffer is String) {
44 buffer = _encodeString(buffer); 44 buffer = UTF8.encode(buffer);
45 } 45 }
46 Expect.listEquals(expectedMessage, buffer); 46 Expect.listEquals(expectedMessage, buffer);
47 messageCount++; 47 messageCount++;
48 data = buffer; 48 data = buffer;
49 } 49 }
50 50
51 void onError(e) { 51 void onError(e) {
52 String msg = "Unexpected error $e"; 52 String msg = "Unexpected error $e";
53 var trace = getAttachedStackTrace(e); 53 var trace = getAttachedStackTrace(e);
54 if (trace != null) msg += "\nStackTrace: $trace"; 54 if (trace != null) msg += "\nStackTrace: $trace";
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 true, FRAME_OPCODE_BINARY, null, message, 0, message.length); 241 true, FRAME_OPCODE_BINARY, null, message, 0, message.length);
242 controller.add(frame); 242 controller.add(frame);
243 } 243 }
244 244
245 245
246 void main() { 246 void main() {
247 testFullMessages(); 247 testFullMessages();
248 testFragmentedMessages(); 248 testFragmentedMessages();
249 testUnmaskedMessage(); 249 testUnmaskedMessage();
250 } 250 }
OLDNEW
« no previous file with comments | « tests/standalone/io/string_transformer_test.dart ('k') | tests/standalone/vmservice/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698