Migrated http_cookie_test and http_cookie_date_test from SDK. (#59)

* Migrated http_cookie_test and http_cookie_date_test from SDK.
diff --git a/lib/src/http_headers_impl.dart b/lib/src/http_headers_impl.dart
index 6ce5cdd..e2b464c 100644
--- a/lib/src/http_headers_impl.dart
+++ b/lib/src/http_headers_impl.dart
@@ -906,7 +906,7 @@
           value = parseAttributeValue();
         }
         if (name == "expires") {
-          expires = _parseCookieDate(value);
+          expires = parseCookieDate(value);
         } else if (name == "max-age") {
           maxAge = int.parse(value);
         } else if (name == "domain") {
@@ -998,7 +998,7 @@
 }
 
 // Parse a cookie date string.
-DateTime _parseCookieDate(String date) {
+DateTime parseCookieDate(String date) {
   const List monthsLowerCase = const [
     "jan",
     "feb",
diff --git a/test/http_cookie_date_test.dart b/test/http_cookie_date_test.dart
new file mode 100644
index 0000000..4baa3c8
--- /dev/null
+++ b/test/http_cookie_date_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart.http;
+
+import 'package:http_io/http_io.dart';
+import 'package:http_io/src/http_headers_impl.dart';
+import 'package:test/test.dart';
+
+void testParseHttpCookieDate() {
+  expect(() => parseCookieDate(""), throwsA(new isInstanceOf<HttpException>()));
+
+  test(int year, int month, int day, int hours, int minutes, int seconds,
+      String formatted) {
+    DateTime date =
+        new DateTime.utc(year, month, day, hours, minutes, seconds, 0);
+    expect(date, parseCookieDate(formatted));
+  }
+
+  test(2012, DateTime.JUNE, 19, 14, 15, 01, "tue, 19-jun-12 14:15:01 gmt");
+  test(2021, DateTime.JUNE, 09, 10, 18, 14, "Wed, 09-Jun-2021 10:18:14 GMT");
+  test(2021, DateTime.JANUARY, 13, 22, 23, 01, "Wed, 13-Jan-2021 22:23:01 GMT");
+  test(2013, DateTime.JANUARY, 15, 21, 47, 38, "Tue, 15-Jan-2013 21:47:38 GMT");
+  test(1970, DateTime.JANUARY, 01, 00, 00, 01, "Thu, 01-Jan-1970 00:00:01 GMT");
+}
+
+void main() {
+  test('parseHttpCookieDate', testParseHttpCookieDate);
+}
diff --git a/test/http_cookie_test.dart b/test/http_cookie_test.dart
new file mode 100644
index 0000000..62db043
--- /dev/null
+++ b/test/http_cookie_test.dart
@@ -0,0 +1,67 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:http_io/http_io.dart';
+import 'package:test/test.dart';
+
+Future<Null> testCookies() {
+  final completer = new Completer<Null>();
+  var cookies = [
+    {'abc': 'def'},
+    {'ABC': 'DEF'},
+    {'Abc': 'Def'},
+    {'Abc': 'Def', 'SID': 'sffFSDF4FsdfF56765'}
+  ];
+
+  HttpServer.bind("127.0.0.1", 0).then((server) {
+    server.listen((HttpRequest request) {
+      // Collect the cookies in a map.
+      var cookiesMap = {};
+      request.cookies.forEach((c) => cookiesMap[c.name] = c.value);
+      int index = int.parse(request.uri.path.substring(1));
+      expect(cookies[index], cookiesMap);
+      // Return the same cookies to the client.
+      cookiesMap.forEach((k, v) {
+        request.response.cookies.add(new Cookie(k, v));
+      });
+      request.response.close();
+    });
+
+    int count = 0;
+    HttpClient client = new HttpClient();
+    for (int i = 0; i < cookies.length; i++) {
+      client.get("127.0.0.1", server.port, "/$i").then((request) {
+        // Send the cookies to the server.
+        cookies[i].forEach((k, v) {
+          request.cookies.add(new Cookie(k, v));
+        });
+        return request.close();
+      }).then((response) {
+        // Expect the same cookies back.
+        var cookiesMap = {};
+        response.cookies.forEach((c) => cookiesMap[c.name] = c.value);
+        expect(cookies[i], cookiesMap);
+        response.cookies.forEach((c) => expect(c.httpOnly, isTrue));
+        response.listen((d) {}, onDone: () {
+          if (++count == cookies.length) {
+            client.close();
+            server.close();
+            completer.complete();
+          }
+        });
+      }).catchError((e, trace) {
+        String msg = "Unexpected error $e";
+        if (trace != null) msg += "\nStackTrace: $trace";
+        fail(msg);
+      });
+    }
+  });
+  return completer.future;
+}
+
+void main() {
+  test('cookies', testCookies);
+}