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

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: 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
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..28c0dcb6004b6b38278509abe707d6b5d7fd6ec0 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,34 @@ 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) {
+ new File("test.dart").openInputStream().pipe(response.outputStream);
Mads Ager (google) 2013/01/15 12:39:03 Do you want it to find a file here? I guess you ju
Søren Gjesse 2013/01/15 12:57:45 Done, thanks.
+ };
+
+ 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();
}

Powered by Google App Engine
This is Rietveld 408576698