2009-08-20 Eric Carlson <eric.carlson@apple.com>
[WebKit-https.git] / LayoutTests / media / progress-event-at-least-one.html
index 3d864de..f76cd94 100644 (file)
@@ -9,16 +9,17 @@
             function progress()
             {
                 // 'progress' events can fire an arbitrary number of times if the
             function progress()
             {
                 // 'progress' events can fire an arbitrary number of times if the
-                // file loads slowly, we only want to ensure that AT LEAST one is
-                // fired so only log the first one so test results are consistent.
+                // file loads slowly, and the order of the first event in relation
+                // to the other events is not guaranteed, and we only want to ensure
+                // that AT LEAST one is fired so just count the number of events instead
+                // of logging them.
                 if (++progressEventCount > 1)
                     return;
                 if (++progressEventCount > 1)
                     return;
-                consoleWrite("EVENT(progress)");
             }
 
             }
 
-            function loaded()
+            function loadend()
             {
             {
-                consoleWrite("EVENT(load)");
+                consoleWrite("EVENT(loadend)");
                 
                 testExpected('progressEventCount', 1, '>=');
                 endTest();
                 
                 testExpected('progressEventCount', 1, '>=');
                 endTest();
             {
                 run("mediaElement = document.createElement('audio')");
 
             {
                 run("mediaElement = document.createElement('audio')");
 
-                mediaElement.setAttribute('onload', "loaded()");
+                mediaElement.setAttribute('onloadend', "loadend()");
                 mediaElement.setAttribute('onprogress', "progress()");
 
                 waitForEvent("loadstart");
                 mediaElement.setAttribute('onprogress', "progress()");
 
                 waitForEvent("loadstart");
+                waitForEvent("loadend");
+                waitForEvent("loaded");
                 waitForEvent("waiting");
                 waitForEvent("ratechange");
                 waitForEvent("durationchange");
                 waitForEvent("waiting");
                 waitForEvent("ratechange");
                 waitForEvent("durationchange");