зеркало из https://github.com/mozilla/gecko-dev.git
Bug 602580 - Return CSSViewport from innerWidth and innerHeight (tests). r=tn, a=blocking-fennec
This commit is contained in:
Родитель
a9e8b3db68
Коммит
8be27ff9fc
|
@ -53,7 +53,16 @@ _TEST_FILES = \
|
|||
idn_child.html \
|
||||
file_location.html \
|
||||
test_location.html \
|
||||
test_innerWidthHeight_script.html \
|
||||
innerWidthHeight_script.html \
|
||||
$(NULL)
|
||||
|
||||
ifeq (mobile,$(MOZ_BUILD_APP))
|
||||
_TEST_FILES += \
|
||||
test_innerWidthHeight_metaviewport.html \
|
||||
innerWidthHeight_metaviewport.html \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; height=320; user-scalable=false"/>
|
||||
<title>Bug 602580 - Test getting and setting innerWidth and Height with a CSSViewport</title>
|
||||
<script class="testbody" type="text/javascript">
|
||||
function runSubTest()
|
||||
{
|
||||
// get ability to set innerWidth and height without setting a pref
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
/* 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.opener.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="runSubTest()">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
|
||||
<script class="testbody" type="text/javascript">
|
||||
function runSubTest()
|
||||
{
|
||||
// get ability to set innerWidth and height without setting a pref
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Firefox doesn't support the metaviewport tag, so we force a css viewport
|
||||
// here using nsIDomWindowUtils
|
||||
var cwu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
cwu.setCSSViewport(320, 320);
|
||||
|
||||
var oldWidth = window.innerWidth;
|
||||
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.opener.is(window.innerWidth, 300, "innerWidth returns value that was set");
|
||||
window.innerWidth = oldWidth;
|
||||
|
||||
window.innerHeight = 300;
|
||||
window.opener.is(window.innerHeight, 300, "innerHeight returns value that was set");
|
||||
window.innerHeight = oldHeight;
|
||||
|
||||
window.opener.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="runSubTest()">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 602580 - Test getting and setting innerWidth and Height with a CSSViewport</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<!--
|
||||
This acts funny when run in the normal content frame
|
||||
so instead We load it in a separate window.
|
||||
-->
|
||||
</head>
|
||||
<body onload="runTest()">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var newWin = null;
|
||||
function runTest() {
|
||||
newWin = window.open("innerWidthHeight_metaviewport.html", '_new', 'width=600,height=400');
|
||||
}
|
||||
|
||||
function finish() {
|
||||
newWin.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<!--
|
||||
This acts funny when run in the normal content frame
|
||||
so instead We load it in a separate window.
|
||||
-->
|
||||
</head>
|
||||
<body onload="runTest()">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var newWin = null;
|
||||
function runTest() {
|
||||
newWin = window.open("innerWidthHeight_script.html", '_new', 'width=600,height=400');
|
||||
}
|
||||
|
||||
function finish() {
|
||||
newWin.close();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче