changeset 10677:315c8aa5bc4c jdk-10+29

8178290: Intermittent test failure in test.com.sun.webkit.network.CookieTest Reviewed-by: arajkumar, ghb, mbilla Contributed-by: rajath.kamath@oracle.com
author ghb
date Tue, 24 Oct 2017 17:12:43 +0530
parents 37c3267e3a01
children ef457e34c6af 52f6dafcbb99
files modules/javafx.web/src/test/java/test/com/sun/webkit/network/CookieTest.java
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.web/src/test/java/test/com/sun/webkit/network/CookieTest.java	Mon Oct 23 11:08:28 2017 -0700
+++ b/modules/javafx.web/src/test/java/test/com/sun/webkit/network/CookieTest.java	Tue Oct 24 17:12:43 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -195,10 +195,11 @@
         actual = CookieShim.parse(testString, expected.creationTime);
         assertAsExpected(testString, expected, actual);
 
-        long maxAge = (Long.MAX_VALUE - currentTimeMillis()) / 1000;
+        expected = new CookieModel("foo", "bar");
+        long currentTimeInMillis = expected.creationTime.baseTime();
+        long maxAge = (Long.MAX_VALUE - currentTimeInMillis) / 1000;
         testString = "foo=bar; Max-Age=" + maxAge;
-        expected = new CookieModel("foo", "bar");
-        expected.expiryTime = expected.creationTime.baseTime() + maxAge * 1000;
+        expected.expiryTime = currentTimeInMillis + maxAge * 1000;
         expected.persistent = true;
         actual = CookieShim.parse(testString, expected.creationTime);
         assertAsExpected(testString, expected, actual);