Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: tests/standalone/io/secure_stream_test.dart

Issue 11415290: Add a callback to SecureSocket for certificates that fail to be authenticated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Free persistent handle upon destruction. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/secure_socket_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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("dart:isolate"); 11 #import("dart:isolate");
12 #import("dart:io"); 12 #import("dart:io");
13 13
14 void main() { 14 void main() {
15 ReceivePort keepAlive = new ReceivePort();
15 SecureSocket.initialize(); 16 SecureSocket.initialize();
16 // TODO(3593): Use a Dart HTTPS server for this test. 17 // TODO(3593): Use a Dart HTTPS server for this test.
17 // When we use a Dart HTTPS server, allow --short_socket_write. The flag 18 // When we use a Dart HTTPS server, allow --short_socket_write. The flag
18 // causes fragmentation of the client hello message, which doesn't seem to 19 // causes fragmentation of the client hello message, which doesn't seem to
19 // work with www.google.dk. 20 // work with www.google.dk.
20 var secure = new SecureSocket("www.google.dk", 443); 21 var secure = new SecureSocket("www.google.dk", 443);
21 List<String> chunks = <String>[]; 22 List<String> chunks = <String>[];
22 var input = secure.inputStream; 23 var input = secure.inputStream;
23 var output = secure.outputStream; 24 var output = secure.outputStream;
24 25
25 output.write("GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes); 26 output.write("GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes);
26 output.close(); 27 output.close();
27 input.onData = () { 28 input.onData = () {
28 chunks.add(new String.fromCharCodes(input.read())); 29 chunks.add(new String.fromCharCodes(input.read()));
29 }; 30 };
30 input.onClosed = () { 31 input.onClosed = () {
31 String fullPage = Strings.concatAll(chunks); 32 String fullPage = Strings.concatAll(chunks);
32 Expect.isTrue(fullPage.contains('</body></html>')); 33 Expect.isTrue(fullPage.contains('</body></html>'));
34 keepAlive.close();
33 }; 35 };
34 } 36 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698