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_large_subframe.html" },
{ file: "helper_fission_initial_displayport.html" }, { file: "helper_fission_initial_displayport.html" },
{ file: "helper_fission_checkerboard_severity.html" }, { file: "helper_fission_checkerboard_severity.html" },
{ file: "helper_fission_setResolution.html" },
{ file: "helper_fission_inactivescroller_positionedcontent.html" }, { file: "helper_fission_inactivescroller_positionedcontent.html" },
{ file: "helper_fission_irregular_areas.html" }, { file: "helper_fission_irregular_areas.html" },
// add additional tests here // add additional tests here

View File

@ -9,51 +9,47 @@
<script src="apz_test_utils.js"></script> <script src="apz_test_utils.js"></script>
<script> <script>
fission_subtest_init(); async function test() {
let iframeElement = document.getElementById("testframe");
FissionTestHelper.startTestPromise const scale = 2.0;
.then(waitUntilApzStable)
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
.then(waitUntilApzStable)
.then(test)
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestFailed);
async function test() { SpecialPowers.getDOMWindowUtils(window).setResolutionAndScaleTo(scale);
let iframeElement = document.getElementById("testframe"); 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); is(width, scale * originalWidth,
await promiseApzFlushedRepaints(window); "The resolution value should be properly delivered into OOP iframes");
await waitUntilApzStable(); is(height, scale * originalHeight,
"The resolution value should be properly delivered into OOP iframes");
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, waitUntilApzStable()
"The resolution value should be properly delivered into OOP iframes"); .then(test)
is(height, scale * originalHeight, .then(subtestDone, subtestFailed);
"The resolution value should be properly delivered into OOP iframes");
}
</script> </script>
<style> <style>
body, html { body,
margin: 0; html {
margin: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<iframe id="testframe"></iframe> <iframe id="testframe"></iframe>
</body> </body>
</html> </html>

View File

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