Bug 805330 - Cleanup and attempt to avoid intermittent orange from bug 751809. r=josh
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Mon, 29 Oct 2012 18:27:32 +0100
changeset 113019 2e0eb299471ceac645d5f54fffb8e565566acd45
parent 113018 b5978f028cf5fc7a97a21dd8c081b0b3b8e8c019
child 113020 79b202f6671e0b47396604981aeda6c2f2b5d95f
push id23847
push userphilringnalda@gmail.com
push dateTue, 13 Nov 2012 05:07:25 +0000
treeherdermozilla-central@1b0226622e94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs805330, 751809
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 805330 - Cleanup and attempt to avoid intermittent orange from bug 751809. r=josh
dom/plugins/test/mochitest/test_bug751809.html
--- a/dom/plugins/test/mochitest/test_bug751809.html
+++ b/dom/plugins/test/mochitest/test_bug751809.html
@@ -1,19 +1,24 @@
 <html>
 <head>
   <title>Bug 751809</title>
   <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"/>
 </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">
-  
+
   SimpleTest.waitForExplicitFinish();
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
   const Ci = Components.interfaces;
   const utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
                                     getInterface(Ci.nsIDOMWindowUtils);
 
   function waitForCondition(condition, nextTest, errorMsg) {
@@ -25,68 +30,56 @@
       }
       if (condition()) {
         moveOn();
       }
       tries++;
     }, 100);
     var moveOn = function() { clearInterval(interval); nextTest(); };
   }
-    
-  function startFocusTest() {
-    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() {
+
+  function go() {
     var plugin = document.getElementById('plugin');
     var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(!objLoadingContent.activated, "plugin should not be activated");
     
     SimpleTest.waitForFocus(afterWindowFocus);
   }
-    
+
   function afterWindowFocus() {
     var plugin = document.getElementById('plugin');
     var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    
-    synthesizeMouseAtCenter(plugin, {}, window);
+
+    synthesizeMouseAtCenter(plugin, {});
     var condition = function() objLoadingContent.activated;
     waitForCondition(condition, afterPluginActivation, "Waited too long for plugin to activate");
   }
     
-  function afterPluginActivation() { 
+  function afterPluginActivation() {
     var plugin = document.getElementById('plugin');
     var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(objLoadingContent.activated, "plugin should be activated now");
     try {
       is(plugin.getMouseUpEventCount(), 0, "Plugin should not have received mouse events yet.");
     } catch(e) {
       ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
     }
 
-    synthesizeMouseAtCenter(plugin, {}, window);
+    synthesizeMouseAtCenter(plugin, {});
     var condition = function() plugin.getMouseUpEventCount() > 0;
     waitForCondition(condition, afterFirstClick, "Waited too long for plugin to receive the mouse click");
   }
-  
+
   function afterFirstClick() {
     var plugin = document.getElementById('plugin');
     try {
       is(plugin.getMouseUpEventCount(), 1, "Plugin should have received 1 mouse up event.");
     } catch(e) {
       ok(false, "plugin.getMouseUpEventCount() shouldn't throw");
     }
 
     SpecialPowers.clearUserPref("plugins.click_to_play");
     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>
 </body>
 </html>