Files
firefox/devtools/server/tests/browser/browser_animation_setCurrentTime.js
T
Daniel Varga 05081ead08 Backed out 9 changesets (bug 1387894) for wpt failures at /web-animations/timing-model/animations/finishing-an-animation.html on a CLOSED TREE
Backed out changeset 998582bf083d (bug 1387894)
Backed out changeset cd58aae7d47b (bug 1387894)
Backed out changeset a51919fb2062 (bug 1387894)
Backed out changeset ef7b589d751b (bug 1387894)
Backed out changeset 75c0249b594a (bug 1387894)
Backed out changeset 4a75f2556242 (bug 1387894)
Backed out changeset 0bff9ba4237c (bug 1387894)
Backed out changeset 80040c0a275e (bug 1387894)
Backed out changeset 02814f69872d (bug 1387894)
2019-07-30 21:05:59 +03:00

49 lines
1.5 KiB
JavaScript

/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that the AnimationsActor allows changing many players' currentTimes at once.
add_task(async function() {
const { target, walker, animations } = await initAnimationsFrontForUrl(
MAIN_DOMAIN + "animation.html"
);
await testSetCurrentTimes(walker, animations);
await target.destroy();
gBrowser.removeCurrentTab();
});
async function testSetCurrentTimes(walker, animations) {
ok(animations.setCurrentTimes, "The AnimationsActor has the right method");
info("Retrieve multiple animated node and its animation players");
const nodeMulti = await walker.querySelector(
walker.rootNode,
".multiple-animations"
);
const players = await animations.getAnimationPlayersForNode(nodeMulti);
ok(players.length > 1, "Node has more than 1 animation player");
info("Try to set multiple current times at once");
// Assume that all animations were created at same time.
const createdTime = players[1].state.createdTime;
await animations.setCurrentTimes(players, createdTime + 500, true);
info("Get the states of players and verify their correctness");
for (let i = 0; i < players.length; i++) {
const state = await players[i].getCurrentState();
is(state.playState, "paused", `Player ${i + 1} is paused`);
is(
parseInt(state.currentTime.toPrecision(6), 10),
500,
`Player ${i + 1} has the right currentTime`
);
}
}