| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:math'; | 7 import 'dart:math'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 part '../../../sdk/lib/io/common.dart'; | 10 part '../../../sdk/lib/io/common.dart'; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } else { | 244 } else { |
| 245 Expect.equals(0, contentType.parameters.length); | 245 Expect.equals(0, contentType.parameters.length); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 ContentType contentType; | 249 ContentType contentType; |
| 250 contentType = new ContentType("", ""); | 250 contentType = new ContentType("", ""); |
| 251 Expect.equals("", contentType.primaryType); | 251 Expect.equals("", contentType.primaryType); |
| 252 Expect.equals("", contentType.subType); | 252 Expect.equals("", contentType.subType); |
| 253 Expect.equals("/", contentType.value); | 253 Expect.equals("/", contentType.value); |
| 254 Expect.throws(() => contentType.parameters["xxx"] = "yyy", |
| 255 (e) => e is UnsupportedError); |
| 254 | 256 |
| 255 contentType = ContentType.parse("text/html"); | 257 contentType = ContentType.parse("text/html"); |
| 256 check(contentType, "text", "html"); | 258 check(contentType, "text", "html"); |
| 257 Expect.equals("text/html", contentType.toString()); | 259 Expect.equals("text/html", contentType.toString()); |
| 258 contentType = new ContentType("text", "html", charset: "utf-8"); | 260 contentType = new ContentType("text", "html", charset: "utf-8"); |
| 259 check(contentType, "text", "html", {"charset": "utf-8"}); | 261 check(contentType, "text", "html", {"charset": "utf-8"}); |
| 260 Expect.equals("text/html; charset=utf-8", contentType.toString()); | 262 Expect.equals("text/html; charset=utf-8", contentType.toString()); |
| 263 Expect.throws(() => contentType.parameters["xxx"] = "yyy", |
| 264 (e) => e is UnsupportedError); |
| 261 | 265 |
| 262 contentType = new ContentType("text", | 266 contentType = new ContentType("text", |
| 263 "html", | 267 "html", |
| 264 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); | 268 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); |
| 265 check(contentType, "text", "html", {"charset": "utf-8", "xxx": "yyy"}); | 269 check(contentType, "text", "html", {"charset": "utf-8", "xxx": "yyy"}); |
| 266 String s = contentType.toString(); | 270 String s = contentType.toString(); |
| 267 bool expectedToString = (s == "text/html; charset=utf-8; xxx=yyy" || | 271 bool expectedToString = (s == "text/html; charset=utf-8; xxx=yyy" || |
| 268 s == "text/html; xxx=yyy; charset=utf-8"); | 272 s == "text/html; xxx=yyy; charset=utf-8"); |
| 269 Expect.isTrue(expectedToString); | 273 Expect.isTrue(expectedToString); |
| 274 Expect.throws(() => contentType.parameters["xxx"] = "yyy", |
| 275 (e) => e is UnsupportedError); |
| 270 | 276 |
| 271 contentType = new ContentType("text", | 277 contentType = new ContentType("text", |
| 272 "html", | 278 "html", |
| 273 charset: "ISO-8859-1", | 279 charset: "ISO-8859-1", |
| 274 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); | 280 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); |
| 275 check(contentType, "text", "html", {"charset": "iso-8859-1", "xxx": "yyy"}); | 281 check(contentType, "text", "html", {"charset": "iso-8859-1", "xxx": "yyy"}); |
| 276 s = contentType.toString(); | 282 s = contentType.toString(); |
| 277 expectedToString = (s == "text/html; charset=iso-8859-1; xxx=yyy" || | 283 expectedToString = (s == "text/html; charset=iso-8859-1; xxx=yyy" || |
| 278 s == "text/html; xxx=yyy; charset=iso-8859-1"); | 284 s == "text/html; xxx=yyy; charset=iso-8859-1"); |
| 279 Expect.isTrue(expectedToString); | 285 Expect.isTrue(expectedToString); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 testIfModifiedSince(); | 431 testIfModifiedSince(); |
| 426 testHost(); | 432 testHost(); |
| 427 testEnumeration(); | 433 testEnumeration(); |
| 428 testHeaderValue(); | 434 testHeaderValue(); |
| 429 testContentType(); | 435 testContentType(); |
| 430 testContentTypeCache(); | 436 testContentTypeCache(); |
| 431 testCookie(); | 437 testCookie(); |
| 432 testInvalidCookie(); | 438 testInvalidCookie(); |
| 433 testHeaderLists(); | 439 testHeaderLists(); |
| 434 } | 440 } |
| OLD | NEW |