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

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

Issue 196723020: Add validation to construction of Cookie objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 test("SID", "sJdkjKSJD12343kjKj78"); 429 test("SID", "sJdkjKSJD12343kjKj78");
430 } 430 }
431 431
432 void testInvalidCookie() { 432 void testInvalidCookie() {
433 Expect.throws(() => new _Cookie.fromSetCookieValue("")); 433 Expect.throws(() => new _Cookie.fromSetCookieValue(""));
434 Expect.throws(() => new _Cookie.fromSetCookieValue("=")); 434 Expect.throws(() => new _Cookie.fromSetCookieValue("="));
435 Expect.throws(() => new _Cookie.fromSetCookieValue("=xxx")); 435 Expect.throws(() => new _Cookie.fromSetCookieValue("=xxx"));
436 Expect.throws(() => new _Cookie.fromSetCookieValue("xxx")); 436 Expect.throws(() => new _Cookie.fromSetCookieValue("xxx"));
437 Expect.throws(() => new _Cookie.fromSetCookieValue( 437 Expect.throws(() => new _Cookie.fromSetCookieValue(
438 "xxx=yyy; expires=12 jan 2013")); 438 "xxx=yyy; expires=12 jan 2013"));
439 Expect.throws(() => new _Cookie.fromSetCookieValue("x x = y y"));
440 Expect.throws(() => new _Cookie("[4", "y"));
441 Expect.throws(() => new _Cookie("4", "y\""));
439 442
440 _HttpHeaders headers = new _HttpHeaders("1.1"); 443 _HttpHeaders headers = new _HttpHeaders("1.1");
441 headers.set('Cookie', 444 headers.set('Cookie',
442 'DARTSESSID=d3d6fdd78d51aaaf2924c32e991f4349; undefined'); 445 'DARTSESSID=d3d6fdd78d51aaaf2924c32e991f4349; undefined');
443 Expect.equals('DARTSESSID', headers._parseCookies().single.name); 446 Expect.equals('DARTSESSID', headers._parseCookies().single.name);
444 Expect.equals('d3d6fdd78d51aaaf2924c32e991f4349', 447 Expect.equals('d3d6fdd78d51aaaf2924c32e991f4349',
445 headers._parseCookies().single.value); 448 headers._parseCookies().single.value);
446 } 449 }
447 450
448 void testHeaderLists() { 451 void testHeaderLists() {
(...skipping 10 matching lines...) Expand all
459 testIfModifiedSince(); 462 testIfModifiedSince();
460 testHost(); 463 testHost();
461 testEnumeration(); 464 testEnumeration();
462 testHeaderValue(); 465 testHeaderValue();
463 testContentType(); 466 testContentType();
464 testContentTypeCache(); 467 testContentTypeCache();
465 testCookie(); 468 testCookie();
466 testInvalidCookie(); 469 testInvalidCookie();
467 testHeaderLists(); 470 testHeaderLists();
468 } 471 }
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