Bug 1691358 - Add a test to make sure nsIDOMWindowUtils.setResolutionAndScaleTo properly delivered to OOP iframes. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D122661
This commit is contained in:
Hiroyuki Ikezoe 2021-08-16 21:52:05 +00:00
Родитель 4047b6ce88
Коммит 10263485a1
2 изменённых файлов: 60 добавлений и 0 удалений

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

@ -63,6 +63,7 @@ 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" },
// add additional tests here
];
// These tests are to ensure hit-testing works perfectly on the WR

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

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>setResolutionAndScaleTo is properly delivered to OOP iframes</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script src="helper_fission_utils.js"></script>
<script src="apz_test_utils.js"></script>
<script>
fission_subtest_init();
FissionTestHelper.startTestPromise
.then(waitUntilApzStable)
.then(loadOOPIFrame("testframe", "helper_fission_empty.html"))
.then(waitUntilApzStable)
.then(test)
.then(FissionTestHelper.subtestDone, FissionTestHelper.subtestFailed);
async function test() {
let iframeElement = document.getElementById("testframe");
const scale = 2.0;
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");
}
</script>
<style>
body, html {
margin: 0;
}
</style>
</head>
<body>
<iframe id="testframe"></iframe>
</body>
</html>