| OLD | NEW |
| 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:utf"; | 6 import "dart:utf"; |
| 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:typeddata"; | 10 import "dart:typeddata"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 Expect.listEquals(expectedMessage, buffer); | 44 Expect.listEquals(expectedMessage, buffer); |
| 45 messageCount++; | 45 messageCount++; |
| 46 data = buffer; | 46 data = buffer; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void onClosed() { | 49 void onClosed() { |
| 50 closeCount++; | 50 closeCount++; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void onError(e) { | 53 void onError(e) { |
| 54 Expect.fail("Unexpected error $e"); | 54 String msg = "Unexpected error $e"; |
| 55 var trace = getAttachedStackTrace(e); |
| 56 if (trace != null) msg += "\nStackTrace: $trace"; |
| 57 Expect.fail(msg); |
| 55 } | 58 } |
| 56 | 59 |
| 57 } | 60 } |
| 58 | 61 |
| 59 | 62 |
| 60 // Web socket constants. | 63 // Web socket constants. |
| 61 const int FRAME_OPCODE_TEXT = 1; | 64 const int FRAME_OPCODE_TEXT = 1; |
| 62 const int FRAME_OPCODE_BINARY = 2; | 65 const int FRAME_OPCODE_BINARY = 2; |
| 63 | 66 |
| 64 | 67 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 true, FRAME_OPCODE_BINARY, null, message, 0, message.length); | 242 true, FRAME_OPCODE_BINARY, null, message, 0, message.length); |
| 240 controller.add(frame); | 243 controller.add(frame); |
| 241 } | 244 } |
| 242 | 245 |
| 243 | 246 |
| 244 void main() { | 247 void main() { |
| 245 testFullMessages(); | 248 testFullMessages(); |
| 246 testFragmentedMessages(); | 249 testFragmentedMessages(); |
| 247 testUnmaskedMessage(); | 250 testUnmaskedMessage(); |
| 248 } | 251 } |
| OLD | NEW |