Bug 805330 - Ensure plugin widget visibility via paint flushes. r=josh,roc,robcee

--HG--
rename : layout/base/tests/chrome/paint_listener.js => testing/mochitest/tests/SimpleTest/paint_listener.js
This commit is contained in:
Georg Fritzsche 2012-12-05 14:39:26 +01:00
parent 947ecbf100
commit d543e765a5
12 changed files with 21 additions and 10 deletions

View File

@ -3,6 +3,7 @@
<title>Bug 751809</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
SpecialPowers.setBoolPref("plugins.click_to_play", true);
</script>
@ -46,10 +47,9 @@
function afterWindowFocus() {
var plugin = document.getElementById('plugin');
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
synthesizeMouseAtCenter(plugin, {});
var condition = function() objLoadingContent.activated;
var condition = function() plugin.setColor !== undefined;
waitForCondition(condition, afterPluginActivation, "Waited too long for plugin to activate");
}
@ -57,6 +57,16 @@
var plugin = document.getElementById('plugin');
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "plugin should be activated now");
// Triggering a paint and waiting for it to be flushed makes sure
// that both plugin and platform see the plugin element as visible.
// See bug 805330 for details.
plugin.setColor("FF000088");
waitForAllPaintsFlushed(afterPaintsFlushed);
}
function afterPaintsFlushed() {
var plugin = document.getElementById('plugin');
try {
is(plugin.getMouseUpEventCount(), 0, "Plugin should not have received mouse events yet.");
} catch(e) {

View File

@ -11,7 +11,6 @@ relativesrcdir = layout/base/test/chrome
include $(DEPTH)/config/autoconf.mk
MOCHITEST_CHROME_FILES = \
paint_listener.js \
test_bug370436.html \
test_bug396367-1.html \
test_bug396367-2.html \

View File

@ -8,7 +8,7 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript"
src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<div id="container" xmlns="http://www.w3.org/1999/xhtml" style="height:400px; overflow:auto; background:gray">
<div style="height:0">

View File

@ -3,7 +3,7 @@
<head>
<title>Test that we don't get unnecessary repaints with fixed backgrounds</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->

View File

@ -3,7 +3,7 @@
<head>
<title>Test that active transformed elements coming into view are prerendered so we don't have to redraw constantly</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body onload="startTest()">

View File

@ -3,7 +3,7 @@
<head>
<title>Test that we don't get unnecessary repaints due to subpixel shifts</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->

View File

@ -3,7 +3,7 @@
<head>
<title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->

View File

@ -3,7 +3,7 @@
<head>
<title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them (1.1 scale)</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
<script type="text/javascript" src="paint_listener.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)" style="background:white;">

View File

@ -25,5 +25,6 @@ mochikit.jar:
content/tests/SimpleTest/WindowSnapshot.js (tests/SimpleTest/WindowSnapshot.js)
content/tests/SimpleTest/MockObjects.js (tests/SimpleTest/MockObjects.js)
content/tests/SimpleTest/NativeKeyCodes.js (tests/SimpleTest/NativeKeyCodes.js)
content/tests/SimpleTest/paint_listener.js (tests/SimpleTest/paint_listener.js)
content/tests/SimpleTest/docshell_helpers.js (../../docshell/test/chrome/docshell_helpers.js)

View File

@ -20,6 +20,7 @@ _SIMPLETEST_FILES = LogController.js \
WindowSnapshot.js \
MockObjects.js \
NativeKeyCodes.js \
paint_listener.js \
$(DEPTH)/testing/specialpowers/content/MozillaLogger.js \
$(DEPTH)/docshell/test/chrome/docshell_helpers.js \
$(NULL)