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 "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 22 matching lines...) Expand all Loading... |
33 WebSocket.connect("ws://127.0.0.1:${server.port}/").then((client) { | 33 WebSocket.connect("ws://127.0.0.1:${server.port}/").then((client) { |
34 var count = 0; | 34 var count = 0; |
35 next() { | 35 next() { |
36 if (count < messages) { | 36 if (count < messages) { |
37 client.add("Hello"); | 37 client.add("Hello"); |
38 } else { | 38 } else { |
39 client.close(); | 39 client.close(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 next(); | |
44 client.listen( | 43 client.listen( |
45 (data) { | 44 (data) { |
46 count++; | 45 count++; |
47 if (transform) { | 46 if (transform) { |
48 Expect.equals("olleH", data); | 47 Expect.equals("olleH", data); |
49 } else { | 48 } else { |
50 Expect.equals("Hello", data); | 49 Expect.equals("Hello", data); |
51 } | 50 } |
52 next(); | 51 next(); |
53 }, | 52 }, |
54 onDone: () => print("Client received close")); | 53 onDone: () => print("Client received close")); |
| 54 |
| 55 next(); |
55 }); | 56 }); |
56 }); | 57 }); |
57 } | 58 } |
58 | 59 |
59 void main() { | 60 void main() { |
60 testPipe(messages: 0, transform: false); | 61 testPipe(messages: 0, transform: false); |
61 testPipe(messages: 0, transform: true); | 62 testPipe(messages: 0, transform: true); |
62 testPipe(messages: 1, transform: false); | 63 testPipe(messages: 1, transform: false); |
63 testPipe(messages: 1, transform: true); | 64 testPipe(messages: 1, transform: true); |
64 testPipe(messages: 10, transform: false); | 65 testPipe(messages: 10, transform: false); |
65 testPipe(messages: 10, transform: true); | 66 testPipe(messages: 10, transform: true); |
66 } | 67 } |
OLD | NEW |