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 // 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:isolate"); | 10 #import("dart:isolate"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 new TestServerCommand.chunkedEncoding(), _statusPort.toSendPort()); | 46 new TestServerCommand.chunkedEncoding(), _statusPort.toSendPort()); |
47 } | 47 } |
48 | 48 |
49 ReceivePort _statusPort; // Port for receiving messages from the server. | 49 ReceivePort _statusPort; // Port for receiving messages from the server. |
50 SendPort _serverPort; // Port for sending messages to the server. | 50 SendPort _serverPort; // Port for sending messages to the server. |
51 var _startedCallback; | 51 var _startedCallback; |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 class TestServerCommand { | 55 class TestServerCommand { |
56 static final START = 0; | 56 static const START = 0; |
57 static final STOP = 1; | 57 static const STOP = 1; |
58 static final CHUNKED_ENCODING = 2; | 58 static const CHUNKED_ENCODING = 2; |
59 | 59 |
60 TestServerCommand.start() : _command = START; | 60 TestServerCommand.start() : _command = START; |
61 TestServerCommand.stop() : _command = STOP; | 61 TestServerCommand.stop() : _command = STOP; |
62 TestServerCommand.chunkedEncoding() : _command = CHUNKED_ENCODING; | 62 TestServerCommand.chunkedEncoding() : _command = CHUNKED_ENCODING; |
63 | 63 |
64 bool get isStart() => _command == START; | 64 bool get isStart() => _command == START; |
65 bool get isStop() => _command == STOP; | 65 bool get isStop() => _command == STOP; |
66 bool get isChunkedEncoding() => _command == CHUNKED_ENCODING; | 66 bool get isChunkedEncoding() => _command == CHUNKED_ENCODING; |
67 | 67 |
68 int _command; | 68 int _command; |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 class TestServerStatus { | 72 class TestServerStatus { |
73 static final STARTED = 0; | 73 static const STARTED = 0; |
74 static final STOPPED = 1; | 74 static const STOPPED = 1; |
75 static final ERROR = 2; | 75 static const ERROR = 2; |
76 | 76 |
77 TestServerStatus.started(this._port) : _state = STARTED; | 77 TestServerStatus.started(this._port) : _state = STARTED; |
78 TestServerStatus.stopped() : _state = STOPPED; | 78 TestServerStatus.stopped() : _state = STOPPED; |
79 TestServerStatus.error() : _state = ERROR; | 79 TestServerStatus.error() : _state = ERROR; |
80 | 80 |
81 bool get isStarted() => _state == STARTED; | 81 bool get isStarted() => _state == STARTED; |
82 bool get isStopped() => _state == STOPPED; | 82 bool get isStopped() => _state == STOPPED; |
83 bool get isError() => _state == ERROR; | 83 bool get isError() => _state == ERROR; |
84 | 84 |
85 int get port() => _port; | 85 int get port() => _port; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 testServerMain.start(); | 262 testServerMain.start(); |
263 } | 263 } |
264 | 264 |
265 void main() { | 265 void main() { |
266 testReadInto(true); | 266 testReadInto(true); |
267 testReadInto(false); | 267 testReadInto(false); |
268 testReadShort(true); | 268 testReadShort(true); |
269 testReadShort(false); | 269 testReadShort(false); |
270 } | 270 } |
OLD | NEW |