| 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("dart:math"); | 5 #import("dart:math"); |
| 6 | 6 |
| 7 #source("../../../runtime/bin/websocket.dart"); | 7 #source("../../../runtime/bin/websocket.dart"); |
| 8 #source("../../../runtime/bin/websocket_impl.dart"); | 8 #source("../../../runtime/bin/websocket_impl.dart"); |
| 9 | 9 |
| 10 class WebSocketFrame { | 10 class WebSocketFrame { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 _WebSocketProtocolProcessor processor; | 48 _WebSocketProtocolProcessor processor; |
| 49 List<int> expectedMessage; | 49 List<int> expectedMessage; |
| 50 | 50 |
| 51 List<int> data; | 51 List<int> data; |
| 52 int messageCount = 0; | 52 int messageCount = 0; |
| 53 int closeCount = 0; | 53 int closeCount = 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 // Web socket constants. | 57 // Web socket constants. |
| 58 final int FRAME_OPCODE_TEXT = 1; | 58 const int FRAME_OPCODE_TEXT = 1; |
| 59 final int FRAME_OPCODE_BINARY = 2; | 59 const int FRAME_OPCODE_BINARY = 2; |
| 60 | 60 |
| 61 | 61 |
| 62 // Function for building a web socket frame. | 62 // Function for building a web socket frame. |
| 63 List<int> createFrame(bool fin, | 63 List<int> createFrame(bool fin, |
| 64 int opcode, | 64 int opcode, |
| 65 int maskingKey, | 65 int maskingKey, |
| 66 List<int> data, | 66 List<int> data, |
| 67 int offset, | 67 int offset, |
| 68 int count) { | 68 int count) { |
| 69 int frameSize = 2; | 69 int frameSize = 2; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 runTest(65534, 65537, 1); | 213 runTest(65534, 65537, 1); |
| 214 print("Fragment messages test, messages $messageCount, frames $frameCount"); | 214 print("Fragment messages test, messages $messageCount, frames $frameCount"); |
| 215 Expect.equals(messageCount, mc.messageCount); | 215 Expect.equals(messageCount, mc.messageCount); |
| 216 Expect.equals(0, mc.closeCount); | 216 Expect.equals(0, mc.closeCount); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void main() { | 219 void main() { |
| 220 testFullMessages(); | 220 testFullMessages(); |
| 221 testFragmentedMessages(); | 221 testFragmentedMessages(); |
| 222 } | 222 } |
| OLD | NEW |