Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/'); | |
| 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); | |
|
Søren Gjesse
2012/11/01 11:49:11
Code in comments.
Bill Hesse
2012/11/11 22:34:34
Done.
| |
| 20 String message = ''; | |
| 21 tls.onConnect = () { | |
| 22 foo1(); | |
| 23 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:
| |
| 24 "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n".charCodes; | |
| 25 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
| |
| 26 foo2(); | |
| 27 tls.writeList(get_list, 20, get_list.length - 20); | |
| 28 }; | |
| 29 tls.onData = () { | |
| 30 foo3(); | |
| 31 var buffer = new List(2000); | |
| 32 int len = tls.readList(buffer, 0, 2000); | |
| 33 var received = new String.fromCharCodes(buffer.getRange(0, len)); | |
| 34 message = '$message$received'; | |
| 35 }; | |
| 36 tls.onClosed = () { | |
| 37 print(message); | |
| 38 Expect.isTrue(message.contains('</script></body></html>')); | |
| 39 tls.close(); | |
| 40 }; | |
| 41 } | |
| 42 | |
| 43 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
| |
| 44 void foo2() {} | |
| 45 void foo3() {} | |
| 46 void foo4() {} | |
| OLD | NEW |