| 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 // The --short_socket_write option does not work with external server | 7 // The --short_socket_write option does not work with external server |
| 8 // www.google.dk. Add this to the test when we have secure server sockets. | 8 // www.google.dk. Add this to the test when we have secure server sockets. |
| 9 // See TODO below. | 9 // See TODO below. |
| 10 | 10 |
| 11 import "package:expect/expect.dart"; |
| 11 import "dart:async"; | 12 import "dart:async"; |
| 12 import "dart:isolate"; | 13 import "dart:isolate"; |
| 13 import "dart:io"; | 14 import "dart:io"; |
| 14 | 15 |
| 15 void WriteAndClose(Socket socket, String message) { | 16 void WriteAndClose(Socket socket, String message) { |
| 16 var data = message.charCodes; | 17 var data = message.charCodes; |
| 17 int written = 0; | 18 int written = 0; |
| 18 void write() { | 19 void write() { |
| 19 written += socket.writeList(data, written, data.length - written); | 20 written += socket.writeList(data, written, data.length - written); |
| 20 if (written < data.length) { | 21 if (written < data.length) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 String fullPage = Strings.concatAll(chunks); | 67 String fullPage = Strings.concatAll(chunks); |
| 67 Expect.isTrue(fullPage.contains('</body></html>')); | 68 Expect.isTrue(fullPage.contains('</body></html>')); |
| 68 completer.complete(null); | 69 completer.complete(null); |
| 69 }; | 70 }; |
| 70 secure.onError = (e) { | 71 secure.onError = (e) { |
| 71 Expect.isFalse(acceptCertificate); | 72 Expect.isFalse(acceptCertificate); |
| 72 completer.complete(null); | 73 completer.complete(null); |
| 73 }; | 74 }; |
| 74 return completer.future; | 75 return completer.future; |
| 75 } | 76 } |
| OLD | NEW |