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

Unified Diff: test/credentials_test.dart

Issue 1531083002: Fix the toJson/fromJson test. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/credentials_test.dart
diff --git a/test/credentials_test.dart b/test/credentials_test.dart
index f4d8886e863bdcbf3a751e4ee97b2eeff33cd537..cedea6b2d901cedc147c157553f91e4ebd7ebbeb 100644
--- a/test/credentials_test.dart
+++ b/test/credentials_test.dart
@@ -231,7 +231,13 @@ void main() {
new oauth2.Credentials.fromJson(JSON.encode(map));
test("should load the same credentials from toJson", () {
+ // Round the expiration down to milliseconds since epoch, since that's
+ // what the credentials file stores. Otherwise sub-millisecond time gets
+ // in the way.
var expiration = new DateTime.now().subtract(new Duration(hours: 1));
+ expiration = new DateTime.fromMillisecondsSinceEpoch(
+ expiration.millisecondsSinceEpoch);
+
var credentials = new oauth2.Credentials(
'access token',
refreshToken: 'refresh token',
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698