Bug 1453568 - Rewrite async_test in oncancel.html with promise_test with async/await. r?birtles
MozReview-Commit-ID: CevZBM20koz
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -599696,17 +599696,17 @@
"4e3dd92351d76c5c7d09ddd1ca025520f4c8875d",
"testharness"
],
"web-animations/interfaces/Animation/idlharness.html": [
"d61aa2d95ea31809a275183408e822c8c1eec87d",
"testharness"
],
"web-animations/interfaces/Animation/oncancel.html": [
- "82abc08a0b416f5198239464fb4fc01d2edd6e1c",
+ "04d9893cd9968f71971bafd7a9bcbb6e3c955cdd",
"testharness"
],
"web-animations/interfaces/Animation/onfinish.html": [
"db82fabeaf2b646647f134634fef30f05e5ec7f8",
"testharness"
],
"web-animations/interfaces/Animation/pause.html": [
"f044cc7ac09c38f127e399f7d6f9a0714046aa8e",
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/oncancel.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/oncancel.html
@@ -5,29 +5,30 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-async_test(t => {
+promise_test(async t => {
const div = createDiv(t);
const animation = div.animate({}, 100 * MS_PER_SEC);
let finishedTimelineTime;
animation.finished.then().catch(() => {
finishedTimelineTime = animation.timeline.currentTime;
});
- animation.oncancel = t.step_func_done(event => {
- assert_equals(event.currentTime, null,
- 'event.currentTime should be null');
- assert_equals(event.timelineTime, finishedTimelineTime,
- 'event.timelineTime should equal to the animation timeline ' +
- 'when finished promise is rejected');
- });
+ const eventWatcher = new EventWatcher(t, animation, 'cancel');
+ animation.cancel();
+
+ const event = await eventWatcher.wait_for('cancel');
- animation.cancel();
+ assert_equals(event.currentTime, null,
+ 'event.currentTime should be null');
+ assert_equals(event.timelineTime, finishedTimelineTime,
+ 'event.timelineTime should equal to the animation timeline ' +
+ 'when finished promise is rejected');
}, 'oncancel event is fired when animation.cancel() is called.');
</script>
</body>