Bug 626245. Part 2: Fix test_convertpoint to poll until the plugin is in the right place. r=matspal
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 08 Oct 2012 17:46:52 +1300
changeset 110319 c4da85db655437a37af15da1d5fa498c40efc27b
parent 110318 70c50c331112e6b2f9d03cb933d4d6c2c15b2545
child 110320 9a5b9cc9b42c30a6b4e9e48a5a03c7800b364678
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersmatspal
bugs626245
milestone19.0a1
Bug 626245. Part 2: Fix test_convertpoint to poll until the plugin is in the right place. r=matspal
dom/plugins/test/mochitest/test_convertpoint.xul
--- a/dom/plugins/test/mochitest/test_convertpoint.xul
+++ b/dom/plugins/test/mochitest/test_convertpoint.xul
@@ -12,16 +12,23 @@
 <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
 </body>
 <script class="testbody" type="application/javascript">
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
 function runTests() {
   var pluginElement = document.getElementById("plugin1");
+  // Poll to see if the plugin is in the right place yet.
+  // Check if x-coordinate 0 in plugin space is 0 in window space. If it is,
+  // the plugin hasn't been placed yet.
+  if (pluginElement.convertPointX(1, 0, 0, 2) == 0) {
+    setTimeout(runTests, 0);
+    return;
+  }
 
   netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 
   var domWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                              .getInterface(Components.interfaces.nsIDOMWindowUtils);
   var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
 
   var pluginRect = pluginElement.getBoundingClientRect();