Bug 1241692 - Part 1: Ensure that element which is added in each test is removed before subsequent test is processed. r=dholbert

Before this fix, sometimes an element which was removed in a prior test
would still visible when subsequent test starts.
We should wait for paints to complete after the element has been removed.
This commit is contained in:
Hiroyuki Ikezoe 2016-02-06 20:38:12 +09:00
parent 0e38673c09
commit bd20cd302e

View File

@ -53,6 +53,13 @@ function observeStyling(frameCount, onFrame) {
});
}
function ensureElementRemoval(aElement) {
return new Promise(function(resolve) {
aElement.remove();
waitForAllPaintsFlushed(resolve);
});
}
SimpleTest.waitForExplicitFinish();
const OMTAPrefKey = 'layers.offmainthreadcomposition.async-animations';
@ -81,7 +88,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'CSS animations running on the compositor should not update style ' +
'on the main thread');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* no_restyling_for_compositor_transitions() {
@ -98,7 +105,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'CSS transitions running on the compositor should not update style ' +
'on the main thread');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* no_restyling_when_animation_duration_is_changed() {
@ -114,7 +121,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'Animations running on the compositor should not update style ' +
'on the main thread');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* only_one_restyling_after_finish_is_called() {
@ -130,7 +137,7 @@ waitForAllPaints(function() {
is(markers.length, 1,
'Animations running on the compositor should only update style ' +
'once after finish() is called');
div.remove();
yield ensureElementRemoval(div);
});
add_task(function* no_restyling_mouse_movement_on_finished_transition() {
@ -155,7 +162,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'Bug 1219236: Finished transitions should never cause restyles ' +
'when mouse is moved on the animations');
div.remove();
yield ensureElementRemoval(div);
});
add_task(function* no_restyling_mouse_movement_on_finished_animation() {
@ -178,7 +185,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'Bug 1219236: Finished animations should never cause restyles ' +
'when mouse is moved on the animations');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* no_restyling_compositor_animations_out_of_view_element() {
@ -194,7 +201,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1166500: Animations running on the compositor in out of ' +
'view element should never cause restyles');
div.remove();
yield ensureElementRemoval(div);
});
add_task(function* no_restyling_main_thread_animations_out_of_view_element() {
@ -208,7 +215,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1166500: Animations running on the main-thread in out of ' +
'view element should never cause restyles');
div.remove();
yield ensureElementRemoval(div);
});
/*
@ -231,7 +238,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1166500: Animations running on the compositor in elements ' +
'which are scrolled out should never cause restyles');
parentElement.remove(div);
yield ensureElementRemoval(parentElement);
});
*/
@ -249,7 +256,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1166500: Animations running on the main-thread in elements ' +
'which are scrolled out should never cause restyles');
parentElement.remove();
yield ensureElementRemoval(parentElement);
});
/*
@ -269,7 +276,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1237454: Animations running on the compositor in ' +
'visibility hidden element should never cause restyles');
div.remove();
yield ensureElementRemoval(div);
});
*/
@ -284,7 +291,7 @@ waitForAllPaints(function() {
todo_is(markers.length, 0,
'Bug 1237454: Animations running on the main-thread in ' +
'visibility hidden element should never cause restyles');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* no_restyling_compositor_animations_after_pause_is_called() {
@ -302,7 +309,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'Bug 1232563: Paused animations running on the compositor should ' +
'never cause restyles once after pause() is called');
div.remove();
yield ensureElementRemoval(div);
});
add_task(function* no_restyling_main_thread_animations_after_pause_is_called() {
@ -319,7 +326,7 @@ waitForAllPaints(function() {
is(markers.length, 0,
'Bug 1232563: Paused animations running on the main-thread should ' +
'never cause restyles after pause() is called');
div.remove();
yield ensureElementRemoval(div);
});
add_task_if_omta_enabled(function* only_one_restyling_when_current_time_is_set_to_middle_of_duration() {
@ -334,7 +341,7 @@ waitForAllPaints(function() {
is(markers.length, 1,
'Bug 1235478: Animations running on the compositor should only once ' +
'update style when currentTime is set to middle of duration time');
div.remove();
yield ensureElementRemoval(div);
});
});