Fix getComputedTiming tests

Problem 1: Exact equals on floating point values when comparing values
           for currentTime on a running animation. Setting currentTime
           actually updates startTime in order to match the desired
           value for currentTime, but there may be quantization errors
           with the floating point calculations.  Animations times are
           only required to have microsecond precision.
Problem 2: Composited animations do not spin main frame updates. They
           only need to trigger a main frame update at each phase
           transition boundary.  Thus the localTime value stored in
           calculated timing during the last main frame update may be
           stale.

Bug: 1197285
Change-Id: I5df4054552899bee29bb2b02bc214f447e1e026d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4080535
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082708}
diff --git a/css/css-animations/AnimationEffect-getComputedTiming.tentative.html b/css/css-animations/AnimationEffect-getComputedTiming.tentative.html
index fd2197f..46c26fc 100644
--- a/css/css-animations/AnimationEffect-getComputedTiming.tentative.html
+++ b/css/css-animations/AnimationEffect-getComputedTiming.tentative.html
@@ -271,8 +271,9 @@
   const div = addDiv(t, { style: 'animation: moveAnimation 100s' });
   const anim = div.getAnimations()[0];
   anim.currentTime = 5 * MS_PER_SEC;
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'current localTime after setting currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'current localTime after setting currentTime');
 }, 'localTime of an animation is always equal to currentTime');
 
 promise_test(async t => {
@@ -283,13 +284,15 @@
 
   await anim.ready;
 
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'localTime is equal to currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'localTime is equal to currentTime');
 
   await waitForFrame();
 
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'localTime is equal to currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'localTime is equal to currentTime');
 }, 'localTime reflects playbackRate immediately');
 
 test(t => {
diff --git a/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html b/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html
index 32c15f0..3be69e8 100644
--- a/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html
+++ b/css/css-transitions/AnimationEffect-getComputedTiming.tentative.html
@@ -6,6 +6,7 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="support/helper.js"></script>
+<script src="/web-animations/testcommon.js"></script>
 <style>
 
 .animated-div {
@@ -236,8 +237,9 @@
 
   const anim = div.getAnimations()[0];
   anim.currentTime = 5000;
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'current localTime after setting currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'current localTime after setting currentTime');
 }, 'localTime is always equal to currentTime');
 
 promise_test(async t => {
@@ -251,12 +253,14 @@
 
   await anim.ready;
 
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'localTime is equal to currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'localTime is equal to currentTime');
   await waitForFrame();
 
-  assert_equals(anim.effect.getComputedTiming().localTime, anim.currentTime,
-                'localTime is equal to currentTime');
+  assert_times_equal(anim.effect.getComputedTiming().localTime,
+                     anim.currentTime,
+                     'localTime is equal to currentTime');
 }, 'localTime reflects playbackRate immediately');