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 // Test socket close events. | 10 // Test socket close events. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 proceed(); | 83 proceed(); |
84 break; | 84 break; |
85 case 6: | 85 case 6: |
86 proceed(); | 86 proceed(); |
87 break; | 87 break; |
88 default: | 88 default: |
89 Expect.fail("Unknown test mode"); | 89 Expect.fail("Unknown test mode"); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void errorHandler(Exception e) { | 93 void errorHandler(Socket socket) { |
94 _errorEvents++; | 94 _errorEvents++; |
95 socket.close(); | 95 socket.close(); |
96 } | 96 } |
97 | 97 |
98 void connectHandler(socket) { | 98 void connectHandler(socket) { |
99 socket.listen( | 99 socket.listen( |
100 dataHandler, | 100 dataHandler, |
101 onDone: () => closeHandler(socket), | 101 onDone: () => closeHandler(socket), |
102 onError: (error) => errorHandler(socket)); | 102 onError: (error) => errorHandler(socket)); |
103 | 103 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 var tests = 7; | 378 var tests = 7; |
379 var port = new ReceivePort(); | 379 var port = new ReceivePort(); |
380 var completed = 0; | 380 var completed = 0; |
381 port.receive((message, ignore) { | 381 port.receive((message, ignore) { |
382 if (++completed == tests) port.close(); | 382 if (++completed == tests) port.close(); |
383 }); | 383 }); |
384 for (var i = 0; i < tests; i++) { | 384 for (var i = 0; i < tests; i++) { |
385 new SocketClose.start(i, port.toSendPort()); | 385 new SocketClose.start(i, port.toSendPort()); |
386 } | 386 } |
387 } | 387 } |
OLD | NEW |