forked from mirrors/gecko-dev
Bug 1421651 - Integrate animation triggered restyle counter into tests r=emilio
This commits integrates the new animation triggered restyle counter into the existing tests to ensure that the counter matches the expected marker count. Depends on D186714 Differential Revision: https://phabricator.services.mozilla.com/D186715
This commit is contained in:
parent
0cfa3eed35
commit
f2287f3ca8
6 changed files with 310 additions and 148 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -511,17 +511,25 @@ function observeStyling(frameCount, onFrame) {
|
|||
function observeStylingInTargetWindow(aWindow, aFrameCount, aOnFrame) {
|
||||
const docShell = getDocShellForObservingRestylesForWindow(aWindow);
|
||||
|
||||
let priorAnimationTriggeredRestyles =
|
||||
SpecialPowers.wrap(aWindow).windowUtils.animationTriggeredRestyles;
|
||||
|
||||
return new Promise(resolve => {
|
||||
return waitForAnimationFrames(aFrameCount, aOnFrame, aWindow).then(() => {
|
||||
let restyleCount =
|
||||
SpecialPowers.wrap(aWindow).windowUtils.animationTriggeredRestyles -
|
||||
priorAnimationTriggeredRestyles;
|
||||
|
||||
const markers = docShell.popProfileTimelineMarkers();
|
||||
docShell.recordProfileTimelineMarkers = false;
|
||||
|
||||
const stylingMarkers = Array.prototype.filter.call(
|
||||
markers,
|
||||
(marker, index) => {
|
||||
return marker.name == "Styles" && marker.isAnimationOnly;
|
||||
}
|
||||
);
|
||||
resolve(stylingMarkers);
|
||||
resolve([stylingMarkers, restyleCount]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ async function observe_styling_in_oopif(aFrameCount) {
|
|||
const observe_styling = function(frameCount) {
|
||||
// Start in a rAF callback.
|
||||
waitForAnimationFrames(1).then(() => {
|
||||
observeStyling(frameCount).then(markers => {
|
||||
FissionTestHelper.fireEventInEmbedder("OOPIF:StyleCount", markers.length);
|
||||
observeStyling(frameCount).then(([markers, counter]) => {
|
||||
FissionTestHelper.fireEventInEmbedder("OOPIF:StyleCount", [markers.length, counter]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -80,8 +80,9 @@ async function test() {
|
|||
// overflow: hidden style in the out-of-process iframe.
|
||||
await setup_in_oopif();
|
||||
|
||||
let styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 0,
|
||||
let [markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 0,
|
||||
"Animation in an out-of-process iframe which is initially clipped out " +
|
||||
"due to 'overflow: hidden' should be throttled");
|
||||
|
||||
|
|
@ -95,8 +96,9 @@ async function test() {
|
|||
// from APZC reaches the iframe process
|
||||
await observe_styling_in_oopif(1);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 5,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 5,
|
||||
"Animation in an out-of-process iframe which is no longer clipped out " +
|
||||
"should NOT be throttled");
|
||||
|
||||
|
|
@ -110,8 +112,9 @@ async function test() {
|
|||
// from APZC reaches the iframe process
|
||||
await observe_styling_in_oopif(1);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 0,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 0,
|
||||
"Animation in an out-of-process iframe which is clipped out again " +
|
||||
"should be throttled again");
|
||||
|
||||
|
|
@ -125,8 +128,9 @@ async function test() {
|
|||
// helper_fission_scroll_oopif.html
|
||||
await observe_styling_in_oopif(60);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 5,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 5,
|
||||
"Animation in an out-of-process iframe which is now visible by " +
|
||||
"asynchronous scrolling should NOT be throttled");
|
||||
|
||||
|
|
@ -137,8 +141,9 @@ async function test() {
|
|||
// Wait for the asyncronous scroll finish.
|
||||
await observe_styling_in_oopif(60);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 0,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 0,
|
||||
"Animation in an out-of-process iframe which is scrolled out of view by " +
|
||||
"asynchronous scrolling should be throttled");
|
||||
|
||||
|
|
@ -149,8 +154,9 @@ async function test() {
|
|||
// Wait for the asyncronous scroll finish.
|
||||
await observe_styling_in_oopif(60);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 5,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 5,
|
||||
"Animation in an out-of-process iframe appeared by the asynchronous " +
|
||||
"scrolling should be NOT throttled");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ async function observe_styling_in_oopif(aFrameCount) {
|
|||
const observe_styling = function(frameCount) {
|
||||
// Start in a rAF callback.
|
||||
waitForAnimationFrames(1).then(() => {
|
||||
observeStyling(frameCount).then(markers => {
|
||||
FissionTestHelper.fireEventInEmbedder("OOPIF:StyleCount", markers.length);
|
||||
observeStyling(frameCount).then(([markers, counter]) => {
|
||||
FissionTestHelper.fireEventInEmbedder("OOPIF:StyleCount", [markers.length, counter]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -78,8 +78,9 @@ async function test() {
|
|||
// on the iframe coodinate system.
|
||||
const [right, bottom] = await setup_in_oopif();
|
||||
|
||||
let styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 0,
|
||||
let [markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 0,
|
||||
"Animation in an out-of-process iframe which is initially scrolled out " +
|
||||
"of view should be throttled");
|
||||
|
||||
|
|
@ -93,8 +94,9 @@ async function test() {
|
|||
// helper_fission_scroll_oopif.html
|
||||
await observe_styling_in_oopif(60);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 5,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 5,
|
||||
"Animation in an out-of-process iframe which is no longer scrolled out " +
|
||||
"of view should NOT be throttled");
|
||||
|
||||
|
|
@ -112,8 +114,9 @@ async function test() {
|
|||
// Wait for the asyncronous scroll finish.
|
||||
await observe_styling_in_oopif(60);
|
||||
|
||||
styleCount = await observe_styling_in_oopif(5);
|
||||
is(styleCount, 0,
|
||||
[markerCount, restyleCounter] = await observe_styling_in_oopif(5);
|
||||
is(restyleCounter, markerCount, "Restyle counter should match number of markers");
|
||||
is(markerCount, 0,
|
||||
"Animation in an out-of-process iframe which is scrolled out of view " +
|
||||
"again should be throttled");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,12 @@ add_task(async () => {
|
|||
);
|
||||
|
||||
// Collect restyling markers in 5 frames.
|
||||
const markers = await observeStylingInTargetWindow(panel.ownerGlobal, 5);
|
||||
const [markers, counter] = await observeStylingInTargetWindow(
|
||||
panel.ownerGlobal,
|
||||
5
|
||||
);
|
||||
|
||||
Assert.equal(markers.length, counter);
|
||||
|
||||
// On non WebRender we observe two restyling markers because we get the second
|
||||
// jank report from the compositor thread before a new pre-rendered result,
|
||||
|
|
|
|||
|
|
@ -66,13 +66,17 @@ function observeStyling(frameCount) {
|
|||
docShell.recordProfileTimelineMarkers = true;
|
||||
docShell.popProfileTimelineMarkers();
|
||||
|
||||
let priorAnimationTriggeredRestyles = SpecialPowers.DOMWindowUtils.animationTriggeredRestyles;
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
return waitForAnimationFrames(frameCount).then(framesWaited => {
|
||||
var markers = docShell.popProfileTimelineMarkers();
|
||||
docShell.recordProfileTimelineMarkers = false;
|
||||
const restyleCount = SpecialPowers.DOMWindowUtils.animationTriggeredRestyles - priorAnimationTriggeredRestyles;
|
||||
var stylingMarkers = Array.prototype.filter.call(markers, function(marker, index) {
|
||||
return marker.name == 'Styles' && marker.isAnimationOnly;
|
||||
});
|
||||
is(restyleCount, stylingMarkers.length, "Restyle counter should match number of markers recorded");
|
||||
resolve({
|
||||
stylingCount: stylingMarkers.length,
|
||||
framesWaited: framesWaited,
|
||||
|
|
|
|||
Loading…
Reference in a new issue