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

Unified Diff: tests/standalone/src/io/HttpHeadersState.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/HttpDateTest.dart ('k') | tests/standalone/src/io/HttpHeadersTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpHeadersState.dart
diff --git a/tests/standalone/src/io/HttpHeadersState.dart b/tests/standalone/src/io/HttpHeadersState.dart
deleted file mode 100644
index c84c7fabdaaaee1adb4768a3c4b4b8f0110aaa4e..0000000000000000000000000000000000000000
--- a/tests/standalone/src/io/HttpHeadersState.dart
+++ /dev/null
@@ -1,73 +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 test(int totalConnections, [String body]) {
- 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) {
- // Cannot mutate request headers.
- Expect.throws(() => request.headers.add("X-Request-Header", "value"),
- (e) => e is HttpException);
- Expect.equals("value", request.headers.value("X-Request-Header"));
- OutputStream stream = response.outputStream;
- // Can still mutate response headers as long as no data has been sent.
- response.headers.add("X-Response-Header", "value");
- if (body != null) {
- stream.writeString(body);
- // Cannot mutate response headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value2"),
- (e) => e is HttpException);
- }
- stream.close();
- // Cannot mutate response headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value3"),
- (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) {
- if (body != null) {
- request.contentLength = -1;
- }
- OutputStream stream = request.outputStream;
- // Can still mutate request headers as long as no data has been sent.
- request.headers.add("X-Request-Header", "value");
- if (body != null) {
- stream.writeString(body);
- // Cannot mutate request headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value2"),
- (e) => e is HttpException);
- }
- stream.close();
- // Cannot mutate request headers when data has been sent.
- Expect.throws(() => request.headers.add("X-Request-Header", "value3"),
- (e) => e is HttpException);
- };
- conn.onResponse = (HttpClientResponse response) {
- // Cannot mutate response headers.
- Expect.throws(() => response.headers.add("X-Response-Header", "value"),
- (e) => e is HttpException);
- Expect.equals("value", response.headers.value("X-Response-Header"));
- count++;
- if (count == totalConnections) {
- client.shutdown();
- server.close();
- }
- };
- }
-}
-
-void main() {
- test(5);
- test(5, "Hello and goodbye");
-}
« no previous file with comments | « tests/standalone/src/io/HttpDateTest.dart ('k') | tests/standalone/src/io/HttpHeadersTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698