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 library dart.io; | 5 library dart.io; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "dart:async"; | 8 import "dart:async"; |
9 import "dart:collection"; | 9 import "dart:collection"; |
10 import "dart:convert"; | 10 import "dart:convert"; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 check(contentType, "text", "html"); | 325 check(contentType, "text", "html"); |
326 Expect.equals("text/html", contentType.toString()); | 326 Expect.equals("text/html", contentType.toString()); |
327 contentType = new ContentType("text", "html", charset: "utf-8"); | 327 contentType = new ContentType("text", "html", charset: "utf-8"); |
328 check(contentType, "text", "html", {"charset": "utf-8"}); | 328 check(contentType, "text", "html", {"charset": "utf-8"}); |
329 Expect.equals("text/html; charset=utf-8", contentType.toString()); | 329 Expect.equals("text/html; charset=utf-8", contentType.toString()); |
330 Expect.throws(() => contentType.parameters["xxx"] = "yyy", | 330 Expect.throws(() => contentType.parameters["xxx"] = "yyy", |
331 (e) => e is UnsupportedError); | 331 (e) => e is UnsupportedError); |
332 | 332 |
333 contentType = new ContentType("text", | 333 contentType = new ContentType("text", |
334 "html", | 334 "html", |
335 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); | 335 parameters: {"CHARSET": "UTF-8", "xxx": "YYY"}); |
336 check(contentType, "text", "html", {"charset": "utf-8", "xxx": "yyy"}); | 336 check(contentType, "text", "html", {"charset": "utf-8", "xxx": "YYY"}); |
337 String s = contentType.toString(); | 337 String s = contentType.toString(); |
338 bool expectedToString = (s == "text/html; charset=utf-8; xxx=yyy" || | 338 bool expectedToString = (s == "text/html; charset=utf-8; xxx=YYY" || |
339 s == "text/html; xxx=yyy; charset=utf-8"); | 339 s == "text/html; xxx=YYY; charset=utf-8"); |
340 Expect.isTrue(expectedToString); | 340 Expect.isTrue(expectedToString); |
| 341 contentType = ContentType.parse("text/html; CHARSET=UTF-8; xxx=YYY"); |
| 342 check(contentType, "text", "html", {"charset": "utf-8", "xxx": "YYY"}); |
341 Expect.throws(() => contentType.parameters["xxx"] = "yyy", | 343 Expect.throws(() => contentType.parameters["xxx"] = "yyy", |
342 (e) => e is UnsupportedError); | 344 (e) => e is UnsupportedError); |
343 | 345 |
344 contentType = new ContentType("text", | 346 contentType = new ContentType("text", |
345 "html", | 347 "html", |
346 charset: "ISO-8859-1", | 348 charset: "ISO-8859-1", |
347 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); | 349 parameters: {"CHARSET": "UTF-8", "xxx": "yyy"}); |
348 check(contentType, "text", "html", {"charset": "iso-8859-1", "xxx": "yyy"}); | 350 check(contentType, "text", "html", {"charset": "iso-8859-1", "xxx": "yyy"}); |
349 s = contentType.toString(); | 351 s = contentType.toString(); |
350 expectedToString = (s == "text/html; charset=iso-8859-1; xxx=yyy" || | 352 expectedToString = (s == "text/html; charset=iso-8859-1; xxx=yyy" || |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 testHeaderValue(); | 566 testHeaderValue(); |
565 testContentType(); | 567 testContentType(); |
566 testContentTypeCache(); | 568 testContentTypeCache(); |
567 testCookie(); | 569 testCookie(); |
568 testInvalidCookie(); | 570 testInvalidCookie(); |
569 testHeaderLists(); | 571 testHeaderLists(); |
570 testInvalidFieldName(); | 572 testInvalidFieldName(); |
571 testInvalidFieldValue(); | 573 testInvalidFieldValue(); |
572 testClear(); | 574 testClear(); |
573 } | 575 } |
OLD | NEW |