Bug 805330 - Cleanup and attempt to avoid intermittent orange from bug 751809. r=josh

This commit is contained in:
Georg Fritzsche 2012-10-29 18:27:32 +01:00
Родитель e3eb98c915
Коммит 9438446ca5
1 изменённых файлов: 16 добавлений и 23 удалений

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

@ -2,11 +2,16 @@
<head> <head>
<title>Bug 751809</title> <title>Bug 751809</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript">
SpecialPowers.setBoolPref("plugins.click_to_play", true);
</script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head> </head>
<body> <body onload="go();">
<embed id="plugin" type="application/x-test" width="400" height="400" drawmode="solid" color="FF00FFFF"></embed>
<script type="application/javascript"> <script type="application/javascript">
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
@ -31,15 +36,7 @@
var moveOn = function() { clearInterval(interval); nextTest(); }; var moveOn = function() { clearInterval(interval); nextTest(); };
} }
function startFocusTest() { function go() {
var plugin = document.getElementById('plugin');
ok(plugin, "Got plugin element.");
var condition = function() plugin.getBoundingClientRect().width == 400;
waitForCondition(condition, afterPluginInsertion, "Waited too long for plugin to show up in page");
}
function afterPluginInsertion() {
var plugin = document.getElementById('plugin'); var plugin = document.getElementById('plugin');
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "plugin should not be activated"); ok(!objLoadingContent.activated, "plugin should not be activated");
@ -51,7 +48,7 @@
var plugin = document.getElementById('plugin'); var plugin = document.getElementById('plugin');
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent); var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
synthesizeMouseAtCenter(plugin, {}, window); synthesizeMouseAtCenter(plugin, {});
var condition = function() objLoadingContent.activated; var condition = function() objLoadingContent.activated;
waitForCondition(condition, afterPluginActivation, "Waited too long for plugin to activate"); waitForCondition(condition, afterPluginActivation, "Waited too long for plugin to activate");
} }
@ -66,7 +63,7 @@
ok(false, "plugin.getMouseUpEventCount() shouldn't throw"); ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
} }
synthesizeMouseAtCenter(plugin, {}, window); synthesizeMouseAtCenter(plugin, {});
var condition = function() plugin.getMouseUpEventCount() > 0; var condition = function() plugin.getMouseUpEventCount() > 0;
waitForCondition(condition, afterFirstClick, "Waited too long for plugin to receive the mouse click"); waitForCondition(condition, afterFirstClick, "Waited too long for plugin to receive the mouse click");
} }
@ -83,10 +80,6 @@
SimpleTest.finish(); SimpleTest.finish();
} }
SpecialPowers.setBoolPref("plugins.click_to_play", true);
document.write('<embed id="plugin" type="application/x-test" width="400" height="400" drawmode="solid" color="FF00FFFF"></embed>');
SimpleTest.executeSoon(startFocusTest);
</script> </script>
</body> </body>
</html> </html>