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

Unified Diff: tests/standalone/src/io/HttpContentLengthTest.dart

Issue 10252020: test rename overhaul: step 12 - standalone (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « tests/standalone/src/io/HttpClientTest.dart ('k') | tests/standalone/src/io/HttpDateTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpContentLengthTest.dart
diff --git a/tests/standalone/src/io/HttpContentLengthTest.dart b/tests/standalone/src/io/HttpContentLengthTest.dart
deleted file mode 100644
index cf2614588f647c6def0d187187f3c253d8ca7087..0000000000000000000000000000000000000000
--- a/tests/standalone/src/io/HttpContentLengthTest.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012, 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.
-//
-
-#import("dart:isolate");
-#import("dart:io");
-
-void testNoBody(int totalConnections) {
- HttpServer server = new HttpServer();
- server.onError = (e) => Expect.fail("Unexpected error $e");
- server.listen("127.0.0.1", 0, totalConnections);
- server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
- response.contentLength = 0;
- OutputStream stream = response.outputStream;
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- };
-
- int count = 0;
- HttpClient client = new HttpClient();
- for (int i = 0; i < totalConnections; i++) {
- HttpClientConnection conn = client.get("127.0.0.1", server.port, "/");
- conn.onError = (e) => Expect.fail("Unexpected error $e");
- conn.onRequest = (HttpClientRequest request) {
- OutputStream stream = request.outputStream;
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- };
- conn.onResponse = (HttpClientResponse response) {
- count++;
- if (count == totalConnections) {
- client.shutdown();
- server.close();
- }
- };
- }
-}
-
-void testBody(int totalConnections) {
- HttpServer server = new HttpServer();
- server.onError = (e) => Expect.fail("Unexpected error $e");
- server.listen("127.0.0.1", 0, totalConnections);
- server.defaultRequestHandler = (HttpRequest request, HttpResponse response) {
- response.contentLength = 2;
- OutputStream stream = response.outputStream;
- stream.writeString("x");
- Expect.throws(() => response.contentLength = 3, (e) => e is HttpException);
- stream.writeString("x");
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- };
-
- int count = 0;
- HttpClient client = new HttpClient();
- for (int i = 0; i < totalConnections; i++) {
- HttpClientConnection conn = client.get("127.0.0.1", server.port, "/");
- conn.onError = (e) => Expect.fail("Unexpected error $e");
- conn.onRequest = (HttpClientRequest request) {
- request.contentLength = 2;
- OutputStream stream = request.outputStream;
- stream.writeString("x");
- Expect.throws(() => request.contentLength = 3, (e) => e is HttpException);
- stream.writeString("x");
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- stream.close();
- Expect.throws(() => stream.writeString("x"), (e) => e is HttpException);
- };
- conn.onResponse = (HttpClientResponse response) {
- count++;
- if (count == totalConnections) {
- client.shutdown();
- server.close();
- }
- };
- }
-}
-
-void main() {
- testNoBody(5);
- testBody(5);
-}
« no previous file with comments | « tests/standalone/src/io/HttpClientTest.dart ('k') | tests/standalone/src/io/HttpDateTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698