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

Unified 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: Fix typo in bin.gypi Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/tls_socket_impl.dart ('K') | « runtime/bin/tls_socket_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/tls_socket_test.dart
diff --git a/tests/standalone/io/tls_socket_test.dart b/tests/standalone/io/tls_socket_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..891db48ea1af46a2853eb501f245ad87f0ec333b
--- /dev/null
+++ b/tests/standalone/io/tls_socket_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// VMOptions=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+#import("dart:isolate");
+#import("dart:io");
+
+void main() {
+ var testPkcertDatabase =
+ new Path.fromNative(new Options().script).directoryPath.append('pkcert/');
+ TlsSocket.setCertificateDatabase(testPkcertDatabase.toNativePath());
+ // TODO(3593): Use a Dart HTTPS server for this test using TLS server sockets.
+ var tls = new TlsSocket("www.google.dk", 443);
+ // var tls = new Socket("www.google.dk", 80);
Søren Gjesse 2012/11/01 11:49:11 Code in comments.
Bill Hesse 2012/11/11 22:34:34 Done.
+ String message = '';
+ tls.onConnect = () {
+ foo1();
+ var get_list =
Søren Gjesse 2012/11/01 11:49:11 get_list -> get_bytes?
Bill Hesse 2012/11/11 22:34:34 request_bytes is even better. On 2012/11/01 11:49:
+ "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes;
+ tls.writeList(get_list, 0, 20);
Søren Gjesse 2012/11/01 11:49:11 Maybe extend the test to performing this several t
Bill Hesse 2012/11/11 22:34:34 We will be modifying it to use a local server, and
+ foo2();
+ tls.writeList(get_list, 20, get_list.length - 20);
+ };
+ tls.onData = () {
+ foo3();
+ var buffer = new List(2000);
+ int len = tls.readList(buffer, 0, 2000);
+ var received = new String.fromCharCodes(buffer.getRange(0, len));
+ message = '$message$received';
+ };
+ tls.onClosed = () {
+ print(message);
+ Expect.isTrue(message.contains('</script></body></html>'));
+ tls.close();
+ };
+}
+
+void foo1() {}
Søren Gjesse 2012/11/01 11:49:11 What is the purpose of these fooX functions?
Bill Hesse 2012/11/11 22:34:34 Removed. On 2012/11/01 11:49:11, Søren Gjesse wrot
+void foo2() {}
+void foo3() {}
+void foo4() {}
« runtime/bin/tls_socket_impl.dart ('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