diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul')
-rw-r--r-- | layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul b/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul new file mode 100644 index 000000000..c3cce54e5 --- /dev/null +++ b/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul @@ -0,0 +1,114 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + </body> + + <!-- test code goes here --> + <script type="application/javascript"> + <![CDATA[ + SimpleTest.waitForExplicitFinish(); + + var winLowerThanVista = navigator.platform.indexOf("Win") == 0; + if (winLowerThanVista) { + var version = Components.classes["@mozilla.org/system-info;1"] + .getService(Components.interfaces.nsIPropertyBag2) + .getProperty("version"); + winLowerThanVista = parseFloat(version) < 6.0; + } + + var tests = [{maximize: false}, {maximize: true}]; + var testIndex = 0; + var win; + + function testInfo() { + return tests[testIndex].maximize ? " (maximized)" : " (non-maximized)"; + } + + function doTest(evt) { + var initialCount = win.mozPaintCount; + + function nextStep() { + if (win.mozPaintCount == initialCount || win.isMozAfterPaintPending) { + SimpleTest.info("Waiting for mozPaintCount (= " + initialCount + ") to increase" + testInfo()); + // Do not use SimpleTest.executeSoon() here: give a little more time. + setTimeout(nextStep, 100); + return; + } + + isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased" + testInfo()); + + function testLeafLayersPartitionWindow() { + var success = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindowUtils) + .leafLayersPartitionWindow(); + // "[leafLayersPartitionWindow()] Always returns true in non-DEBUG builds." + // To prevent random failures on Windows, try to run this again after a timeout. + if (!success && navigator.platform.indexOf("Win") >= 0) { + setTimeout(testLeafLayersPartitionWindow, 100); + return; + } + ok(success, + "Leaf layers should form a non-overlapping partition of the browser window" + testInfo() + + (success ? "" : ". [Set MOZ_DUMP_PAINT_LIST=1 env var to investigate.]")); + + win.close(); + ++testIndex; + nextTest(); + } + testLeafLayersPartitionWindow(); + } + + if (tests[testIndex].maximize) { + function resizeListener() { + win.removeEventListener("resize", resizeListener, true); + // We want a paint after resize. + initialCount = win.mozPaintCount; + SimpleTest.executeSoon(nextStep); + } + win.addEventListener("resize", resizeListener, true); + SimpleTest.info("Maximizing test " + testIndex + " window" + testInfo()); + Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator) + .getMostRecentWindow("navigator:browser") + .maximize(); + } else { + SimpleTest.executeSoon(nextStep); + } + } + + function nextTest() { + if (testIndex >= tests.length) { + SimpleTest.finish(); + return; + } + + if (winLowerThanVista && !tests[testIndex].maximize) { + ok(true, "Skipping non-maximized test " + testIndex + " on winLowerThanVista since the resizer causes overlapping layers"); + ++testIndex; + nextTest(); + return; + } + + window.focus(); + // Run the test in a separate window so we get a clean browser window. + win = window.open("data:text/html,<html style='overflow:scroll'>", + "", "scrollbars=yes,toolbar,menubar,width=500,height=500"); + setTimeout(setupWindow, 0); + } + + function setupWindow() { + win.addEventListener("load", doTest, false); + win.focus(); + } + + nextTest(); + ]]> + </script> +</window> |