Bug 519592 - Attempt to fix intermittent failure in content/html/content/test/test_bug514856.html. r=ehsan

This commit is contained in:
Mounir Lamouri 2011-04-12 23:34:02 -07:00
parent 1267fd5fd1
commit d22c04efbe
2 changed files with 27 additions and 21 deletions

View File

@ -14,7 +14,7 @@
</head>
<body>
<a href="bug514856_iframe.html">
<img ismap="ismap" onclick="parent.clearTimeout(parent.timer);"
<img ismap="ismap"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jqch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==">
</a>
</body>

View File

@ -7,41 +7,45 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=514856
<title>Test for Bug 514856</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="runTest()">
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=514856">Mozilla Bug 514856</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<iframe id="testFrame" src="bug514856_iframe.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 514856 **/
SimpleTest.waitForExplicitFinish();
var timer;
function runTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
function beginTest() {
var ifr = document.getElementById("testFrame");
ifr.setAttribute("onload", "testDone();");
// Retry until everything in the iframe is ready for the click.
timer = setTimeout("runTest()", 10);
var wu = ifr.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
wu.sendMouseEvent("mousemove", 10, 10, 0, 0, 0);
wu.sendMouseEvent("mousemove", 12, 12, 0, 0, 0);
wu.sendMouseEvent("mousemove", 14, 14, 0, 0, 0);
wu.sendMouseEvent("mousedown", 16, 16, 0, 1, 0);
wu.sendMouseEvent("mouseup", 16, 16, 0, 1, 0);
var win = ifr.contentWindow;
// After the click, the load event should be fired.
ifr.addEventListener('load', function() {
testDone();
}, false);
// synthesizeMouse adds getBoundingClientRect left and top to the offsets but
// in that particular case, we don't want that.
var rect = ifr.getBoundingClientRect();
var left = rect.left;
var top = rect.top;
synthesizeMouse(ifr, 10 - left, 10 - top, { type: "mousemove" }, win);
synthesizeMouse(ifr, 12 - left, 12 - top, { type: "mousemove" }, win);
synthesizeMouse(ifr, 14 - left, 14 - top, { type: "mousemove" }, win);
synthesizeMouse(ifr, 16 - left, 16 - top, { }, win);
}
function testDone() {
var ifr = document.getElementById("testFrame");
var url = new String(ifr.contentWindow.location);
is(url.indexOf("?10,10"), -1, "Shouldn't have ?10,10 in the URL!");
is(url.indexOf("?12,12"), -1, "Shouldn't have ?12,12 in the URL!");
is(url.indexOf("?14,14"), -1, "Shouldn't have ?14,14 in the URL!");
@ -49,8 +53,10 @@ function testDone() {
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(beginTest);
</script>
</pre>
<iframe id="testFrame" src="bug514856_iframe.html"></iframe>
</body>
</html>