forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1786668 - Add a test case that MobileViewportManager is properly …
…updated when browser window moves from a HiDPI monitor to normal one. r=tnikkel Unfortunately this test doesn't run as expected on our CI since macs on our CI are running normal DPI mode. I tested this test works properly on my macbook, it fails without the fix in the previous commit and it passes with the fix. Differential Revision: https://phabricator.services.mozilla.com/D153688
- Loading branch information
Showing
9 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
const PAGECONTENT = | ||
"<!DOCTYPE html>" + | ||
"<html>" + | ||
"<style>" + | ||
"html { " + | ||
" height: 120vh;" + | ||
" overflow-y: scroll;" + | ||
"}" + | ||
"</style>" + | ||
"</html>"; | ||
|
||
const pageUrl = "data:text/html," + encodeURIComponent(PAGECONTENT); | ||
|
||
add_task(async function test() { | ||
if (window.devicePixelRatio != 2) { | ||
ok( | ||
true, | ||
"Skip this test since this test is supposed to run on HiDPI mode, " + | ||
"the devixePixelRato on this machine is " + | ||
window.devicePixelRatio | ||
); | ||
return; | ||
} | ||
|
||
const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl); | ||
|
||
// Scroll the content a bit. | ||
const originalScrollPosition = await SpecialPowers.spawn( | ||
tab.linkedBrowser, | ||
[], | ||
async () => { | ||
content.document.scrollingElement.scrollTop = 100; | ||
return content.document.scrollingElement.scrollTop; | ||
} | ||
); | ||
|
||
// Disabling HiDPI mode and check the scroll position. | ||
SpecialPowers.DOMWindowUtils.setHiDPIMode(false); | ||
const scrollPosition = await SpecialPowers.spawn( | ||
tab.linkedBrowser, | ||
[], | ||
async () => { | ||
return content.document.scrollingElement.scrollTop; | ||
} | ||
); | ||
is( | ||
originalScrollPosition, | ||
scrollPosition, | ||
"The scroll position should be kept" | ||
); | ||
BrowserTestUtils.removeTab(tab); | ||
|
||
SpecialPowers.DOMWindowUtils.restoreHiDPIMode(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters