Bug 1504659 Part 4: Update tests to distinguish between layout and visual viewports. r=botond

Testing the initial value of innerWidth and innerHeight is not really viable when
the visual viewport has been set by the opener, but constrained by the device.
The returned value differs between the desktop and mobile browsers because of the
device constraints. The simplest thing to do is to test the CSS viewport and
ensure that the innerWidth values can be set.

Differential Revision: https://phabricator.services.mozilla.com/D15996

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-01-16 21:57:52 +00:00
parent 3acc8c95a9
commit 52a3895d81
2 changed files with 8 additions and 8 deletions

View File

@ -2,23 +2,24 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=320,height=320" /> <meta name="viewport" content="width=320,height=320" />
<title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title> <title>Bug 602580 - Test layout viewport and visual viewport sizes with meta tags and changed innerWidth</title>
<script class="testbody" type="text/javascript"> <script class="testbody" type="text/javascript">
function runSubTest() function runSubTest()
{ {
/* CSS viewport is set the by the meta tag in this document. */
window.opener.is(document.documentElement.clientWidth, 320, "CSS viewport width is meta viewport width");
window.opener.is(document.documentElement.clientHeight, 320, "CSS viewport height is meta viewport height");
/* Visual viewport values can be changed by setting window.innerWidth and innerHeight. */
var oldWidth = window.innerWidth; var oldWidth = window.innerWidth;
var oldHeight = window.innerHeight; var oldHeight = window.innerHeight;
/* Test that return values are now from viewport */
window.opener.is(window.innerWidth, 320, "innerWidth is css viewport width");
window.opener.is(window.innerHeight, 320, "innerHeight is css viewport height");
window.innerWidth = 300; window.innerWidth = 300;
window.opener.is(window.innerWidth, 300, "innerWidth returns value that was set"); window.opener.is(window.innerWidth, 300, "visual viewport width returns set value");
window.innerWidth = oldWidth; window.innerWidth = oldWidth;
window.innerHeight = 300; window.innerHeight = 300;
window.opener.is(window.innerHeight, 300, "innerHeight returns value that was set"); window.opener.is(window.innerHeight, 300, "visual viewport height returns set value");
window.innerHeight = oldHeight; window.innerHeight = oldHeight;
window.opener.finish(); window.opener.finish();

View File

@ -12,7 +12,6 @@ support-files =
[test_crossdomainprops.html] [test_crossdomainprops.html]
[test_innerWidthHeight_script.html] [test_innerWidthHeight_script.html]
skip-if = toolkit == 'android' # Bug 1075071 - Permafail on Android
[test_location.html] [test_location.html]
[test_location_framed.html] [test_location_framed.html]
[test_location_getters.html] [test_location_getters.html]