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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 class TestServerCommand { | 55 class TestServerCommand { |
56 static const START = 0; | 56 static const START = 0; |
57 static const STOP = 1; | 57 static const STOP = 1; |
58 static const 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 const STARTED = 0; | 73 static const STARTED = 0; |
74 static const STOPPED = 1; | 74 static const STOPPED = 1; |
75 static const 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; |
86 | 86 |
87 int _state; | 87 int _state; |
88 int _port; | 88 int _port; |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 void startTestServer() { | 92 void startTestServer() { |
93 var server = new TestServer(); | 93 var server = new TestServer(); |
94 server.init(); | 94 server.init(); |
95 port.receive(server.dispatch); | 95 port.receive(server.dispatch); |
(...skipping 165 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 |