OLD | NEW |
1 // Copyright (c) 2013, 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 // 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_write --short_socket_read | 8 // VMOptions=--short_socket_write --short_socket_read |
9 // The --short_socket_write option does not work with external server | 9 // The --short_socket_write option does not work with external server |
10 // www.google.dk. Add this to the test when we have secure server sockets. | 10 // www.google.dk. Add this to the test when we have secure server sockets. |
11 // See TODO below. | 11 // See TODO below. |
12 | 12 |
| 13 import "package:expect/expect.dart"; |
13 import "dart:async"; | 14 import "dart:async"; |
14 import "dart:isolate"; | 15 import "dart:isolate"; |
15 import "dart:io"; | 16 import "dart:io"; |
16 | 17 |
17 void main() { | 18 void main() { |
18 ReceivePort keepAlive = new ReceivePort(); | 19 ReceivePort keepAlive = new ReceivePort(); |
19 SecureSocket.initialize(useBuiltinRoots: false); | 20 SecureSocket.initialize(useBuiltinRoots: false); |
20 testCertificateCallback(host: "www.google.dk", | 21 testCertificateCallback(host: "www.google.dk", |
21 acceptCertificate: false).then((_) { | 22 acceptCertificate: false).then((_) { |
22 testCertificateCallback(host: "www.google.dk", | 23 testCertificateCallback(host: "www.google.dk", |
(...skipping 30 matching lines...) Expand all Loading... |
53 socket.close(); | 54 socket.close(); |
54 return socket.fold(<int>[], (message, data) => message..addAll(data)) | 55 return socket.fold(<int>[], (message, data) => message..addAll(data)) |
55 .then((message) { | 56 .then((message) { |
56 String received = new String.fromCharCodes(message); | 57 String received = new String.fromCharCodes(message); |
57 Expect.isTrue(received.contains('</body></html>')); | 58 Expect.isTrue(received.contains('</body></html>')); |
58 }); | 59 }); |
59 }).catchError((e) { | 60 }).catchError((e) { |
60 Expect.isFalse(acceptCertificate); | 61 Expect.isFalse(acceptCertificate); |
61 }); | 62 }); |
62 } | 63 } |
OLD | NEW |