Bug 1841896 - Port helper_fission_setResolution to regular mochitests r=hiro

Differential Revision: https://phabricator.services.mozilla.com/D226878
This commit is contained in:
Alex Jakobi 2024-10-29 08:27:38 +00:00
parent 3209ad406b
commit c9db251568
3 changed files with 30 additions and 34 deletions

View File

@ -44,7 +44,6 @@ add_task(async function test_main() {
{ file: "helper_fission_large_subframe.html" },
{ file: "helper_fission_initial_displayport.html" },
{ file: "helper_fission_checkerboard_severity.html" },
{ file: "helper_fission_setResolution.html" },
{ file: "helper_fission_inactivescroller_positionedcontent.html" },
{ file: "helper_fission_irregular_areas.html" },
// add additional tests here

View File

@ -9,51 +9,47 @@
<script src="apz_test_utils.js"></script>
<script>
fission_subtest_init();
async function test() {
let iframeElement = document.getElementById("testframe");
FissionTestHelper.startTestPromise
.then(waitUntilApzStable)
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
.then(waitUntilApzStable)
.then(test)
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestFailed);
const scale = 2.0;
async function test() {
let iframeElement = document.getElementById("testframe");
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(scale);
await promiseApzFlushedRepaints(window);
await waitUntilApzStable();
const scale = 2.0;
const originalWidth = originalHeight = 100;
// eslint-disable-next-line no-unused-vars
let { _x, _y, width, height } = await SpecialPowers.spawn(
iframeElement,
[originalWidth, originalHeight],
// eslint-disable-next-line no-shadow
(width, height) => {
// nsIDOMWindowUtils.toScreenRect uses the iframe's transform which should
// have been informed from APZ.
return SpecialPowers.DOMWindowUtils.toScreenRect(0, 0, width, height);
}
);
SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(scale);
await promiseApzFlushedRepaints(window);
await waitUntilApzStable();
const originalWidth = originalHeight = 100;
// eslint-disable-next-line no-unused-vars
let { _x, _y, width, height } = await SpecialPowers.spawn(
iframeElement,
[originalWidth, originalHeight],
// eslint-disable-next-line no-shadow
(width, height) => {
// nsIDOMWindowUtils.toScreenRect uses the iframe's transform which should
// have been informed from APZ.
return SpecialPowers.DOMWindowUtils.toScreenRect(0, 0, width, height);
is(width, scale * originalWidth,
"The resolution value should be properly delivered into OOP iframes");
is(height, scale * originalHeight,
"The resolution value should be properly delivered into OOP iframes");
}
);
is(width, scale * originalWidth,
"The resolution value should be properly delivered into OOP iframes");
is(height, scale * originalHeight,
"The resolution value should be properly delivered into OOP iframes");
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
<style>
body, html {
margin: 0;
body,
html {
margin: 0;
}
</style>
</head>
<body>
<iframe id="testframe"></iframe>
<iframe id="testframe"></iframe>
</body>
</html>

View File

@ -20,6 +20,7 @@
];
var subtests = [
{ "file": "helper_fission_setResolution.html", "prefs": prefs },
{
"file": "helper_fission_tap_on_zoomed.html",
"prefs": [["apz.max_tap_time", 10000]],