Bug 1387894 - Fix animation WPTs. r=birtles,jgraham

I believe these intermittents are caused by double imprecision. When unconditional clamping is enabled
it gets multiplied out and causes animation.currentTime to occasionally go to 50000.02 which causes
the test to fail. We can reduce the precision back down to ignore that. We do so using some WPT
overrides.

Differential Revision: https://phabricator.services.mozilla.com/D38810

Depends on D38809

--HG--
extra : rebase_source : 923172b3e7fd34458d6ee153ef33c0f830c954e3
This commit is contained in:
Tom Ritter 2019-08-02 07:36:38 +02:00
Родитель b497d6b89c
Коммит 51be190743
5 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -5,6 +5,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../resources/timing-override.js"></script>
<body>
<div id="log"></div>
<script>

Просмотреть файл

@ -0,0 +1,18 @@
// Firefox implements unconditional clamping of 20 usec; and for certain web-animation tests,
// we hit some test failures because the Time Precision is too small. We override these functions
// on a per-test basis for Firefox only.
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
window.assert_times_equal = (actual, expected, description) => {
let TIME_PRECISION = 0.02;
assert_approx_equals(actual, expected, TIME_PRECISION * 2, description);
};
window.assert_time_equals_literal = (actual, expected, description) => {
let TIME_PRECISION = 0.02;
if (Math.abs(expected) === Infinity) {
assert_equals(actual, expected, description);
} else {
assert_approx_equals(actual, expected, TIME_PRECISION, description);
}
}
}

Просмотреть файл

@ -6,6 +6,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../resources/timing-override.js"></script>
<body>
<div id="log"></div>
<script>

Просмотреть файл

@ -5,6 +5,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../resources/timing-override.js"></script>
<body>
<div id="log"></div>
<script>
@ -262,7 +263,7 @@ promise_test(async t => {
// calculated using the new playback rate
assert_times_equal(anim.startTime,
anim.timeline.currentTime - 25 * MS_PER_SEC);
assert_time_equals_literal(anim.currentTime, 50 * MS_PER_SEC);
assert_time_equals_literal(parseInt(anim.currentTime.toPrecision(5), 10), 50 * MS_PER_SEC);
}, 'Setting the start time of a playing animation applies a pending playback rate');
</script>

Просмотреть файл

@ -5,6 +5,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../resources/timing-override.js"></script>
<body>
<div id="log"></div>
<script>