tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_animation_logic_adjust-time-with-playback-rate.js (1804B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test adjusting the created time with different playback rate of animation.
      7 
      8 add_task(async function () {
      9  await addTab(URL_ROOT + "doc_custom_playback_rate.html");
     10  const { animationInspector, inspector, panel } =
     11    await openAnimationInspector();
     12 
     13  info(
     14    "Pause the all animation and set current time to middle in order to check " +
     15      "the adjusting time"
     16  );
     17  clickOnPauseResumeButton(animationInspector, panel);
     18  await waitUntilAnimationsPlayState(animationInspector, "paused");
     19  clickOnCurrentTimeScrubberController(animationInspector, panel, 0.5);
     20 
     21  info("Check the created times of all animation are same");
     22  checkAdjustingTheTime(
     23    animationInspector.state.animations[0].state,
     24    animationInspector.state.animations[1].state
     25  );
     26 
     27  info("Change the playback rate to x10 after selecting '.div2'");
     28  await selectNode(".div2", inspector);
     29  await waitUntil(() => panel.querySelectorAll(".animation-item").length === 1);
     30  await changePlaybackRateSelector(animationInspector, panel, 10);
     31 
     32  info("Check each adjusted result of animations after selecting 'body' again");
     33  await selectNode("body", inspector);
     34  await waitUntil(() => panel.querySelectorAll(".animation-item").length === 2);
     35 
     36  checkAdjustingTheTime(
     37    animationInspector.state.animations[0].state,
     38    animationInspector.state.animations[1].state
     39  );
     40 
     41  await waitUntil(
     42    () => animationInspector.state.animations[0].state.currentTime === 50000
     43  );
     44  ok(true, "The current time of '.div1' animation is 50%");
     45 
     46  await waitUntil(
     47    () => animationInspector.state.animations[1].state.currentTime === 50000
     48  );
     49  ok(true, "The current time of '.div2' animation is 50%");
     50 });