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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« runtime/bin/http.dart ('K') | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #source("../../../runtime/bin/input_stream.dart"); 5 #source("../../../runtime/bin/input_stream.dart");
6 #source("../../../runtime/bin/output_stream.dart"); 6 #source("../../../runtime/bin/output_stream.dart");
7 #source("../../../runtime/bin/chunked_stream.dart"); 7 #source("../../../runtime/bin/chunked_stream.dart");
8 #source("../../../runtime/bin/string_stream.dart"); 8 #source("../../../runtime/bin/string_stream.dart");
9 #source("../../../runtime/bin/stream_util.dart"); 9 #source("../../../runtime/bin/stream_util.dart");
10 #source("../../../runtime/bin/http.dart"); 10 #source("../../../runtime/bin/http.dart");
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Expect.equals(host, headers.host); 132 Expect.equals(host, headers.host);
133 Expect.isNull(headers.port); 133 Expect.isNull(headers.port);
134 134
135 headers = new _HttpHeaders(); 135 headers = new _HttpHeaders();
136 headers.add(HttpHeaders.HOST, ":1234"); 136 headers.add(HttpHeaders.HOST, ":1234");
137 Expect.equals(":1234", headers.value(HttpHeaders.HOST)); 137 Expect.equals(":1234", headers.value(HttpHeaders.HOST));
138 Expect.isNull(headers.host); 138 Expect.isNull(headers.host);
139 Expect.equals(1234, headers.port); 139 Expect.equals(1234, headers.port);
140 } 140 }
141 141
142 void testEnumeration() {
143 _HttpHeaders headers = new _HttpHeaders();
144 Expect.isNull(headers[HttpHeaders.PRAGMA]);
145 headers.add("My-Header-1", "value 1");
146 headers.add("My-Header-2", "value 2");
147 headers.add("My-Header-1", "value 3");
148 bool myHeader1 = false;
149 bool myHeader2 = false;
150 int totalValues = 0;
151 headers.forEach(f(String name, List<String> values) {
152 totalValues += values.length;
153 if (name == "my-header-1") {
154 myHeader1 = true;
155 Expect.isTrue(values.indexOf("value 1") != -1);
156 Expect.isTrue(values.indexOf("value 3") != -1);
157 }
158 if (name == "my-header-2") {
159 myHeader2 = true;
160 Expect.isTrue(values.indexOf("value 2") != -1);
161 }
162 });
163 Expect.isTrue(myHeader1);
164 Expect.isTrue(myHeader2);
165 Expect.equals(3, totalValues);
166 }
167
142 main() { 168 main() {
143 testMultiValue(); 169 testMultiValue();
144 testExpires(); 170 testExpires();
145 testHost(); 171 testHost();
172 testEnumeration();
146 } 173 }
OLDNEW
« 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