From f74640f5c627020a71c7e50a66ea972b237d9b8b Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Sat, 23 Mar 2013 18:02:21 +0000 Subject: [PATCH] Bug 854117 - Re-enable test_resize_move_windows.html and test_resize_move_windows.xul on Linux. rs=Ms2ger --- dom/tests/mochitest/bugs/Makefile.in | 7 ---- .../bugs/test_resize_move_windows.html | 39 +++++++++++++++---- dom/tests/mochitest/chrome/Makefile.in | 9 +---- .../chrome/test_resize_move_windows.xul | 24 +++++++++--- testing/mochitest/android.json | 4 +- testing/mochitest/b2g.json | 4 +- 6 files changed, 55 insertions(+), 32 deletions(-) diff --git a/dom/tests/mochitest/bugs/Makefile.in b/dom/tests/mochitest/bugs/Makefile.in index 75d1cc25c88b..b236e889ae67 100644 --- a/dom/tests/mochitest/bugs/Makefile.in +++ b/dom/tests/mochitest/bugs/Makefile.in @@ -141,14 +141,7 @@ MOCHITEST_FILES = \ test_bug817476.html \ test_bug823173.html \ test_bug850517.html \ - $(NULL) - -ifneq (Linux,$(OS_ARCH)) -MOCHITEST_FILES += \ test_resize_move_windows.html \ $(NULL) -else -$(filter disabled-on-linux-for-timeouts--bug-677841, test_resize_move_windows.html) -endif include $(topsrcdir)/config/rules.mk diff --git a/dom/tests/mochitest/bugs/test_resize_move_windows.html b/dom/tests/mochitest/bugs/test_resize_move_windows.html index a0643d0b769c..2592daee75c4 100644 --- a/dom/tests/mochitest/bugs/test_resize_move_windows.html +++ b/dom/tests/mochitest/bugs/test_resize_move_windows.html @@ -52,12 +52,14 @@ function getNewHeight(aWindow) function getNewX(aWindow) { - return (aWindow.screenX > (screen.width / 2)) ? 0 : screen.width; + return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2)) + ? 0 : screen.width - aWindow.outerWidth; } function getNewY(aWindow) { - return (aWindow.screenY > (screen.height / 2)) ? 0 : screen.height; + return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2)) + ? 0 : screen.height - aWindow.outerHeight; } /** @@ -180,12 +182,30 @@ function checkChangeIsEnabled(aWindow, aNext) } function posChangeCondition() { + // With GTK, sometimes, only one dimension changes. + if (navigator.platform.indexOf('Linux') != -1) { + return aWindow.screenX != prevX || aWindow.screenY != prevY; + } return aWindow.screenX != prevX && aWindow.screenY != prevY; } function posChangeTest() { - isnot(aWindow.screenX, prevX, "Window x position should have changed"); - isnot(aWindow.screenY, prevY, "Window y position should have changed"); + // With GTK, sometimes, only one dimension changes. + if (navigator.platform.indexOf('Linux') != -1) { + // With GTK, sometimes, aWindow.screenX changes during two calls. + // So we call it once and save the returned value. + var x = aWindow.screenX; + var y = aWindow.screenY; + if (x != prevX) { + isnot(x, prevX, "Window x position should have changed"); + } + if (y != prevY) { + isnot(y, prevY, "Window y position should have changed"); + } + } else { + isnot(aWindow.screenX, prevX, "Window x position should have changed"); + isnot(aWindow.screenY, prevY, "Window y position should have changed"); + } prevX = aWindow.screenX; prevY = aWindow.screenY; @@ -235,9 +255,14 @@ function checkChangeIsEnabled(aWindow, aNext) aWindow.screenY = getNewY(aWindow); hitEventLoop(posChangeCondition, posChangeTest, hits, function () { + prevX = aWindow.screenX; + prevY = aWindow.screenY; + aWindow.moveTo(getNewX(aWindow), getNewY(aWindow)); hitEventLoop(posChangeCondition, posChangeTest, hits, function () { + prevX = aWindow.screenX; + prevY = aWindow.screenY; aWindow.moveBy(getNewX(aWindow) - aWindow.screenX, getNewY(aWindow) - aWindow.screenY); @@ -283,11 +308,11 @@ SimpleTest.waitForFocus(function() { " };" + " is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');" + " is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');" + - " is_range(window.screenX, 120, 5, 'parameter screenX should be taken into account');" + - " is_range(window.screenY, 120, 5, 'parameter screenY should be taken into account');" + + " is_range(window.screenX, 65, 5, 'parameter screenX should be taken into account');" + + " is_range(window.screenY, 65, 5, 'parameter screenY should be taken into account');" + " window.opener.checkChangeIsEnabled(window, next);" + "} <\/script>", '', - 'width=170,height=170,screenX=120,screenY=120'); + 'width=170,height=170,screenX=65,screenY=65'); SimpleTest.waitForFocus(function() { w.check(function() { diff --git a/dom/tests/mochitest/chrome/Makefile.in b/dom/tests/mochitest/chrome/Makefile.in index 5d1b0a082fb5..50f9701af02b 100644 --- a/dom/tests/mochitest/chrome/Makefile.in +++ b/dom/tests/mochitest/chrome/Makefile.in @@ -59,6 +59,7 @@ MOCHITEST_CHROME_FILES = \ test_bug830858.xul \ file_bug830858.xul \ test_indexedSetter.html \ + test_resize_move_windows.xul \ $(NULL) ifeq (WINNT,$(OS_ARCH)) @@ -68,14 +69,6 @@ MOCHITEST_CHROME_FILES += \ $(NULL) endif -ifneq (Linux,$(OS_ARCH)) -MOCHITEST_CHROME_FILES += \ - test_resize_move_windows.xul \ - $(NULL) -else -$(filter disabled-on-linux-for-timeouts--bug-834716, test_resize_move_windows.xul) -endif - ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT)) MOCHITEST_CHROME_FILES += \ test_MozEnteredDomFullscreen_event.xul \ diff --git a/dom/tests/mochitest/chrome/test_resize_move_windows.xul b/dom/tests/mochitest/chrome/test_resize_move_windows.xul index 1286fac81c53..521cad97050f 100644 --- a/dom/tests/mochitest/chrome/test_resize_move_windows.xul +++ b/dom/tests/mochitest/chrome/test_resize_move_windows.xul @@ -49,12 +49,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541 function getNewX(aWindow) { - return (aWindow.screenX > (screen.width / 2)) ? 0 : screen.width; + return (aWindow.screenX > ((screen.width - aWindow.outerWidth) / 2)) + ? 0 : screen.width - aWindow.outerWidth; } function getNewY(aWindow) { - return (aWindow.screenY > (screen.height / 2)) ? 0 : screen.height; + return (aWindow.screenY > ((screen.height - aWindow.outerHeight) / 2)) + ? 0 : screen.height - aWindow.outerHeight; } /** @@ -110,6 +112,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541 return aWindow.screenX != prevX && aWindow.screenY != prevY; } + function posChangeConditionIgnoreLinux() { + if (posChangeCondition()) { + return true; + } + + if (navigator.platform.indexOf('Linux') != -1) { + return true; + } + } + function posChangeTest() { // With GTK, sometimes, only one dimension changes. if (navigator.platform.indexOf('Linux') != -1) { @@ -182,7 +194,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541 aWindow.moveBy(getNewX(aWindow) - aWindow.screenX, getNewY(aWindow) - aWindow.screenY); - hitEventLoop(posChangeCondition, posChangeTest, hits, function () { + hitEventLoop(posChangeConditionIgnoreLinux, posChangeTest, hits, function () { /** * Outer width/height checks. */ @@ -222,11 +234,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565541 " };" + " is_range(window.innerWidth, 170, 5, 'parameter width should be taken into account');" + " is_range(window.innerHeight, 170, 5, 'parameter height should be taken into account');" + - " is_range(window.screenX, 120, 5, 'parameter screenX should be taken into account');" + - " is_range(window.screenY, 120, 5, 'parameter screenY should be taken into account');" + + " is_range(window.screenX, 25, 5, 'parameter screenX should be taken into account');" + + " is_range(window.screenY, 25, 5, 'parameter screenY should be taken into account');" + " checkChangeIsEnabled(window, next);" + "} <\/script>", '', - 'width=170,height=170,screenX=120,screenY=120'); + 'width=170,height=170,screenX=25,screenY=25'); SimpleTest.waitForFocus(function() { w.wrappedJSObject.ok = SimpleTest.ok; diff --git a/testing/mochitest/android.json b/testing/mochitest/android.json index 04da037a57b4..1ea807f0c328 100644 --- a/testing/mochitest/android.json +++ b/testing/mochitest/android.json @@ -184,8 +184,8 @@ "dom/tests/mochitest/bugs/test_bug61098.html": "", "dom/tests/mochitest/bugs/test_bug641552.html": "", "dom/tests/mochitest/bugs/test_devicemotion_multiple_listeners.html": "bug 775227", - "dom/tests/mochitest/bugs/test_resize_move_windows.html": "TIMED_OUT", - "dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "TIMED_OUT", + "dom/tests/mochitest/bugs/test_resize_move_windows.html": "Windows can't change size and position on Android", + "dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "Windows can't change size on Android", "dom/tests/mochitest/bugs/test_window_bar.html": "", "dom/tests/mochitest/dom-level2-core/test_documentimportnode03.html": "", "dom/tests/mochitest/dom-level2-core/test_documentimportnode04.html": "", diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 81bfac18dda5..04e005d39ee2 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -359,8 +359,8 @@ "dom/tests/mochitest/bugs/test_bug641552.html":"", "dom/tests/mochitest/bugs/test_bug642026.html":"", "dom/tests/mochitest/bugs/test_bug648465.html":"", - "dom/tests/mochitest/bugs/test_sizetocontent_clamp.html":"", - + "dom/tests/mochitest/bugs/test_sizetocontent_clamp.html": "Windows can't change size on B2G", + "dom/tests/mochitest/bugs/test_resize_move_windows.html": "Windows can't change size and position on B2G", "dom/tests/mochitest/bugs/test_window_bar.html":"", "dom/tests/mochitest/general/test_497898.html":"", "dom/tests/mochitest/general/test_bug628069_1.html":"",