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

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

Issue 11879042: Improve the error-propagation on socket streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 7 years, 11 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
« no previous file with comments | « sdk/lib/io/socket_stream_impl.dart ('k') | tests/standalone/io/http_server_socket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_server_early_client_close_test.dart
diff --git a/tests/standalone/io/http_server_early_client_close_test.dart b/tests/standalone/io/http_server_early_client_close_test.dart
index a6b19ce21ac4bf133afc239564a427a381610a9f..624442ffcd40206c56b2b1aedfaf5f24ae5d4cbe 100644
--- a/tests/standalone/io/http_server_early_client_close_test.dart
+++ b/tests/standalone/io/http_server_early_client_close_test.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, 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.
@@ -60,7 +60,7 @@ class EarlyCloseTest {
final bool expectRequest;
}
-void testEarlyClose() {
+void testEarlyClose1() {
List<EarlyCloseTest> tests = new List<EarlyCloseTest>();
void add(Object data, String exception, {bool expectRequest: false}) {
tests.add(new EarlyCloseTest(data, exception, expectRequest));
@@ -95,6 +95,35 @@ void testEarlyClose() {
runTest(tests.iterator);
}
+testEarlyClose2() {
+ var server = new HttpServer();
+ server.listen("127.0.0.1", 0);
+ server.onError = (e) { /* ignore */ };
+ server.defaultRequestHandler = (request, response) {
+ String name = new Options().script;
+ new File(name).openInputStream().pipe(response.outputStream);
+ };
+
+ var count = 0;
+ var makeRequest;
+ makeRequest = () {
+ Socket socket = new Socket("127.0.0.1", server.port);
+ socket.onConnect = () {
+ var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n".charCodes;
+ socket.writeList(data, 0, data.length);
+ socket.close();
+ if (++count < 10) {
+ makeRequest();
+ } else {
+ server.close();
+ }
+ };
+ };
+
+ makeRequest();
+}
+
void main() {
- testEarlyClose();
+ testEarlyClose1();
+ testEarlyClose2();
}
« no previous file with comments | « sdk/lib/io/socket_stream_impl.dart ('k') | tests/standalone/io/http_server_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698