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

Side by Side Diff: tests/standalone/io/http_headers_test.dart

Issue 694293002: Only lower-case ContentType's values if the name is 'charset'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sdk/lib/io/http_headers.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) 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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698