Bug 632408. (Bv1) Improve newer test code some more. r=roc.

This commit is contained in:
Serge Gautherie 2012-05-15 15:33:55 +02:00
parent 9f9e46fe18
commit 37a6f34897
2 changed files with 33 additions and 18 deletions

View File

@ -63,7 +63,6 @@ _CHROME_FILES = \
chrome_over_plugin_window.xul \
test_default_background.xul \
default_background_window.xul \
test_leaf_layers_partition_browser_window.xul \
test_no_clip_iframe.xul \
no_clip_iframe_window.xul \
no_clip_iframe_subdoc.html \
@ -76,7 +75,13 @@ _CHROME_FILES = \
printpreview_bug482976_helper.xul \
test_transformed_scrolling_repaints.html \
test_transformed_scrolling_repaints_2.html \
$(NULL)
$(NULL)
ifdef MOZ_DEBUG
_CHROME_FILES += \
test_leaf_layers_partition_browser_window.xul \
$(NULL)
endif
libs:: $(_CHROME_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)

View File

@ -15,11 +15,15 @@
<![CDATA[
SimpleTest.waitForExplicitFinish();
var version = Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2)
.getProperty("version");
var winXP = navigator.platform.indexOf("Win") == 0 && parseFloat(version) < 6.0;
var tests = [{maximize:false}, {maximize:true}];
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;
@ -29,26 +33,32 @@
function doTest(evt) {
if (tests[testIndex].maximize) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
wm.getMostRecentWindow("navigator:browser").maximize();
SimpleTest.info("Maximizing test " + testIndex + " window" + testInfo());
Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow("navigator:browser")
.maximize();
}
var initialCount = win.mozPaintCount;
function nextStep() {
if (win.mozPaintCount == initialCount) {
SimpleTest.info("Waiting for mozPaintCount (= " + initialCount + ") to increase" + testInfo());
// Do not use SimpleTest.executeSoon() here: give a little more time.
setTimeout(nextStep, 0);
setTimeout(nextStep, 100);
return;
}
isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased" + testInfo());
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
ok(utils.leafLayersPartitionWindow(),
"Leaf layers should form a non-overlapping partition of the browser window" + testInfo());
var success = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.leafLayersPartitionWindow();
// "[leafLayersPartitionWindow()] Always returns true in non-DEBUG builds."
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;
@ -64,8 +74,8 @@
return;
}
// Skip non-maximized tests on WinXP since the resizer causes overlapping layers
if (winXP && !tests[testIndex].maximize) {
if (winLowerThanVista && !tests[testIndex].maximize) {
ok(true, "Skipping non-maximized test " + testIndex + " on winLowerThanVista since the resizer causes overlapping layers");
++testIndex;
nextTest();
return;
@ -74,7 +84,7 @@
// 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");
win.addEventListener('load', doTest, false);
win.addEventListener("load", doTest, false);
}
nextTest();