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

Unified Diff: tests/standalone/io/tls_socket_test.dart

Issue 10704159: Start adding TLS (SSL) sockets to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tls_socket.dart back. This should not be compared to socket.dart. Created 8 years, 5 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_linux.cc ('K') | « runtime/include/dart_api.h ('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..eb4839c9cc535680e9a5fb6510ad5709ac1e5381
--- /dev/null
+++ b/tests/standalone/io/tls_socket_test.dart
@@ -0,0 +1,43 @@
+// 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 tls = new TlsSocket("www.google.dk", 443);
+ String message = '';
+ tls.onConnect = () {
+ var get_list =
+ "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes();
Søren Gjesse 2012/07/31 09:07:15 Perhaps use HTTP/1.1 for the test.
+ // tls.writeList(get_list, 0, get_list.length);
+ var push = new Timer(5000, (ignore) {
+ tls.writeList(get_list, 0, 20);
+ tls.writeList(get_list, 20, get_list.length - 20);
+ });
+
+ };
+ tls.onData = () {
+ var buffer = new List(2000);
+ int len = tls.readList(buffer, 0, 2000);
+ print('length: $len');
+ var received = new String.fromCharCodes(buffer.getRange(0, len));
+ message = '$message$received';
+ print(received);
+ // if (isCompleteChunkedTransfer(message)) {
Mads Ager (google) 2012/07/31 10:16:01 Code in comment.
Bill Hesse 2012/08/08 17:00:05 Done.
+ // tls.close();
+ //}
+ };
+ tls.onClosed = () {
+ print('tls close event fired');
+ // tls.close();
Mads Ager (google) 2012/07/31 10:16:01 Code in comment.
Bill Hesse 2012/08/08 17:00:05 Done.
+ print(message);
+ print('\nREACHED END OF TEST');
+ };
+}
« runtime/bin/tls_socket_linux.cc ('K') | « runtime/include/dart_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698