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"; | |
14 import "dart:async"; | 13 import "dart:async"; |
15 import "dart:isolate"; | 14 import "dart:isolate"; |
16 import "dart:io"; | 15 import "dart:io"; |
17 | 16 |
18 void main() { | 17 void main() { |
19 ReceivePort keepAlive = new ReceivePort(); | 18 ReceivePort keepAlive = new ReceivePort(); |
20 SecureSocket.initialize(useBuiltinRoots: false); | 19 SecureSocket.initialize(useBuiltinRoots: false); |
21 testCertificateCallback(host: "www.google.dk", | 20 testCertificateCallback(host: "www.google.dk", |
22 acceptCertificate: false).then((_) { | 21 acceptCertificate: false).then((_) { |
23 testCertificateCallback(host: "www.google.dk", | 22 testCertificateCallback(host: "www.google.dk", |
(...skipping 30 matching lines...) Expand all Loading... |
54 socket.close(); | 53 socket.close(); |
55 return socket.reduce(<int>[], (message, data) => message..addAll(data)) | 54 return socket.reduce(<int>[], (message, data) => message..addAll(data)) |
56 .then((message) { | 55 .then((message) { |
57 String received = new String.fromCharCodes(message); | 56 String received = new String.fromCharCodes(message); |
58 Expect.isTrue(received.contains('</body></html>')); | 57 Expect.isTrue(received.contains('</body></html>')); |
59 }); | 58 }); |
60 }).catchError((e) { | 59 }).catchError((e) { |
61 Expect.isFalse(acceptCertificate); | 60 Expect.isFalse(acceptCertificate); |
62 }); | 61 }); |
63 } | 62 } |
OLD | NEW |