| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 Expect.equals(request.response, response); | 49 Expect.equals(request.response, response); |
| 50 server.close(); | 50 server.close(); |
| 51 }); | 51 }); |
| 52 }); | 52 }); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void testResponseAddStream() { | 55 void testResponseAddStream() { |
| 56 int bytes = new File(new Options().script).lengthSync(); | 56 int bytes = new File(new Options().script).lengthSync(); |
| 57 | 57 |
| 58 testServerRequest((server, request) { | 58 testServerRequest((server, request) { |
| 59 request.response.writeStream(new File(new Options().script).openRead()) | 59 request.response.addStream(new File(new Options().script).openRead()) |
| 60 .then((response) { | 60 .then((response) { |
| 61 response.close(); | 61 response.close(); |
| 62 response.done.then((_) => server.close()); | 62 response.done.then((_) => server.close()); |
| 63 }); | 63 }); |
| 64 }, bytes: bytes); | 64 }, bytes: bytes); |
| 65 | 65 |
| 66 testServerRequest((server, request) { | 66 testServerRequest((server, request) { |
| 67 request.response.writeStream(new File(new Options().script).openRead()) | 67 request.response.addStream(new File(new Options().script).openRead()) |
| 68 .then((response) { | 68 .then((response) { |
| 69 request.response.writeStream(new File(new Options().script).openRead()
) | 69 request.response.addStream(new File(new Options().script).openRead()) |
| 70 .then((response) { | 70 .then((response) { |
| 71 response.close(); | 71 response.close(); |
| 72 response.done.then((_) => server.close()); | 72 response.done.then((_) => server.close()); |
| 73 }); | 73 }); |
| 74 }); | 74 }); |
| 75 }, bytes: bytes * 2); | 75 }, bytes: bytes * 2); |
| 76 | 76 |
| 77 testServerRequest((server, request) { | 77 testServerRequest((server, request) { |
| 78 var controller = new StreamController(); | 78 var controller = new StreamController(); |
| 79 request.response.writeStream(controller.stream) | 79 request.response.addStream(controller.stream) |
| 80 .then((response) { | 80 .then((response) { |
| 81 response.close(); | 81 response.close(); |
| 82 response.done.then((_) => server.close()); | 82 response.done.then((_) => server.close()); |
| 83 }); | 83 }); |
| 84 controller.close(); | 84 controller.close(); |
| 85 }, bytes: 0); | 85 }, bytes: 0); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void testBadResponseAdd() { | 88 void testBadResponseAdd() { |
| 89 testServerRequest((server, request) { | 89 testServerRequest((server, request) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 }, test: (e) => e is HttpException); | 135 }, test: (e) => e is HttpException); |
| 136 }); | 136 }); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void main() { | 139 void main() { |
| 140 testResponseDone(); | 140 testResponseDone(); |
| 141 testResponseAddStream(); | 141 testResponseAddStream(); |
| 142 testBadResponseAdd(); | 142 testBadResponseAdd(); |
| 143 testBadResponseClose(); | 143 testBadResponseClose(); |
| 144 } | 144 } |
| OLD | NEW |