Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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( |
| 126 closeReason == null ? "" : closeReason, event.reason); | 126 closeReason == null ? "" : closeReason, webSocket.closeRea son); |
|
Søren Gjesse
2013/03/05 09:32:29
Long line
Anders Johnsen
2013/03/05 09:38:34
Done.
| |
| 127 }); | 127 }); |
| 128 }); | 128 }); |
| 129 } | 129 } |
| 130 }); | 130 }); |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 void testMessageLength(int messageLength) { | 134 void testMessageLength(int messageLength) { |
| 135 createServer().then((server) { | 135 createServer().then((server) { |
| 136 Uint8List originalMessage = new Uint8List(messageLength); | 136 Uint8List originalMessage = new Uint8List(messageLength); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 Expect.isTrue(onopenCalled); | 267 Expect.isTrue(onopenCalled); |
| 268 Expect.isFalse(oncloseCalled); | 268 Expect.isFalse(oncloseCalled); |
| 269 Expect.equals(WebSocket.OPEN, webSocket.readyState); | 269 Expect.equals(WebSocket.OPEN, webSocket.readyState); |
| 270 webSocket.send(message); | 270 webSocket.send(message); |
| 271 }, | 271 }, |
| 272 onDone: () { | 272 onDone: () { |
| 273 Expect.isTrue(onopenCalled); | 273 Expect.isTrue(onopenCalled); |
| 274 Expect.equals(10, onmessageCalled); | 274 Expect.equals(10, onmessageCalled); |
| 275 Expect.isFalse(oncloseCalled); | 275 Expect.isFalse(oncloseCalled); |
| 276 oncloseCalled = true; | 276 oncloseCalled = true; |
| 277 Expect.isTrue(event.wasClean); | 277 Expect.equals(3002, webSocket.closeCode); |
| 278 Expect.equals(3002, event.code); | 278 Expect.equals("Got tired", webSocket.closeReason); |
| 279 Expect.equals("Got tired", event.reason); | |
| 280 Expect.equals(WebSocket.CLOSED, webSocket.readyState); | 279 Expect.equals(WebSocket.CLOSED, webSocket.readyState); |
| 281 }); | 280 }); |
| 282 }); | 281 }); |
| 283 } | 282 } |
| 284 | 283 |
| 285 for (int i = 0; i < totalConnections; i++) { | 284 for (int i = 0; i < totalConnections; i++) { |
| 286 webSocketConnection(); | 285 webSocketConnection(); |
| 287 } | 286 } |
| 288 }); | 287 }); |
| 289 } | 288 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(), | 362 SecureSocket.initialize(database: testPkcertDatabase.toNativePath(), |
| 364 password: "dartdart"); | 363 password: "dartdart"); |
| 365 } | 364 } |
| 366 | 365 |
| 367 | 366 |
| 368 main() { | 367 main() { |
| 369 new SecurityConfiguration(secure: false).runTests(); | 368 new SecurityConfiguration(secure: false).runTests(); |
| 370 initializeSSL(); | 369 initializeSSL(); |
| 371 new SecurityConfiguration(secure: true).runTests(); | 370 new SecurityConfiguration(secure: true).runTests(); |
| 372 } | 371 } |
| OLD | NEW |