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

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

Issue 11419138: Rename TlsSocket to SecureSocket, and all other Tls... items to Secure.... (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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
(...skipping 10 matching lines...) Expand all
21 } else { 21 } else {
22 socket.close(true); 22 socket.close(true);
23 } 23 }
24 } 24 }
25 write(); 25 write();
26 } 26 }
27 27
28 void main() { 28 void main() {
29 var testPkcertDatabase = 29 var testPkcertDatabase =
30 new Path.fromNative(new Options().script).directoryPath.append('pkcert/'); 30 new Path.fromNative(new Options().script).directoryPath.append('pkcert/');
31 TlsSocket.setCertificateDatabase(testPkcertDatabase.toNativePath()); 31 SecureSocket.setCertificateDatabase(testPkcertDatabase.toNativePath());
32 // TODO(3593): Use a Dart HTTPS server for this test using TLS server sockets. 32 // TODO(3593): Use a Dart HTTPS server for this test using SECURE server socke ts.
Mads Ager (google) 2012/11/23 07:31:15 Long line and SECURE -> secure.
33 // When we use a Dart HTTPS server, allow --short_socket_write. The flag 33 // When we use a Dart HTTPS server, allow --short_socket_write. The flag
34 // causes fragmentation of the client hello message, which doesn't seem to 34 // causes fragmentation of the client hello message, which doesn't seem to
35 // work with www.google.dk. 35 // work with www.google.dk.
36 var tls = new TlsSocket("www.google.dk", 443); 36 var secure = new SecureSocket("www.google.dk", 443);
37 List<String> chunks = <String>[]; 37 List<String> chunks = <String>[];
38 tls.onConnect = () { 38 secure.onConnect = () {
39 WriteAndClose(tls, "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n"); 39 WriteAndClose(secure, "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n");
40 }; 40 };
41 var useReadList; // Mutually recursive onData callbacks. 41 var useReadList; // Mutually recursive onData callbacks.
42 void useRead() { 42 void useRead() {
43 var data = tls.read(); 43 var data = secure.read();
44 var received = new String.fromCharCodes(data); 44 var received = new String.fromCharCodes(data);
45 chunks.add(received); 45 chunks.add(received);
46 tls.onData = useReadList; 46 secure.onData = useReadList;
47 } 47 }
48 useReadList = () { 48 useReadList = () {
49 var buffer = new List(2000); 49 var buffer = new List(2000);
50 int len = tls.readList(buffer, 0, 2000); 50 int len = secure.readList(buffer, 0, 2000);
51 var received = new String.fromCharCodes(buffer.getRange(0, len)); 51 var received = new String.fromCharCodes(buffer.getRange(0, len));
52 chunks.add(received); 52 chunks.add(received);
53 tls.onData = useRead; 53 secure.onData = useRead;
54 }; 54 };
55 tls.onData = useRead; 55 secure.onData = useRead;
56 tls.onClosed = () { 56 secure.onClosed = () {
57 String fullPage = Strings.concatAll(chunks); 57 String fullPage = Strings.concatAll(chunks);
58 Expect.isTrue(fullPage.contains('</body></html>')); 58 Expect.isTrue(fullPage.contains('</body></html>'));
59 }; 59 };
60 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698