| OLD | NEW |
| 1 // Copyright (c) 2012, 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 import "dart:io"; | 5 import "dart:io"; |
| 6 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 import "dart:math"; | 7 import "dart:math"; |
| 8 | 8 |
| 9 class ExpectedDataOutputStream implements OutputStream { | 9 class ExpectedDataOutputStream implements OutputStream { |
| 10 ExpectedDataOutputStream(List<int> this._data, | 10 ExpectedDataOutputStream(List<int> this._data, |
| 11 int this._cutoff, | 11 int this._cutoff, |
| 12 bool this._closeAsError, | 12 bool this._closeAsError, |
| 13 SocketMock this._socket); | 13 SocketMock this._socket); |
| 14 | 14 |
| 15 void set onNoPendingWrites(void callback()) { | 15 void set onNoPendingWrites(void callback()) { |
| 16 _onNoPendingWrites = callback; | 16 _onNoPendingWrites = callback; |
| 17 } | 17 } |
| 18 | 18 |
| 19 void set onClosed(void callback()) { |
| 20 // Not used in test. |
| 21 } |
| 22 |
| 19 void set onError(void callback(e)) { | 23 void set onError(void callback(e)) { |
| 20 _onError = callback; | 24 _onError = callback; |
| 21 } | 25 } |
| 22 | 26 |
| 23 bool write(List data, [bool copyBuffer = true]) { | 27 bool write(List data, [bool copyBuffer = true]) { |
| 24 _onData(data); | 28 _onData(data); |
| 25 return true; | 29 return true; |
| 26 } | 30 } |
| 27 | 31 |
| 28 bool writeFrom(List data, [int offset = 0, int len]) { | 32 bool writeFrom(List data, [int offset = 0, int len]) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 "GET / HTTP/1.1\r\nKeep-Alive: False\r\n\r\n", | 228 "GET / HTTP/1.1\r\nKeep-Alive: False\r\n\r\n", |
| 225 "HTTP/1.1 200 OK\r\ntransfer-encoding: chunked\r\nconnection: close" | 229 "HTTP/1.1 200 OK\r\ntransfer-encoding: chunked\r\nconnection: close" |
| 226 "\r\n\r\n0\r\n\r\n"); | 230 "\r\n\r\n0\r\n\r\n"); |
| 227 | 231 |
| 228 server.close(); | 232 server.close(); |
| 229 } | 233 } |
| 230 | 234 |
| 231 void main() { | 235 void main() { |
| 232 testSocketClose(); | 236 testSocketClose(); |
| 233 } | 237 } |
| OLD | NEW |