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

Unified Diff: tests/standalone/io/http_date_test.dart

Issue 16812004: Make some HTTP utility functions public (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« sdk/lib/io/http_utils.dart ('K') | « tests/corelib/uri_query_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_date_test.dart
diff --git a/tests/standalone/io/http_date_test.dart b/tests/standalone/io/http_date_test.dart
index f3205ab37833d62bc59e793c5ab16ab7e5dbdae4..be0454db56364efe73700920489aef5e2fe96baa 100644
--- a/tests/standalone/io/http_date_test.dart
+++ b/tests/standalone/io/http_date_test.dart
@@ -17,20 +17,20 @@ part "../../../sdk/lib/io/socket.dart";
void testParseHttpDate() {
DateTime date;
date = new DateTime.utc(1999, DateTime.JUNE, 11, 18, 46, 53, 0);
- Expect.equals(date, _HttpUtils.parseDate("Fri, 11 Jun 1999 18:46:53 GMT"));
- Expect.equals(date, _HttpUtils.parseDate("Friday, 11-Jun-1999 18:46:53 GMT"));
- Expect.equals(date, _HttpUtils.parseDate("Fri Jun 11 18:46:53 1999"));
+ Expect.equals(date, HttpDate.parse("Fri, 11 Jun 1999 18:46:53 GMT"));
+ Expect.equals(date, HttpDate.parse("Friday, 11-Jun-1999 18:46:53 GMT"));
+ Expect.equals(date, HttpDate.parse("Fri Jun 11 18:46:53 1999"));
date = new DateTime.utc(1970, DateTime.JANUARY, 1, 0, 0, 0, 0);
- Expect.equals(date, _HttpUtils.parseDate("Thu, 1 Jan 1970 00:00:00 GMT"));
+ Expect.equals(date, HttpDate.parse("Thu, 1 Jan 1970 00:00:00 GMT"));
Expect.equals(date,
- _HttpUtils.parseDate("Thursday, 1-Jan-1970 00:00:00 GMT"));
- Expect.equals(date, _HttpUtils.parseDate("Thu Jan 1 00:00:00 1970"));
+ HttpDate.parse("Thursday, 1-Jan-1970 00:00:00 GMT"));
+ Expect.equals(date, HttpDate.parse("Thu Jan 1 00:00:00 1970"));
date = new DateTime.utc(2012, DateTime.MARCH, 5, 23, 59, 59, 0);
- Expect.equals(date, _HttpUtils.parseDate("Mon, 5 Mar 2012 23:59:59 GMT"));
- Expect.equals(date, _HttpUtils.parseDate("Monday, 5-Mar-2012 23:59:59 GMT"));
- Expect.equals(date, _HttpUtils.parseDate("Mon Mar 5 23:59:59 2012"));
+ Expect.equals(date, HttpDate.parse("Mon, 5 Mar 2012 23:59:59 GMT"));
+ Expect.equals(date, HttpDate.parse("Monday, 5-Mar-2012 23:59:59 GMT"));
+ Expect.equals(date, HttpDate.parse("Mon Mar 5 23:59:59 2012"));
}
void testFormatParseHttpDate() {
@@ -44,9 +44,9 @@ void testFormatParseHttpDate() {
DateTime date;
String formatted;
date = new DateTime.utc(year, month, day, hours, minutes, seconds, 0);
- formatted = _HttpUtils.formatDate(date);
+ formatted = HttpDate.format(date);
Expect.equals(expectedFormatted, formatted);
- Expect.equals(date, _HttpUtils.parseDate(formatted));
+ Expect.equals(date, HttpDate.parse(formatted));
}
test(1999, DateTime.JUNE, 11, 18, 46, 53, "Fri, 11 Jun 1999 18:46:53 GMT");
@@ -56,32 +56,32 @@ void testFormatParseHttpDate() {
void testParseHttpDateFailures() {
Expect.throws(() {
- _HttpUtils.parseDate("");
+ HttpDate.parse("");
});
String valid = "Mon, 5 Mar 2012 23:59:59 GMT";
for (int i = 1; i < valid.length - 1; i++) {
String tmp = valid.substring(0, i);
Expect.throws(() {
- _HttpUtils.parseDate(tmp);
+ HttpDate.parse(tmp);
});
Expect.throws(() {
- _HttpUtils.parseDate(" $tmp");
+ HttpDate.parse(" $tmp");
});
Expect.throws(() {
- _HttpUtils.parseDate(" $tmp ");
+ HttpDate.parse(" $tmp ");
});
Expect.throws(() {
- _HttpUtils.parseDate("$tmp ");
+ HttpDate.parse("$tmp ");
});
}
Expect.throws(() {
- _HttpUtils.parseDate(" $valid");
+ HttpDate.parse(" $valid");
});
Expect.throws(() {
- _HttpUtils.parseDate(" $valid ");
+ HttpDate.parse(" $valid ");
});
Expect.throws(() {
- _HttpUtils.parseDate("$valid ");
+ HttpDate.parse("$valid ");
});
}
« sdk/lib/io/http_utils.dart ('K') | « tests/corelib/uri_query_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698