Bug 874843 - Cleanup plugin_focus_helper test events to try and fix intermittent orange. r=roc

This commit is contained in:
John Schoenick 2013-07-22 08:55:19 -04:00
Родитель 38eb5bd229
Коммит 14dbea4c39
4 изменённых файлов: 62 добавлений и 21 удалений

Просмотреть файл

@ -32,8 +32,7 @@ function runTests() {
checkClipRegionNoBounds("p1", []); checkClipRegionNoBounds("p1", []);
checkClipRegionNoBounds("p2", []); checkClipRegionNoBounds("p2", []);
window.opener.SimpleTest.finish(); window.opener.childDone();
window.close();
} }
]]> ]]>

Просмотреть файл

@ -7,43 +7,69 @@
</head> </head>
<body> <body>
<p><input type="text" id="input"> <p><input type="text" id="input"></input>
<p><embed id="p1" type="application/x-test" wmode="window"></embed><embed id="p2" type="application/x-test"></embed> <p><embed id="p1" type="application/x-test" wmode="window" paintscript="didPaint('p1')">
<embed id="p2" type="application/x-test" paintscript="didPaint('p2')"></p>
<script> <script type="text/javascript">
var SimpleTest = window.opener.SimpleTest; var SimpleTest = window.opener.SimpleTest;
var is = window.opener.is; var is = window.opener.is;
var ok = window.opener.ok; var ok = window.opener.ok;
var todo = window.opener.todo; var todo = window.opener.todo;
var info = window.opener.info;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); SimpleTest.waitForExplicitFinish();
const Cc = Components.classes;
const Ci = Components.interfaces; // We don't want to trigger native mouse events until the document is fully
var gWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor). // loaded and each plugin has painted once.
getInterface(Ci.nsIDOMWindowUtils); var expectPaints = 2;
var loaded = false;
function didPaint(id) {
ok(--expectPaints >= 0, "Got plugin painted event from "+id);
document.getElementById(id).setAttribute("paintscript", null);
if (expectPaints == 0) {
if (document.readyState == "complete") {
theTest();
} else {
info("Waiting for document load to continue");
window.addEventListener("load", function() { theTest(); });
}
}
}
//
// Begin the test
//
function theTest() {
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var gWindowUtils = SpecialPowers.wrap(window)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
var nativeMouseDown; var nativeMouseDown;
var nativeMouseUp; var nativeMouseUp;
SimpleTest.waitForExplicitFinish();
function activatePlugin(id) { function activatePlugin(id) {
return function() { return function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var element = document.getElementById(id); var element = document.getElementById(id);
var bounds = element.getBoundingClientRect(); var bounds = element.getBoundingClientRect();
var x = (bounds.left + window.mozInnerScreenX + 10); var x = (bounds.left + window.mozInnerScreenX + 10);
var y = (bounds.top + window.mozInnerScreenY + 10); var y = (bounds.top + window.mozInnerScreenY + 10);
gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseDown, 0, element); SimpleTest.executeSoon(function () {
gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseUp, 0, element); gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseDown, 0, element);
SimpleTest.executeSoon(function () {
gWindowUtils.sendNativeMouseEvent(x, y, nativeMouseUp, 0, element);
});
});
}; };
} }
function done() { function done() {
SimpleTest.finish(); window.opener.childDone();
window.close();
} }
var step = 0; var step = 0;
@ -64,8 +90,7 @@ function handleEvent(event) {
is(event.target.id, s.id, "Check event target"); is(event.target.id, s.id, "Check event target");
if (s.action) { if (s.action) {
// Do the action after this event cycle is done SimpleTest.executeSoon(s.action);
setTimeout(s.action, 1000);
} }
} }
@ -89,9 +114,12 @@ if (navigator.platform.indexOf("Mac") >= 0) {
nativeMouseUp = 4; // MOUSEEVENTF_LEFTUP nativeMouseUp = 4; // MOUSEEVENTF_LEFTUP
SimpleTest.waitForFocus(doTest, window); SimpleTest.waitForFocus(doTest, window);
} else { } else {
// XXX(johns): our gtk2 sendNativeMouseEvent doesn't support clicks
todo(false, "Platform not supported"); todo(false, "Platform not supported");
done(); done();
} }
} // function theTest
</script> </script>
</body> </body>

Просмотреть файл

@ -8,11 +8,18 @@
<script class="testbody" type="application/javascript"> <script class="testbody" type="application/javascript">
<![CDATA[ <![CDATA[
var child;
function childDone() {
child.close();
SimpleTest.executeSoon(SimpleTest.finish());
}
if (navigator.platform.indexOf("Mac") == 0) { if (navigator.platform.indexOf("Mac") == 0) {
todo(false, "Mac plugins do not run in windowed mode"); todo(false, "Mac plugins do not run in windowed mode");
} else { } else {
window.open("plugin_clipping_helper_transformed.xhtml", "", "width=620,height=320");
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
child = window.open("plugin_clipping_helper_transformed.xhtml", "", "width=620,height=320");
} }
]]> ]]>
</script> </script>

Просмотреть файл

@ -6,8 +6,15 @@
<body> <body>
<script class="testbody" type="application/javascript"> <script class="testbody" type="application/javascript">
window.open("plugin_focus_helper.html", "", "width=620,height=320");
var child;
function childDone() {
child.close();
SimpleTest.executeSoon(SimpleTest.finish());
}
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
child = window.open("plugin_focus_helper.html", "", "width=620,height=320");
</script> </script>
</body> </body>