summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/browser/browser_animation_setPlaybackRate.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/server/tests/browser/browser_animation_setPlaybackRate.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/server/tests/browser/browser_animation_setPlaybackRate.js')
-rw-r--r--devtools/server/tests/browser/browser_animation_setPlaybackRate.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/devtools/server/tests/browser/browser_animation_setPlaybackRate.js b/devtools/server/tests/browser/browser_animation_setPlaybackRate.js
new file mode 100644
index 000000000..b6d41b51e
--- /dev/null
+++ b/devtools/server/tests/browser/browser_animation_setPlaybackRate.js
@@ -0,0 +1,51 @@
+/* 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 a player's playbackRate can be changed, and that multiple players
+// can have their rates changed at the same time.
+
+add_task(function* () {
+ let {client, walker, animations} =
+ yield initAnimationsFrontForUrl(MAIN_DOMAIN + "animation.html");
+
+ info("Retrieve an animated node");
+ let node = yield walker.querySelector(walker.rootNode, ".simple-animation");
+
+ info("Retrieve the animation player for the node");
+ let [player] = yield animations.getAnimationPlayersForNode(node);
+
+ ok(player.setPlaybackRate, "Player has the setPlaybackRate method");
+
+ info("Change the rate to 10");
+ yield player.setPlaybackRate(10);
+
+ info("Query the state again");
+ let state = yield player.getCurrentState();
+ is(state.playbackRate, 10, "The playbackRate was updated");
+
+ info("Change the rate back to 1");
+ yield player.setPlaybackRate(1);
+
+ info("Query the state again");
+ state = yield player.getCurrentState();
+ is(state.playbackRate, 1, "The playbackRate was changed back");
+
+ info("Retrieve several animation players and set their rates");
+ node = yield walker.querySelector(walker.rootNode, "body");
+ let players = yield animations.getAnimationPlayersForNode(node);
+
+ info("Change all animations in <body> to .5 rate");
+ yield animations.setPlaybackRates(players, .5);
+
+ info("Query their states and check they are correct");
+ for (let player of players) {
+ let state = yield player.getCurrentState();
+ is(state.playbackRate, .5, "The playbackRate was updated");
+ }
+
+ yield client.close();
+ gBrowser.removeCurrentTab();
+});