Chromium Code Reviews| 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..cd6830afe8f29988541276b2f7751022e3fccc12 |
| --- /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() { |
| + TlsSocket.setCertificateDatabase( |
| + "/usr/local/google/home/whesse/ssd/dart/runtime/bin/net/pkcert/"); |
| + // 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 TlsSocket("www.google.dk", 80); |
| + // var tls = new Socket("www.google.dk", 80); |
| + String message = ''; |
| + tls.onConnect = () { |
| + foo1(); |
| + var get_list = |
| + "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes(); |
| + tls.writeList(get_list, 0, 20); |
| + 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() {} |
|
Mads Ager (google)
2012/09/28 12:03:57
Remove these.
Bill Hesse
2012/10/31 16:33:29
Done.
|
| +void foo2() {} |
| +void foo3() {} |
| +void foo4() {} |