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

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

Issue 10386010: Add enumeration of the HTTP headers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
« runtime/bin/http.dart ('K') | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_headers_test.dart
diff --git a/tests/standalone/io/http_headers_test.dart b/tests/standalone/io/http_headers_test.dart
index a5012fd06bedfb4efc4782f54eb5e772994c6a59..980c7c610cdd4f3a73a4da71c0550d52d8788ba2 100644
--- a/tests/standalone/io/http_headers_test.dart
+++ b/tests/standalone/io/http_headers_test.dart
@@ -139,8 +139,35 @@ void testHost() {
Expect.equals(1234, headers.port);
}
+void testEnumeration() {
+ _HttpHeaders headers = new _HttpHeaders();
+ Expect.isNull(headers[HttpHeaders.PRAGMA]);
+ headers.add("My-Header-1", "value 1");
+ headers.add("My-Header-2", "value 2");
+ headers.add("My-Header-1", "value 3");
+ bool myHeader1 = false;
+ bool myHeader2 = false;
+ int totalValues = 0;
+ headers.forEach(f(String name, List<String> values) {
+ totalValues += values.length;
+ if (name == "my-header-1") {
+ myHeader1 = true;
+ Expect.isTrue(values.indexOf("value 1") != -1);
+ Expect.isTrue(values.indexOf("value 3") != -1);
+ }
+ if (name == "my-header-2") {
+ myHeader2 = true;
+ Expect.isTrue(values.indexOf("value 2") != -1);
+ }
+ });
+ Expect.isTrue(myHeader1);
+ Expect.isTrue(myHeader2);
+ Expect.equals(3, totalValues);
+}
+
main() {
testMultiValue();
testExpires();
testHost();
+ testEnumeration();
}
« runtime/bin/http.dart ('K') | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698