Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: tests/standalone/src/SocketCloseTest.dart

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments by ager@ Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Test socket close events. 5 // Test socket close events.
6 6
7 7
8 final SERVERSHUTDOWN = -1; 8 final SERVERSHUTDOWN = -1;
9 final ITERATIONS = 10; 9 final ITERATIONS = 10;
10 10
11 11
12 // Run the close test in these different "modes".
13 // 0: Client closes without sending at all.
14 // 1: Client sends and closes.
15 // 2: Client sends. Server closes.
16 // 3: Client sends. Server responds and closes.
17 // 4: Client sends and half-closes. Server responds and closes.
18 // 5: Client sends. Server responds and half closes.
19 // 6: Client sends and half-closes. Server responds and half closes.
20 class SocketCloseTest {
21 static void testMain() {
22 new SocketClose.start(0);
23 new SocketClose.start(1);
24 new SocketClose.start(2);
25 new SocketClose.start(3);
26 new SocketClose.start(4);
27 new SocketClose.start(5);
28 new SocketClose.start(6);
29 }
30 }
31
32
33 class SocketClose { 12 class SocketClose {
34 13
35 SocketClose.start(mode) 14 SocketClose.start(mode)
36 : _receivePort = new ReceivePort(), 15 : _receivePort = new ReceivePort(),
37 _sendPort = null, 16 _sendPort = null,
38 _dataEvents = 0, 17 _dataEvents = 0,
39 _closeEvents = 0, 18 _closeEvents = 0,
40 _errorEvents = 0, 19 _errorEvents = 0,
41 _iterations = 0, 20 _iterations = 0,
42 _mode = mode { 21 _mode = mode {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 ServerSocket _server; 309 ServerSocket _server;
331 int _errorEvents; 310 int _errorEvents;
332 int _dataEvents; 311 int _dataEvents;
333 int _closeEvents; 312 int _closeEvents;
334 int _iterations; 313 int _iterations;
335 int _mode; 314 int _mode;
336 } 315 }
337 316
338 317
339 main() { 318 main() {
340 SocketCloseTest.testMain(); 319 // Run the close test in these different "modes".
320 // 0: Client closes without sending at all.
321 // 1: Client sends and closes.
322 // 2: Client sends. Server closes.
323 // 3: Client sends. Server responds and closes.
324 // 4: Client sends and half-closes. Server responds and closes.
325 // 5: Client sends. Server responds and half closes.
326 // 6: Client sends and half-closes. Server responds and half closes.
327 new SocketClose.start(0);
328 new SocketClose.start(1);
329 new SocketClose.start(2);
330 new SocketClose.start(3);
331 new SocketClose.start(4);
332 new SocketClose.start(5);
333 new SocketClose.start(6);
341 } 334 }
OLDNEW
« no previous file with comments | « tests/standalone/src/ReadIntoConstList.dart ('k') | tests/standalone/src/SocketStreamCloseTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698