2011-02-15  Philippe Normand  <pnormand@igalia.com>

        Reviewed by Martin Robinson.

        [GTK] media/controls-without-preload.html is flacky on 32-bits Debug
        https://bugs.webkit.org/show_bug.cgi?id=50518

        Refactored 2 media tests to avoid use of setTimeout and possible
        flakyness.

        * media/controls-without-preload.html:
        * media/video-display-toggle.html:
        * platform/gtk/Skipped:
        * platform/gtk/media/controls-without-preload-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/media/video-display-toggle.html b/LayoutTests/media/video-display-toggle.html
index d71d93f..e219e5a 100644
--- a/LayoutTests/media/video-display-toggle.html
+++ b/LayoutTests/media/video-display-toggle.html
@@ -5,9 +5,11 @@
             function toggleDisplay()
             {
                 var video = document.getElementById('vid');
-                if (video.style.display == "none")
+                if (video.style.display == "none") {
                     video.style.display = "inline-block";
-                else
+                    if (window.layoutTestController)
+                        layoutTestController.notifyDone();
+                } else
                     video.style.display = "none";
                 document.body.offsetLeft;
             }
@@ -22,9 +24,6 @@
             {
                 toggleDisplay();
                 toggleDisplay();
-
-                if (window.layoutTestController)
-                    setTimeout(function() { layoutTestController.notifyDone(); }, 100);
             }
         </script>
     </head>