Bug 1407900 - Part 2: Add test for hidden panel. r=pbro

MozReview-Commit-ID: 2ied0w6KY14

--HG--
extra : rebase_source : 55b0c6cebc4aae28743dfeb09fd84b2d2501bb9e
This commit is contained in:
Daisuke Akatsuka 2017-10-16 13:52:02 +09:00
Родитель 0447dafe38
Коммит f58703bdac
3 изменённых файлов: 57 добавлений и 1 удалений

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

@ -235,7 +235,8 @@ var AnimationsController = {
!this.mutationsDetectedWhileHidden)) {
return;
}
this.isMutationsEventOccuredDuringHidden = false;
this.mutationsDetectedWhileHidden = false;
this.nodeFront = gInspector.selection.nodeFront;
let done = gInspector.updating("animationscontroller");

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

@ -48,6 +48,7 @@ skip-if = os == "linux" && !debug # Bug 1234567
[browser_animation_refresh_on_removed_animation.js]
skip-if = os == "linux" && !debug # Bug 1227792
[browser_animation_refresh_when_active.js]
[browser_animation_refresh_when_active_after_mutations.js]
[browser_animation_running_on_compositor.js]
[browser_animation_same_nb_of_playerWidgets_and_playerFronts.js]
[browser_animation_shows_player_on_valid_node.js]

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

@ -0,0 +1,54 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
requestLongerTimeout(2);
// Test that refresh animation UI while the panel is hidden.
const EXPECTED_GRAPH_PATH_SEGMENTS = [{ x: 0, y: 0 },
{ x: 49999, y: 0.0 },
{ x: 50000, y: 0.5 },
{ x: 99999, y: 0.5 },
{ x: 100000, y: 0 }];
add_task(function* () {
info("Open animation inspector once so that activate animation mutations listener");
yield addTab("data:text/html;charset=utf8,<div id='target'>test</div>");
const { controller, inspector, panel } = yield openAnimationInspector();
info("Select other tool to hide animation inspector");
yield inspector.sidebar.select("ruleview");
// Count players-updated event in controller.
let updatedEventCount = 0;
controller.on("players-updated", () => {
updatedEventCount += 1;
});
info("Make animation by eval in content");
yield evalInDebuggee(gBrowser.selectedBrowser.messageManager,
`document.querySelector('#target').animate(
{ transform: 'translate(100px)' },
{ duration: 100000, easing: 'steps(2)' });`);
info("Wait for animation mutations event");
yield controller.animationsFront.once("mutations");
info("Check players-updated events count");
is(updatedEventCount, 0, "players-updated event shoud not be fired");
info("Re-select animation inspector and check the UI");
yield inspector.sidebar.select("animationinspector");
yield waitForAnimationTimelineRendering(panel);
const timeBlocks = getAnimationTimeBlocks(panel);
is(timeBlocks.length, 1, "One animation should display");
const timeBlock = timeBlocks[0];
const state = timeBlock.animation.state;
const effectEl = timeBlock.containerEl.querySelector(".effect-easing");
ok(effectEl, "<g> element for effect easing should exist");
const pathEl = effectEl.querySelector("path");
ok(pathEl, "<path> element for effect easing should exist");
assertPathSegments(pathEl, state.duration, false, EXPECTED_GRAPH_PATH_SEGMENTS);
});