Rename Date to DateTime.

BUG=http://dartbug.com/1424

Review URL: https://codereview.chromium.org//11770004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17549 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/src/authorization_code_grant.dart b/lib/src/authorization_code_grant.dart
index 5e9cbd2..abd0d2e 100644
--- a/lib/src/authorization_code_grant.dart
+++ b/lib/src/authorization_code_grant.dart
@@ -229,7 +229,7 @@
   /// This works just like [handleAuthorizationCode], except it doesn't validate
   /// the state beforehand.
   Future<Client> _handleAuthorizationCode(String authorizationCode) {
-    var startTime = new Date.now();
+    var startTime = new DateTime.now();
     return _httpClient.post(this.tokenEndpoint, fields: {
       "grant_type": "authorization_code",
       "code": authorizationCode,
diff --git a/lib/src/credentials.dart b/lib/src/credentials.dart
index 12a0be8..d476e78 100644
--- a/lib/src/credentials.dart
+++ b/lib/src/credentials.dart
@@ -44,13 +44,13 @@
 
   /// The date at which these credentials will expire. This is likely to be a
   /// few seconds earlier than the server's idea of the expiration date.
-  final Date expiration;
+  final DateTime expiration;
 
   /// Whether or not these credentials have expired. Note that it's possible the
   /// credentials will expire shortly after this is called. However, since the
   /// client's expiration date is kept a few seconds earlier than the server's,
   /// there should be enough leeway to rely on this.
-  bool get isExpired => expiration != null && new Date.now() > expiration;
+  bool get isExpired => expiration != null && new DateTime.now() > expiration;
 
   /// Whether it's possible to refresh these credentials.
   bool get canRefresh => refreshToken != null && tokenEndpoint != null;
@@ -111,7 +111,7 @@
     if (expiration != null) {
       validate(expiration is int,
           'field "expiration" was not an int, was "$expiration"');
-      expiration = new Date.fromMillisecondsSinceEpoch(expiration);
+      expiration = new DateTime.fromMillisecondsSinceEpoch(expiration);
     }
 
     return new Credentials(
@@ -152,7 +152,7 @@
     if (scopes == null) scopes = <String>[];
     if (httpClient == null) httpClient = new http.Client();
 
-    var startTime = new Date.now();
+    var startTime = new DateTime.now();
     return async.then((_) {
       if (refreshToken == null) {
         throw new StateError("Can't refresh credentials without a refresh "
diff --git a/lib/src/handle_access_token_response.dart b/lib/src/handle_access_token_response.dart
index b80532d..d1fedea 100644
--- a/lib/src/handle_access_token_response.dart
+++ b/lib/src/handle_access_token_response.dart
@@ -24,7 +24,7 @@
 Credentials handleAccessTokenResponse(
     http.Response response,
     Uri tokenEndpoint,
-    Date startTime,
+    DateTime startTime,
     List<String> scopes) {
   if (response.statusCode != 200) _handleErrorResponse(response, tokenEndpoint);
 
diff --git a/test/client_test.dart b/test/client_test.dart
index 6ad7e48..fd5e5b4 100644
--- a/test/client_test.dart
+++ b/test/client_test.dart
@@ -35,7 +35,7 @@
     setUp(createHttpClient);
 
     test("that can't be refreshed throws an ExpirationException on send", () {
-      var expiration = new Date.now().subtract(new Duration(hours: 1));
+      var expiration = new DateTime.now().subtract(new Duration(hours: 1));
       var credentials = new oauth2.Credentials(
           'access token', null, null, [], expiration);
       var client = new oauth2.Client('identifier', 'secret', credentials,
@@ -47,7 +47,7 @@
 
     test("that can be refreshed refreshes the credentials and sends the "
         "request", () {
-      var expiration = new Date.now().subtract(new Duration(hours: 1));
+      var expiration = new DateTime.now().subtract(new Duration(hours: 1));
       var credentials = new oauth2.Credentials(
           'access token', 'refresh token', tokenEndpoint, [], expiration);
       var client = new oauth2.Client('identifier', 'secret', credentials,
diff --git a/test/credentials_test.dart b/test/credentials_test.dart
index 57e31a1..e3f24da 100644
--- a/test/credentials_test.dart
+++ b/test/credentials_test.dart
@@ -27,14 +27,14 @@
   });
 
   test('is not expired if the expiration is in the future', () {
-    var expiration = new Date.now().add(new Duration(hours: 1));
+    var expiration = new DateTime.now().add(new Duration(hours: 1));
     var credentials = new oauth2.Credentials(
         'access token', null, null, null, expiration);
     expect(credentials.isExpired, isFalse);
   });
 
   test('is expired if the expiration is in the past', () {
-    var expiration = new Date.now().subtract(new Duration(hours: 1));
+    var expiration = new DateTime.now().subtract(new Duration(hours: 1));
     var credentials = new oauth2.Credentials(
         'access token', null, null, null, expiration);
     expect(credentials.isExpired, isTrue);
@@ -124,7 +124,7 @@
       new oauth2.Credentials.fromJson(JSON.stringify(map));
 
     test("should load the same credentials from toJson", () {
-      var expiration = new Date.now().subtract(new Duration(hours: 1));
+      var expiration = new DateTime.now().subtract(new Duration(hours: 1));
       var credentials = new oauth2.Credentials(
           'access token', 'refresh token', tokenEndpoint, ['scope1', 'scope2'],
           expiration);
diff --git a/test/handle_access_token_response_test.dart b/test/handle_access_token_response_test.dart
index 48465f2..6bfb7da 100644
--- a/test/handle_access_token_response_test.dart
+++ b/test/handle_access_token_response_test.dart
@@ -16,7 +16,7 @@
 
 final Uri tokenEndpoint = new Uri.fromString("https://example.com/token");
 
-final Date startTime = new Date.now();
+final DateTime startTime = new DateTime.now();
 
 oauth2.Credentials handle(http.Response response) =>
   handleAccessTokenResponse(response, tokenEndpoint, startTime, ["scope"]);