OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // | 4 // |
5 // VMOptions= | 5 // VMOptions= |
6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
7 // The --short_socket_write option does not work with external server | 7 // The --short_socket_write option does not work with external server |
8 // www.google.dk. Add this to the test when we have secure server sockets. | 8 // www.google.dk. Add this to the test when we have secure server sockets. |
9 // See TODO below. | 9 // See TODO below. |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 WriteAndClose(secure, "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n"); | 38 WriteAndClose(secure, "GET / HTTP/1.0\r\nHost: www.google.dk\r\n\r\n"); |
39 }; | 39 }; |
40 var useReadList; // Mutually recursive onData callbacks. | 40 var useReadList; // Mutually recursive onData callbacks. |
41 void useRead() { | 41 void useRead() { |
42 var data = secure.read(); | 42 var data = secure.read(); |
43 var received = new String.fromCharCodes(data); | 43 var received = new String.fromCharCodes(data); |
44 chunks.add(received); | 44 chunks.add(received); |
45 secure.onData = useReadList; | 45 secure.onData = useReadList; |
46 } | 46 } |
47 useReadList = () { | 47 useReadList = () { |
48 var buffer = new List(2000); | 48 var buffer = new List.fixedLength(2000); |
49 int len = secure.readList(buffer, 0, 2000); | 49 int len = secure.readList(buffer, 0, 2000); |
50 var received = new String.fromCharCodes(buffer.getRange(0, len)); | 50 var received = new String.fromCharCodes(buffer.getRange(0, len)); |
51 chunks.add(received); | 51 chunks.add(received); |
52 secure.onData = useRead; | 52 secure.onData = useRead; |
53 }; | 53 }; |
54 secure.onData = useRead; | 54 secure.onData = useRead; |
55 secure.onClosed = () { | 55 secure.onClosed = () { |
56 String fullPage = Strings.concatAll(chunks); | 56 String fullPage = Strings.concatAll(chunks); |
57 Expect.isTrue(fullPage.contains('</body></html>')); | 57 Expect.isTrue(fullPage.contains('</body></html>')); |
58 keepAlive.close(); | 58 keepAlive.close(); |
59 }; | 59 }; |
60 } | 60 } |
OLD | NEW |