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

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

Issue 10916081: Add secure sockets to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments (done). Created 8 years, 1 month 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
« runtime/bin/tls_socket.cc ('K') | « runtime/bin/tls_socket_patch.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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9
10 #import("dart:isolate");
11 #import("dart:io");
12
13 void main() {
14 var testPkcertDatabase =
15 new Path.fromNative(new Options().script).directoryPath.append('pkcert/');
Mads Ager (google) 2012/11/01 10:09:01 I do not see a pkcert directory in this change? W
16 TlsSocket.setCertificateDatabase(testPkcertDatabase.toNativePath());
17 // TODO(3593): Use a Dart HTTPS server for this test using TLS server sockets.
18 var tls = new TlsSocket("www.google.dk", 443);
19 // var tls = new Socket("www.google.dk", 80);
20 List<String> chunks = <String>[];
21 tls.onConnect = () {
22 var get_list =
23 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes;
24 tls.writeList(get_list, 0, 20);
25 tls.writeList(get_list, 20, get_list.length - 20);
26 };
27 tls.onData = () {
28 var buffer = new List(2000);
29 int len = tls.readList(buffer, 0, 2000);
30 var received = new String.fromCharCodes(buffer.getRange(0, len));
31 chunks.add(received);
32 };
33 tls.onClosed = () {
34 String fullPage = Strings.concatAll(chunks);
35 print(fullPage);
36 Expect.isTrue(fullPage.contains('</body></html>'));
37 tls.close();
38 };
39 }
OLDNEW
« runtime/bin/tls_socket.cc ('K') | « runtime/bin/tls_socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698