Bug 947753 - Make test_drawWindow_widget_layers.html wait for the opened window to be visible. r=dbaron
authorMarkus Stange <mstange@themasta.com>
Thu, 30 Apr 2015 23:06:35 -0400
changeset 273447 9321d83d7d8f8456653ad42327ba28f1d07d5c94
parent 273446 18631c5f81116c28c1037cdae0576fdc8b936484
child 273448 d278129865283291c7c992677477597dbeba5c28
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs947753
milestone40.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 947753 - Make test_drawWindow_widget_layers.html wait for the opened window to be visible. r=dbaron Without this change, the test would fail because OMTC windows on OS X refuse to composite until they're visible.
dom/canvas/test/chrome/test_drawWindow_widget_layers.html
dom/canvas/test/file_drawWindow_common.js
--- a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html
+++ b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html
@@ -14,28 +14,32 @@
 
   var sourceWindow;
 
   function openSourceWindow(event) {
     if (event.target != document) {
       return;
     }
 
+    // Add a little bottom padding to the window so that we don't capture the
+    // rounded corners at the bottom, which our GL drawing code on OS X draws
+    // for regular windows.
+    // (The reftest framework doesn't have this problem because it doesn't use
+    // a regular window with a titlebar, so there are no rounded corners.)
+    const WINDOW_INNER_WIDTH = CANVAS_WIDTH;
+    const WINDOW_INNER_HEIGHT = CANVAS_HEIGHT + 10;
+
     // Need to open as a toplevel chrome window so that
     // DRAWWINDOW_USE_WIDGET_LAYERS is honored.
     sourceWindow = window.open("file_drawWindow_source.html", "",
-                               "chrome,width=200,height=100");
-    sourceWindow.addEventListener("load", runTests, false);
+                               `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`);
+    SimpleTest.waitForFocus(runTests, sourceWindow);
   }
 
-  function runTests(event) {
-    if (event.target != sourceWindow.document) {
-      return;
-    }
-
+  function runTests() {
     var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D);
     var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS |
                 cxInterfaceWrap.DRAWWINDOW_DRAW_CARET |
                 cxInterfaceWrap.DRAWWINDOW_DRAW_VIEW;
     runDrawWindowTests(sourceWindow, flags, true);
 
     sourceWindow.close();
 
--- a/dom/canvas/test/file_drawWindow_common.js
+++ b/dom/canvas/test/file_drawWindow_common.js
@@ -1,11 +1,12 @@
+const CANVAS_WIDTH = 200;
+const CANVAS_HEIGHT = 100;
+
 function runDrawWindowTests(win, drawWindowFlags, transparentBackground) {
-  const CANVAS_WIDTH = 200;
-  const CANVAS_HEIGHT = 100;
 
   function make_canvas() {
     var canvas = document.createElement("canvas");
     canvas.setAttribute("height", CANVAS_HEIGHT);
     canvas.setAttribute("width", CANVAS_WIDTH);
     document.body.appendChild(canvas);
     return canvas;
   }