2009-03-03 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2009 01:06:50 +0000 (01:06 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Mar 2009 01:06:50 +0000 (01:06 +0000)
        Reviewed by Simon Fraser.

        https://bugs.webkit.org/show_bug.cgi?id=24294
        Bug 24294: Improve media layout test logging

        Make all media layout tests log the condition that is being tested,
        success or failure, plus observed value when a test condition fails
        so it is possible to see exactly what failed without having to hack
        the test source. Consolidate some of the logic in the shared JavaScript file.

        * media/audio-constructor-expected.txt:
        * media/audio-constructor-src-expected.txt:
        * media/audio-constructor-src.html:
        * media/audio-constructor.html:
        * media/audio-mpeg-supported-expected.txt:
        * media/audio-mpeg-supported.html:
        * media/broken-video-expected.txt:
        * media/broken-video.html:
        * media/constructors-expected.txt:
        * media/constructors.html:
        * media/loopend-limits-expected.txt:
        * media/loopstart-limits-expected.txt:
        * media/progress-event-expected.txt:
        * media/progress-event-total-expected.txt:
        * media/progress-event-total.html:
        * media/progress-event.html:
        * media/remove-from-document-expected.txt:
        * media/remove-from-document-no-load-expected.txt:
        * media/remove-from-document-no-load.html:
        * media/remove-from-document.html:
        * media/unsupported-rtsp-expected.txt:
        * media/unsupported-rtsp.html:
        * media/unsupported-tracks-expected.txt:
        * media/unsupported-tracks.html:
        * media/video-append-source-expected.txt:
        * media/video-append-source.html:
        * media/video-autoplay-expected.txt:
        * media/video-autoplay.html:
        * media/video-buffered-expected.txt:
        * media/video-buffered.html:
        * media/video-controls-expected.txt:
        * media/video-controls-transformed-expected.txt:
        * media/video-controls-transformed.html:
        * media/video-controls.html:
        * media/video-currentTime-expected.txt:
        * media/video-currentTime-set.html:
        * media/video-currentTime-set2-expected.txt:
        * media/video-currentTime-set2.html:
        * media/video-currentTime.html:
        * media/video-dom-autoplay-expected.txt:
        * media/video-dom-autoplay.html:
        * media/video-dom-end-expected.txt:
        * media/video-dom-end.html:
        * media/video-dom-loopcount-expected.txt:
        * media/video-dom-loopcount.html:
        * media/video-dom-loopend-expected.txt:
        * media/video-dom-loopend.html:
        * media/video-dom-loopstart-expected.txt:
        * media/video-dom-loopstart.html:
        * media/video-dom-src-expected.txt:
        * media/video-dom-src.html:
        * media/video-dom-start-expected.txt:
        * media/video-dom-start.html:
        * media/video-end-expected.txt:
        * media/video-end.html:
        * media/video-error-abort-expected.txt:
        * media/video-error-abort.html:
        * media/video-error-does-not-exist-expected.txt:
        * media/video-error-does-not-exist.html:
        * media/video-load-networkState-expected.txt:
        * media/video-load-networkState.html:
        * media/video-load-readyState-expected.txt:
        * media/video-load-readyState.html:
        * media/video-loopcount-expected.txt:
        * media/video-loopcount.html:
        * media/video-loopend-expected.txt:
        * media/video-loopend.html:
        * media/video-loopstart-expected.txt:
        * media/video-loopstart.html:
        * media/video-muted-expected.txt:
        * media/video-muted.html:
        * media/video-no-autoplay-expected.txt:
        * media/video-no-autoplay.html:
        * media/video-pause-empty-events-expected.txt:
        * media/video-pause-empty-events.html:
        * media/video-play-empty-events-expected.txt:
        * media/video-play-empty-events.html:
        * media/video-play-pause-events-expected.txt:
        * media/video-play-pause-events.html:
        * media/video-poster-expected.txt:
        * media/video-poster.html:
        * media/video-seek-past-end-paused-expected.txt:
        * media/video-seek-past-end-paused.html:
        * media/video-seek-past-end-playing-expected.txt:
        * media/video-seek-past-end-playing.html:
        * media/video-seekable-expected.txt:
        * media/video-seekable.html:
        * media/video-seeking-expected.txt:
        * media/video-seeking.html:
        * media/video-size-expected.txt:
        * media/video-size.html:
        * media/video-source-expected.txt:
        * media/video-source-media-expected.txt:
        * media/video-source-media.html:
        * media/video-source-type-expected.txt:
        * media/video-source-type-params-expected.txt:
        * media/video-source-type-params.html:
        * media/video-source-type.html:
        * media/video-source.html:
        * media/video-src-change-expected.txt:
        * media/video-src-change.html:
        * media/video-src-expected.txt:
        * media/video-src-remove-expected.txt:
        * media/video-src-remove.html:
        * media/video-src-set-expected.txt:
        * media/video-src-set.html:
        * media/video-src-source-expected.txt:
        * media/video-src-source.html:
        * media/video-src.html:
        * media/video-start-expected.txt:
        * media/video-start.html:
        * media/video-test.js:
        (test):
        (testExpected):
        (waitForEvent._eventCallback):
        (waitForEvent):
        (waitForEventAndTest._eventCallback):
        (waitForEventAndTest):
        (testException):
        (logResult):
        * media/video-volume-expected.txt:
        * media/video-volume.html:
        * media/video-width-height-expected.txt:
        * media/video-width-height.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

117 files changed:
LayoutTests/ChangeLog
LayoutTests/media/audio-constructor-expected.txt
LayoutTests/media/audio-constructor-src-expected.txt
LayoutTests/media/audio-constructor-src.html
LayoutTests/media/audio-constructor.html
LayoutTests/media/audio-mpeg-supported-expected.txt
LayoutTests/media/audio-mpeg-supported.html
LayoutTests/media/broken-video-expected.txt
LayoutTests/media/broken-video.html
LayoutTests/media/constructors-expected.txt
LayoutTests/media/constructors.html
LayoutTests/media/loopend-limits-expected.txt
LayoutTests/media/loopstart-limits-expected.txt
LayoutTests/media/progress-event-expected.txt
LayoutTests/media/progress-event-total-expected.txt
LayoutTests/media/progress-event-total.html
LayoutTests/media/progress-event.html
LayoutTests/media/remove-from-document-expected.txt
LayoutTests/media/remove-from-document-no-load-expected.txt
LayoutTests/media/remove-from-document-no-load.html
LayoutTests/media/remove-from-document.html
LayoutTests/media/unsupported-rtsp-expected.txt
LayoutTests/media/unsupported-rtsp.html
LayoutTests/media/unsupported-tracks-expected.txt
LayoutTests/media/unsupported-tracks.html
LayoutTests/media/video-append-source-expected.txt
LayoutTests/media/video-append-source.html
LayoutTests/media/video-autoplay-expected.txt
LayoutTests/media/video-autoplay.html
LayoutTests/media/video-buffered-expected.txt
LayoutTests/media/video-buffered.html
LayoutTests/media/video-controls-expected.txt
LayoutTests/media/video-controls-transformed-expected.txt
LayoutTests/media/video-controls-transformed.html
LayoutTests/media/video-controls.html
LayoutTests/media/video-currentTime-expected.txt
LayoutTests/media/video-currentTime-set.html
LayoutTests/media/video-currentTime-set2-expected.txt
LayoutTests/media/video-currentTime-set2.html
LayoutTests/media/video-currentTime.html
LayoutTests/media/video-dom-autoplay-expected.txt
LayoutTests/media/video-dom-autoplay.html
LayoutTests/media/video-dom-end-expected.txt
LayoutTests/media/video-dom-end.html
LayoutTests/media/video-dom-loopcount-expected.txt
LayoutTests/media/video-dom-loopcount.html
LayoutTests/media/video-dom-loopend-expected.txt
LayoutTests/media/video-dom-loopend.html
LayoutTests/media/video-dom-loopstart-expected.txt
LayoutTests/media/video-dom-loopstart.html
LayoutTests/media/video-dom-src-expected.txt
LayoutTests/media/video-dom-src.html
LayoutTests/media/video-dom-start-expected.txt
LayoutTests/media/video-dom-start.html
LayoutTests/media/video-end-expected.txt
LayoutTests/media/video-end.html
LayoutTests/media/video-error-abort-expected.txt
LayoutTests/media/video-error-abort.html
LayoutTests/media/video-error-does-not-exist-expected.txt
LayoutTests/media/video-error-does-not-exist.html
LayoutTests/media/video-load-networkState-expected.txt
LayoutTests/media/video-load-networkState.html
LayoutTests/media/video-load-readyState-expected.txt
LayoutTests/media/video-load-readyState.html
LayoutTests/media/video-loopcount-expected.txt
LayoutTests/media/video-loopcount.html
LayoutTests/media/video-loopend-expected.txt
LayoutTests/media/video-loopend.html
LayoutTests/media/video-loopstart-expected.txt
LayoutTests/media/video-loopstart.html
LayoutTests/media/video-muted-expected.txt
LayoutTests/media/video-muted.html
LayoutTests/media/video-no-autoplay-expected.txt
LayoutTests/media/video-no-autoplay.html
LayoutTests/media/video-pause-empty-events-expected.txt
LayoutTests/media/video-pause-empty-events.html
LayoutTests/media/video-play-empty-events-expected.txt
LayoutTests/media/video-play-empty-events.html
LayoutTests/media/video-play-pause-events-expected.txt
LayoutTests/media/video-play-pause-events.html
LayoutTests/media/video-poster-expected.txt
LayoutTests/media/video-poster.html
LayoutTests/media/video-seek-past-end-paused-expected.txt
LayoutTests/media/video-seek-past-end-paused.html
LayoutTests/media/video-seek-past-end-playing-expected.txt
LayoutTests/media/video-seek-past-end-playing.html
LayoutTests/media/video-seekable-expected.txt
LayoutTests/media/video-seekable.html
LayoutTests/media/video-seeking-expected.txt
LayoutTests/media/video-seeking.html
LayoutTests/media/video-size-expected.txt
LayoutTests/media/video-size.html
LayoutTests/media/video-source-expected.txt
LayoutTests/media/video-source-media-expected.txt
LayoutTests/media/video-source-media.html
LayoutTests/media/video-source-type-expected.txt
LayoutTests/media/video-source-type-params-expected.txt
LayoutTests/media/video-source-type-params.html
LayoutTests/media/video-source-type.html
LayoutTests/media/video-source.html
LayoutTests/media/video-src-change-expected.txt
LayoutTests/media/video-src-change.html
LayoutTests/media/video-src-expected.txt
LayoutTests/media/video-src-remove-expected.txt
LayoutTests/media/video-src-remove.html
LayoutTests/media/video-src-set-expected.txt
LayoutTests/media/video-src-set.html
LayoutTests/media/video-src-source-expected.txt
LayoutTests/media/video-src-source.html
LayoutTests/media/video-src.html
LayoutTests/media/video-start-expected.txt
LayoutTests/media/video-start.html
LayoutTests/media/video-test.js
LayoutTests/media/video-volume-expected.txt
LayoutTests/media/video-volume.html
LayoutTests/media/video-width-height-expected.txt
LayoutTests/media/video-width-height.html

index 3ce7d4e..6b9c415 100644 (file)
@@ -1,3 +1,140 @@
+2009-03-03  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Simon Fraser.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=24294
+        Bug 24294: Improve media layout test logging
+        
+        Make all media layout tests log the condition that is being tested,
+        success or failure, plus observed value when a test condition fails
+        so it is possible to see exactly what failed without having to hack
+        the test source. Consolidate some of the logic in the shared JavaScript file.
+
+        * media/audio-constructor-expected.txt:
+        * media/audio-constructor-src-expected.txt:
+        * media/audio-constructor-src.html:
+        * media/audio-constructor.html:
+        * media/audio-mpeg-supported-expected.txt:
+        * media/audio-mpeg-supported.html:
+        * media/broken-video-expected.txt:
+        * media/broken-video.html:
+        * media/constructors-expected.txt:
+        * media/constructors.html:
+        * media/loopend-limits-expected.txt:
+        * media/loopstart-limits-expected.txt:
+        * media/progress-event-expected.txt:
+        * media/progress-event-total-expected.txt:
+        * media/progress-event-total.html:
+        * media/progress-event.html:
+        * media/remove-from-document-expected.txt:
+        * media/remove-from-document-no-load-expected.txt:
+        * media/remove-from-document-no-load.html:
+        * media/remove-from-document.html:
+        * media/unsupported-rtsp-expected.txt:
+        * media/unsupported-rtsp.html:
+        * media/unsupported-tracks-expected.txt:
+        * media/unsupported-tracks.html:
+        * media/video-append-source-expected.txt:
+        * media/video-append-source.html:
+        * media/video-autoplay-expected.txt:
+        * media/video-autoplay.html:
+        * media/video-buffered-expected.txt:
+        * media/video-buffered.html:
+        * media/video-controls-expected.txt:
+        * media/video-controls-transformed-expected.txt:
+        * media/video-controls-transformed.html:
+        * media/video-controls.html:
+        * media/video-currentTime-expected.txt:
+        * media/video-currentTime-set.html:
+        * media/video-currentTime-set2-expected.txt:
+        * media/video-currentTime-set2.html:
+        * media/video-currentTime.html:
+        * media/video-dom-autoplay-expected.txt:
+        * media/video-dom-autoplay.html:
+        * media/video-dom-end-expected.txt:
+        * media/video-dom-end.html:
+        * media/video-dom-loopcount-expected.txt:
+        * media/video-dom-loopcount.html:
+        * media/video-dom-loopend-expected.txt:
+        * media/video-dom-loopend.html:
+        * media/video-dom-loopstart-expected.txt:
+        * media/video-dom-loopstart.html:
+        * media/video-dom-src-expected.txt:
+        * media/video-dom-src.html:
+        * media/video-dom-start-expected.txt:
+        * media/video-dom-start.html:
+        * media/video-end-expected.txt:
+        * media/video-end.html:
+        * media/video-error-abort-expected.txt:
+        * media/video-error-abort.html:
+        * media/video-error-does-not-exist-expected.txt:
+        * media/video-error-does-not-exist.html:
+        * media/video-load-networkState-expected.txt:
+        * media/video-load-networkState.html:
+        * media/video-load-readyState-expected.txt:
+        * media/video-load-readyState.html:
+        * media/video-loopcount-expected.txt:
+        * media/video-loopcount.html:
+        * media/video-loopend-expected.txt:
+        * media/video-loopend.html:
+        * media/video-loopstart-expected.txt:
+        * media/video-loopstart.html:
+        * media/video-muted-expected.txt:
+        * media/video-muted.html:
+        * media/video-no-autoplay-expected.txt:
+        * media/video-no-autoplay.html:
+        * media/video-pause-empty-events-expected.txt:
+        * media/video-pause-empty-events.html:
+        * media/video-play-empty-events-expected.txt:
+        * media/video-play-empty-events.html:
+        * media/video-play-pause-events-expected.txt:
+        * media/video-play-pause-events.html:
+        * media/video-poster-expected.txt:
+        * media/video-poster.html:
+        * media/video-seek-past-end-paused-expected.txt:
+        * media/video-seek-past-end-paused.html:
+        * media/video-seek-past-end-playing-expected.txt:
+        * media/video-seek-past-end-playing.html:
+        * media/video-seekable-expected.txt:
+        * media/video-seekable.html:
+        * media/video-seeking-expected.txt:
+        * media/video-seeking.html:
+        * media/video-size-expected.txt:
+        * media/video-size.html:
+        * media/video-source-expected.txt:
+        * media/video-source-media-expected.txt:
+        * media/video-source-media.html:
+        * media/video-source-type-expected.txt:
+        * media/video-source-type-params-expected.txt:
+        * media/video-source-type-params.html:
+        * media/video-source-type.html:
+        * media/video-source.html:
+        * media/video-src-change-expected.txt:
+        * media/video-src-change.html:
+        * media/video-src-expected.txt:
+        * media/video-src-remove-expected.txt:
+        * media/video-src-remove.html:
+        * media/video-src-set-expected.txt:
+        * media/video-src-set.html:
+        * media/video-src-source-expected.txt:
+        * media/video-src-source.html:
+        * media/video-src.html:
+        * media/video-start-expected.txt:
+        * media/video-start.html:
+        * media/video-test.js:
+        (test):
+        (testExpected):
+        (waitForEvent._eventCallback):
+        (waitForEvent):
+        (waitForEventAndTest._eventCallback):
+        (waitForEventAndTest):
+        (testException):
+        (logResult):
+        * media/video-volume-expected.txt:
+        * media/video-volume.html:
+        * media/video-width-height-expected.txt:
+        * media/video-width-height.html:
+
 2009-03-03  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Oliver Hunt.
index 2edf733..1656c57 100644 (file)
@@ -1,8 +1,9 @@
 Test that Audio() object loads the resource after src attribute is set and load() is called.
 
-TEST(audio instanceof HTMLAudioElement) OK
+EXPECTED (audio instanceof HTMLAudioElement == 'true') OK
 RUN(audio.load())
-EVENT(loadstart) TEST(relativeURL(audio.currentSrc)=='content/test.wav') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(audio.currentSrc) == 'content/test.wav') OK
 EVENT(load)
 END OF TEST
 
index 06d8d53..cbf074f 100644 (file)
@@ -1,7 +1,8 @@
 Test that Audio("url") constructor loads the specified resource.
 
-TEST(audio instanceof HTMLAudioElement) OK
-EVENT(loadstart) TEST(relativeURL(audio.currentSrc)=='content/test.wav') OK
+EXPECTED (audio instanceof HTMLAudioElement == 'true') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(audio.currentSrc) == 'content/test.wav') OK
 EVENT(load)
 END OF TEST
 
index cbb5770..c76cbfd 100644 (file)
@@ -2,9 +2,12 @@
 <p>Test that Audio("url") constructor loads the specified resource.</p>
 <script src=video-test.js></script>
 <script>
-var audio = new Audio("content/test.wav");
-media = audio;
-test("audio instanceof HTMLAudioElement");
-waitForEventAndTest("loadstart", "relativeURL(audio.currentSrc)=='content/test.wav'");
-waitForEventAndEnd("load");
+    var audio = new Audio("content/test.wav");
+    media = audio;
+
+    testExpected("audio instanceof HTMLAudioElement", true);
+
+    waitForEvent("loadstart", function () { testExpected("relativeURL(audio.currentSrc)", "content/test.wav"); });
+
+    waitForEventAndEnd("load");
 </script>
index 67fc9cb..d1f929c 100644 (file)
@@ -1,12 +1,18 @@
 <body>
 <p>Test that Audio() object loads the resource after src attribute is set and load() is called.</p>
+
 <script src=video-test.js></script>
+
 <script>
-var audio = new Audio();
-media = audio;
-test("audio instanceof HTMLAudioElement");
-waitForEventAndTest("loadstart", "relativeURL(audio.currentSrc)=='content/test.wav'");
-waitForEventAndEnd("load");
-audio.src = "content/test.wav";
-run("audio.load()");
+    var audio = new Audio();
+    media = audio;
+
+    testExpected("audio instanceof HTMLAudioElement", true);
+
+    waitForEvent("loadstart", function () { testExpected("relativeURL(audio.currentSrc)", "content/test.wav"); });
+
+    waitForEventAndEnd("load");
+
+    audio.src = "content/test.wav";
+    run("audio.load()");
 </script>
index 691d159..6beab41 100644 (file)
@@ -1,8 +1,8 @@
 Test that the audio element supports MPEG files.
 
 EVENT(load)
-expected media.currentTime=='0', observed '0' - OK
+EXPECTED (media.currentTime == '0') OK
 EVENT(play)
-TEST(media.currentTime > 0) OK
+EXPECTED (media.currentTime > '0') OK
 END OF TEST
 
index 731aff5..d88fae0 100644 (file)
@@ -23,7 +23,7 @@
 
         function testCurrentTime() 
         {
-            test("media.currentTime > 0")
+            testExpected("media.currentTime", 0, '>');
             endTest();
         }
     
index 4715f66..0726370 100644 (file)
@@ -1,6 +1,6 @@
 Test that QuickTime file with broken content generates an error.
 
 EVENT(error)
-TEST(video.error) OK
+EXPECTED (video.error == '[object MediaError]') OK
 END OF TEST
 
index aa83375..4ee9a56 100644 (file)
@@ -1,10 +1,11 @@
 <video controls></video>
 <p>Test that QuickTime file with broken content generates an error.<p>
 <script src=video-test.js></script>
+
 <script>
-video.src = "content/garbage.mp4";
-waitForEvent("error", function () {
-    test("video.error");
-    endTest();
-});
+    video.src = "content/garbage.mp4";
+    waitForEvent("error", function () {
+        testExpected("video.error", "[object MediaError]");
+        endTest();
+    });
 </script>
index a0c3011..b97480b 100644 (file)
@@ -1,13 +1,13 @@
 Test that media constructors behave consistently.
 
-TEST(audioJS instanceof HTMLAudioElement) OK
-TEST(audioJS instanceof HTMLMediaElement) OK
-TEST(!(audioJS instanceof HTMLVideoElement)) OK
-TEST(audioElem instanceof HTMLAudioElement) OK
-TEST(audioElem instanceof HTMLMediaElement) OK
-TEST(!(audioElem instanceof HTMLVideoElement)) OK
-TEST(videoElem instanceof HTMLVideoElement) OK
-TEST(videoElem instanceof HTMLMediaElement) OK
-TEST(!(videoElem instanceof HTMLAudioElement)) OK
+EXPECTED (audioJS instanceof HTMLAudioElement == 'true') OK
+EXPECTED (audioJS instanceof HTMLMediaElement == 'true') OK
+EXPECTED (audioJS instanceof HTMLVideoElement == 'false') OK
+EXPECTED (audioElem instanceof HTMLAudioElement == 'true') OK
+EXPECTED (audioElem instanceof HTMLMediaElement == 'true') OK
+EXPECTED (audioElem instanceof HTMLVideoElement == 'false') OK
+EXPECTED (videoElem instanceof HTMLVideoElement == 'true') OK
+EXPECTED (videoElem instanceof HTMLMediaElement == 'true') OK
+EXPECTED (videoElem instanceof HTMLAudioElement == 'false') OK
 END OF TEST
 
index 4508107..61125ee 100644 (file)
@@ -4,17 +4,17 @@
 <audio></audio>
 <script src=video-test.js></script>
 <script>
-var audioJS = new Audio();
-var videoElem = document.getElementsByTagName('video')[0];
-var audioElem = document.getElementsByTagName('audio')[0];
-test("audioJS instanceof HTMLAudioElement");
-test("audioJS instanceof HTMLMediaElement");
-test("!(audioJS instanceof HTMLVideoElement)");
-test("audioElem instanceof HTMLAudioElement");
-test("audioElem instanceof HTMLMediaElement");
-test("!(audioElem instanceof HTMLVideoElement)");
-test("videoElem instanceof HTMLVideoElement");
-test("videoElem instanceof HTMLMediaElement");
-test("!(videoElem instanceof HTMLAudioElement)");
-endTest();
+    var audioJS = new Audio();
+    var videoElem = document.getElementsByTagName('video')[0];
+    var audioElem = document.getElementsByTagName('audio')[0];
+    testExpected("audioJS instanceof HTMLAudioElement", true);
+    testExpected("audioJS instanceof HTMLMediaElement", true);
+    testExpected("audioJS instanceof HTMLVideoElement", false);
+    testExpected("audioElem instanceof HTMLAudioElement", true);
+    testExpected("audioElem instanceof HTMLMediaElement", true);
+    testExpected("audioElem instanceof HTMLVideoElement", false);
+    testExpected("videoElem instanceof HTMLVideoElement", true);
+    testExpected("videoElem instanceof HTMLMediaElement", true);
+    testExpected("videoElem instanceof HTMLAudioElement", false);
+    endTest();
 </script>
index 2cbb1ae..786e0eb 100644 (file)
@@ -2,23 +2,23 @@
 Test loopend attribute parsing, limits, and defaults.
 
 <video loopend=1.5> - loopend specified, should not change
-expected video.loopEnd=='1.5', observed '1.5' - OK
-expected audio.loopEnd=='1.5', observed '1.5' - OK
+EXPECTED (video.loopEnd == '1.5') OK
+EXPECTED (audio.loopEnd == '1.5') OK
 
 <video end=1.0> - loopend not specified, should return end attr
-expected video.loopEnd=='1', observed '1' - OK
-expected audio.loopEnd=='1', observed '1' - OK
+EXPECTED (video.loopEnd == '1') OK
+EXPECTED (audio.loopEnd == '1') OK
 
 <video > - no loopend and no end, default should be infinity (end default)
-expected video.loopEnd=='Infinity', observed 'Infinity' - OK
-expected audio.loopEnd=='Infinity', observed 'Infinity' - OK
+EXPECTED (video.loopEnd == 'Infinity') OK
+EXPECTED (audio.loopEnd == 'Infinity') OK
 
 <video loopend='s1.0'> - bogus loopend and no end, default should be infinity (end default)
-expected video.loopEnd=='Infinity', observed 'Infinity' - OK
-expected audio.loopEnd=='Infinity', observed 'Infinity' - OK
+EXPECTED (video.loopEnd == 'Infinity') OK
+EXPECTED (audio.loopEnd == 'Infinity') OK
 
 <video loopend='s1.0' end=1.0> - bogus loopend, default should be end attr
-expected video.loopEnd=='1', observed '1' - OK
-expected audio.loopEnd=='1', observed '1' - OK
+EXPECTED (video.loopEnd == '1') OK
+EXPECTED (audio.loopEnd == '1') OK
 END OF TEST
 
index 8150390..3251e1c 100644 (file)
@@ -2,23 +2,23 @@
 Test loopstart attribute parsing, limits, and defaults.
 
 <video loopstart=1.5> - loopstart specified, should not change
-expected video.loopStart=='1.5', observed '1.5' - OK
-expected audio.loopStart=='1.5', observed '1.5' - OK
+EXPECTED (video.loopStart == '1.5') OK
+EXPECTED (audio.loopStart == '1.5') OK
 
 <video start=1.0> - loopstart not specified, should return start attr
-expected video.loopStart=='1', observed '1' - OK
-expected audio.loopStart=='1', observed '1' - OK
+EXPECTED (video.loopStart == '1') OK
+EXPECTED (audio.loopStart == '1') OK
 
 <video> - no loopstart and no start, default should be 0
-expected video.loopStart=='0', observed '0' - OK
-expected audio.loopStart=='0', observed '0' - OK
+EXPECTED (video.loopStart == '0') OK
+EXPECTED (audio.loopStart == '0') OK
 
 <video loopstart='s1.0'> - bogus loopstart and no start, default should be 0 (start default)
-expected video.loopStart=='0', observed '0' - OK
-expected audio.loopStart=='0', observed '0' - OK
+EXPECTED (video.loopStart == '0') OK
+EXPECTED (audio.loopStart == '0') OK
 
 <video loopstart='s1.0' start=1.0> - bogus loopstart, default should be start attr
-expected video.loopStart=='1', observed '1' - OK
-expected audio.loopStart=='1', observed '1' - OK
+EXPECTED (video.loopStart == '1') OK
+EXPECTED (audio.loopStart == '1') OK
 END OF TEST
 
index 19f278d..eda87f4 100644 (file)
@@ -1,4 +1,10 @@
-EVENT(loadstart) TEST(!event.lengthComputable && event.loaded==0 && event.total==0) OK
-EVENT(load) TEST(event.lengthComputable && event.loaded>0 && event.total>0) OK
+EVENT(loadstart)
+EXPECTED (!event.lengthComputable == 'true') OK
+EXPECTED (event.total == '0') OK
+EXPECTED (event.loaded == '0') OK
+EVENT(load)
+EXPECTED (event.lengthComputable == 'true') OK
+EXPECTED (event.loaded > '0') OK
+EXPECTED (event.total > '0') OK
 END OF TEST
 
index 5cb8188..a07fff9 100644 (file)
@@ -1,4 +1,10 @@
-EVENT(loadstart) TEST(!event.lengthComputable && event.loaded==0 && event.total==0) OK
-EVENT(load) TEST(event.lengthComputable && event.loaded>0 && event.total==239528) OK
+EVENT(loadstart)
+EXPECTED (!event.lengthComputable == 'true') OK
+EXPECTED (event.total == '0') OK
+EXPECTED (event.loaded == '0') OK
+EVENT(load)
+EXPECTED (event.lengthComputable == 'true') OK
+EXPECTED (event.loaded > '0') OK
+EXPECTED (event.total == '239528') OK
 END OF TEST
 
index 6c84127..91b369d 100644 (file)
@@ -1,7 +1,29 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-waitForEventAndTest("loadstart", "!event.lengthComputable && event.loaded==0 && event.total==0");
-waitForEventTestAndEnd("load", "event.lengthComputable && event.loaded>0 && event.total==239528");
-video.src = "content/test.mp4";
+    var event;
+
+    function testOnLoadStart(evt)
+    {
+        event = evt;
+
+        testExpected("!event.lengthComputable", true);
+        testExpected("event.total", 0);
+        testExpected("event.loaded", 0);
+    }
+
+    function testOnLoad(evt)
+    {
+        event = evt;
+
+        testExpected("event.lengthComputable", true);
+        testExpected("event.loaded", 0, '>');
+        testExpected("event.total", 239528);
+        endTest();
+    }
+
+    waitForEvent("loadstart", testOnLoadStart);
+    waitForEvent("load", testOnLoad, true);
+
+    video.src = "content/test.mp4";
 </script>
index ec064db..1215e0d 100644 (file)
@@ -1,7 +1,30 @@
 <video controls></video>
 <script src=video-test.js></script>
+
 <script>
-waitForEventAndTest("loadstart", "!event.lengthComputable && event.loaded==0 && event.total==0");
-waitForEventTestAndEnd("load", "event.lengthComputable && event.loaded>0 && event.total>0");
-video.src = "content/test.mp4";
+    var event;
+
+    function testOnLoadStart(evt)
+    {
+        event = evt;
+
+        testExpected("!event.lengthComputable", true);
+        testExpected("event.total", 0);
+        testExpected("event.loaded", 0);
+    }
+
+    function testOnLoad(evt)
+    {
+        event = evt;
+
+        testExpected("event.lengthComputable", true);
+        testExpected("event.loaded", 0, '>');
+        testExpected("event.total", 0, '>');
+        endTest();
+    }
+
+    waitForEvent("loadstart", testOnLoadStart);
+    waitForEvent("load", testOnLoad, true);
+
+    video.src = "content/test.mp4";
 </script>
index fb9c61e..52e51f0 100644 (file)
@@ -1,10 +1,10 @@
 Test that removing a media element from the tree pauses playback but does not unload the media.
 
 EVENT(load)
-TEST(video.networkState == HTMLMediaElement.LOADED) OK
-TEST(!video.paused) OK
+EXPECTED (video.networkState == '4') OK
+EXPECTED (video.paused == 'false') OK
 RUN(document.body.removeChild(video))
-TEST(video.networkState == HTMLMediaElement.LOADED) OK
-TEST(video.paused) OK
+EXPECTED (video.networkState == '4') OK
+EXPECTED (video.paused == 'true') OK
 END OF TEST
 
index cfac103..098adb3 100644 (file)
@@ -1,7 +1,7 @@
 Test that removing a media element from the tree when no media has been loaded does not generate a load event.
 
-TEST(video.networkState == HTMLMediaElement.EMPTY) OK
+EXPECTED (video.networkState == '0') OK
 RUN(document.body.removeChild(video))
-TEST(didReceiveLoadStartEvent == false;) OK
+EXPECTED (didReceiveLoadStartEvent == 'false') OK
 END OF TEST
 
index 3f8462f..0061207 100644 (file)
@@ -2,11 +2,11 @@
 <p>Test that removing a media element from the tree when no media has been loaded does not generate a load event.</p>
 <script src=video-test.js></script>
 <script>
-didReceiveLoadStartEvent = false;
-video.addEventListener('loadstart', function() { didReceiveLoadStartEvent = true; });
-video.src = "content/test.mp4";
-test("video.networkState == HTMLMediaElement.EMPTY");
-run("document.body.removeChild(video)");
-test("didReceiveLoadStartEvent == false;");
-endTest();
+    didReceiveLoadStartEvent = false;
+    video.addEventListener('loadstart', function() { didReceiveLoadStartEvent = true; });
+    video.src = "content/test.mp4";
+    testExpected("video.networkState", HTMLMediaElement.EMPTY);
+    run("document.body.removeChild(video)");
+    testExpected("didReceiveLoadStartEvent", false);
+    endTest();
 </script>
index e2d7751..0dd5c07 100644 (file)
@@ -2,15 +2,20 @@
 <p>Test that removing a media element from the tree pauses playback but does not unload the media.</p>
 <script src=video-test.js></script>
 <script>
-waitForEvent('load', function () {
-    test("video.networkState == HTMLMediaElement.LOADED");
-    test("!video.paused");
-    run("document.body.removeChild(video)");
-    test("video.networkState == HTMLMediaElement.LOADED");
-    test("video.paused");
-    document.body.offsetTop;
-    endTest();
-} );
+    waitForEvent('load', function () {
+
+        testExpected("video.networkState", HTMLMediaElement.LOADED);
+        testExpected("video.paused", false);
+
+        run("document.body.removeChild(video)");
+
+        testExpected("video.networkState", HTMLMediaElement.LOADED);
+        testExpected("video.paused", true);
+
+        document.body.offsetTop;
+        endTest();
+    } );
+
 video.src = "content/test.mp4";
 video.play();
 </script>
index 3c1b2b8..11ea473 100644 (file)
@@ -1,7 +1,7 @@
 Test that QuickTime file with RTSP URL generates a load error.
 
 EVENT(error)
-TEST(video.error) OK
-TEST(video.error.code = MediaError.MEDIA_ERR_NETWORK) OK
+EXPECTED (video.error != 'null') OK
+EXPECTED (video.error.code == '2') OK
 END OF TEST
 
index 51d3f8d..386c708 100644 (file)
@@ -4,8 +4,8 @@
 <script>
 video.src = "rtsp://a2047.v1411b.c1411.g.vq.akamaistream.net/5/2047/1411/2_h264_650/1a1a1ae454c430950065de4cbb2f94c226950c7ae655b61a48a91475e243acda3dac194879adde0f/wwdc_2006_2_650.mov";
 waitForEvent("error", function () {
-    test("video.error");
-    test("video.error.code = MediaError.MEDIA_ERR_NETWORK");
+    testExpected("video.error", null, "!=");
+    testExpected("video.error.code", MediaError.MEDIA_ERR_NETWORK);
     endTest();
 });
 </script>
index f5a18be..6743529 100644 (file)
@@ -1,6 +1,6 @@
 Test that QuickTime file with unsupported track types only generates an error.
 
 EVENT(error)
-TEST(video.error) OK
+EXPECTED (video.error != 'null') OK
 END OF TEST
 
index 0e4ee5c..bd9f1dc 100644 (file)
@@ -4,7 +4,7 @@
 <script>
 video.src = "content/unsupported_track.mp4";
 waitForEvent("error", function () {
-    test("video.error");
+    testExpected("video.error", null, "!=");
     endTest();
 });
 </script>
index 39ab3fa..e7203a3 100644 (file)
@@ -1,5 +1,6 @@
-TEST(video.currentSrc=='') OK
-TEST(video.currentSrc=='') OK
-EVENT(load) TEST(relativeURL(video.currentSrc)=='content/test.mp4') OK
+EXPECTED (video.currentSrc == '') OK
+EXPECTED (video.currentSrc == '') OK
+EVENT(load)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index 56eedfe..5018274 100644 (file)
@@ -1,10 +1,17 @@
 <video controls></video>
 <script src=video-test.js></script>
+
 <script>
-test("video.currentSrc==''");
-var source = document.createElement("source");
-source.setAttribute("src", "content/test.mp4");
-video.appendChild(source);
-test("video.currentSrc==''");
-waitForEventTestAndEnd("load", "relativeURL(video.currentSrc)=='content/test.mp4'");
+    testExpected("video.currentSrc", "");
+    var source = document.createElement("source");
+    source.setAttribute("src", "content/test.mp4");
+    video.appendChild(source);
+
+    testExpected("video.currentSrc", "");
+
+    waitForEvent("load", function () {
+        testExpected("relativeURL(video.currentSrc) ", "content/test.mp4");
+        endTest();
+    });
+
 </script>
index 022df61..df408ec 100644 (file)
@@ -1,5 +1,6 @@
-TEST(video.autoplay) OK
-TEST(video.getAttribute('autoplay') != null) OK
-EVENT(play) TEST(!video.paused) OK
+EXPECTED (video.autoplay == 'true') OK
+EXPECTED (video.getAttribute('autoplay') != 'null') OK
+EVENT(play)
+EXPECTED (video.paused == 'false') OK
 END OF TEST
 
index fd63b45..04d2200 100644 (file)
@@ -1,8 +1,9 @@
 <video autoplay controls></video>
 <script src=video-test.js></script>
+
 <script>
-test("video.autoplay");
-test("video.getAttribute('autoplay') != null");
-waitForEventTestAndEnd('play', "!video.paused");
-video.src = "content/test.mp4";
+    testExpected("video.autoplay", true);
+    testExpected("video.getAttribute('autoplay')", null, '!=');
+    waitForEvent('play', function () { testExpected("video.paused", false); endTest(); } );
+    video.src = "content/test.mp4";
 </script>
index 7fe4dae..69ced3b 100644 (file)
@@ -1,12 +1,12 @@
-TEST(video.buffered.length == 0) OK
+EXPECTED (video.buffered.length == '0') OK
 TEST(video.buffered.start(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.buffered.end(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.buffered.start(0)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.buffered.end(0)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 EVENT(load)
-TEST(video.buffered.length == 1) OK
-TEST(video.buffered.start(0) == 0) OK
-TEST(video.buffered.end(0) > 0) OK
+EXPECTED (video.buffered.length == '1') OK
+EXPECTED (video.buffered.start(0) == '0') OK
+EXPECTED (video.buffered.end(0) > '0') OK
 TEST(video.buffered.start(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.buffered.end(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.buffered.start(1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
index c00f519..ca8d0aa 100644 (file)
@@ -1,23 +1,23 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.buffered.length == 0");
-testException("video.buffered.start(-1)", "DOMException.INDEX_SIZE_ERR");
-testException("video.buffered.end(-1)", "DOMException.INDEX_SIZE_ERR");
-testException("video.buffered.start(0)", "DOMException.INDEX_SIZE_ERR");
-testException("video.buffered.end(0)", "DOMException.INDEX_SIZE_ERR");
-waitForEvent('load', 
-    function () 
-    {
-        test("video.buffered.length == 1");
-        test("video.buffered.start(0) == 0");
-        test("video.buffered.end(0) > 0");
-        testException("video.buffered.start(-1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.buffered.end(-1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.buffered.start(1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.buffered.end(1)", "DOMException.INDEX_SIZE_ERR");
-        endTest();
-    }
-);
-video.src = "content/test.mp4";
+    testExpected("video.buffered.length", 0);
+    testException("video.buffered.start(-1)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.buffered.end(-1)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.buffered.start(0)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.buffered.end(0)", "DOMException.INDEX_SIZE_ERR");
+    waitForEvent('load', 
+        function () 
+        {
+            testExpected("video.buffered.length", 1);
+            testExpected("video.buffered.start(0)", 0);
+            testExpected("video.buffered.end(0)", 0, '>');
+            testException("video.buffered.start(-1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.buffered.end(-1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.buffered.start(1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.buffered.end(1)", "DOMException.INDEX_SIZE_ERR");
+            endTest();
+        }
+    );
+    video.src = "content/test.mp4";
 </script>
index bcc37ea..6849b48 100644 (file)
@@ -1,15 +1,15 @@
 Test 'controls' attribute
 
-TEST(video.controls) OK
+EXPECTED (video.controls != 'null') OK
 EVENT(load)
-TEST(video.controls) OK
+EXPECTED (video.controls != 'null') OK
 RUN(video.removeAttribute('controls'))
-TEST(!video.controls) OK
+EXPECTED (video.controls == 'false') OK
 RUN(video.controls = true)
-TEST(video.getAttribute('controls') == 'controls') OK
+EXPECTED (video.getAttribute('controls') == 'controls') OK
 RUN(video.controls = false)
-TEST(!video.getAttribute('controls')) OK
+EXPECTED (video.controls == 'false') OK
 RUN(video.setAttribute('controls','controls'))
-TEST(video.controls) OK
+EXPECTED (video.controls != 'null') OK
 END OF TEST
 
index ea0e794..804db7e 100644 (file)
@@ -2,8 +2,8 @@ Test controls on transformed video.
 
 This test only runs in DRT!
 
-TEST(video.controls) OK
+EXPECTED (video.controls != 'null') OK
 EVENT(load)
-TEST(!video.paused) OK
+EXPECTED (video.paused == 'false') OK
 END OF TEST
 
index cb79b47..a3441e8 100644 (file)
@@ -9,22 +9,25 @@
   </style>
 </head>
 <body>
-  <video controls></video>
-<p>Test controls on transformed video.</p>
-<p>This test only runs in DRT!</p>
-<script src=video-test.js></script>
-<script>
-test("video.controls");
-waitForEvent('load', function () {
-  if (window.eventSender) {
-     eventSender.mouseMoveTo(54,240); // over play button
-     eventSender.mouseDown();
-     eventSender.mouseUp();
-  }
-  test("!video.paused");
-  endTest();
-} );
-video.src = 'content/test.mp4';
-</script>
+    <video controls></video>
+    <p>Test controls on transformed video.</p>
+    <p>This test only runs in DRT!</p>
+    <script src=video-test.js></script>
+    <script>
+        testExpected("video.controls", null, '!=');
+        waitForEvent('load', function () {
+            if (window.eventSender) 
+            {
+                eventSender.mouseMoveTo(54,240); // over play button
+                eventSender.mouseDown();
+                eventSender.mouseUp();
+            }
+            testExpected("video.paused", false);
+            endTest();
+        } );
+        video.src = 'content/test.mp4';
+    </script>
 </body>
 </html>
+
+
index 216932f..87a1583 100644 (file)
@@ -2,23 +2,23 @@
 <p>Test 'controls' attribute<p>
 <script src=video-test.js></script>
 <script>
-test("video.controls");
-waitForEvent('load', function () {
-    document.body.offsetTop;
-    test("video.controls");
-    run("video.removeAttribute('controls')");
-    document.body.offsetTop;
-    test("!video.controls");
-    run("video.controls = true");
-    document.body.offsetTop;
-    test("video.getAttribute('controls') == 'controls'");
-    run("video.controls = false");
-    document.body.offsetTop;
-    test("!video.getAttribute('controls')");
-    run("video.setAttribute('controls','controls')");
-    document.body.offsetTop;
-    test("video.controls");
-    endTest();
-} );
-video.src = 'content/test.mp4';
+    testExpected("video.controls", null, '!=');
+    waitForEvent('load', function () {
+        document.body.offsetTop;
+        testExpected("video.controls", null, '!=');
+        run("video.removeAttribute('controls')");
+        document.body.offsetTop;
+        testExpected("video.controls", false, '==');
+        run("video.controls = true");
+        document.body.offsetTop;
+        testExpected("video.getAttribute('controls')", "controls");
+        run("video.controls = false");
+        document.body.offsetTop;
+        testExpected("video.controls", false, '==');
+        run("video.setAttribute('controls','controls')");
+        document.body.offsetTop;
+        testExpected("video.controls", null, '!=');
+        endTest();
+    } );
+    video.src = 'content/test.mp4';
 </script>
index 91ceef6..ed08ae1 100644 (file)
@@ -1,6 +1,7 @@
-TEST(video.currentTime == 0) OK
-EVENT(load) TEST(video.currentTime == 0) OK
+EXPECTED (video.currentTime == '0') OK
+EVENT(load)
+EXPECTED (video.currentTime == '0') OK
 EVENT(play)
-TEST(video.currentTime > 0) OK
+EXPECTED (video.currentTime > '0') OK
 END OF TEST
 
index a70e05a..637779d 100644 (file)
@@ -5,9 +5,9 @@ waitForEvent('load',
 function () { 
     video.currentTime = video.duration - 0.2; 
     video.play(); 
-    waitForEvent('timeupdate',
-    function () {
-        setTimeout(function () { test("false") }, 800);
+    waitForEvent('timeupdate', function () {
+        var timeout = 800;
+        setTimeout(function () { logResult("No timeupdate event in " + timeout/1000  + "seconds", false); }, timeout);
     });
     waitForEventAndEnd('ended');
 });
index 5c542b1..0962a75 100644 (file)
@@ -1,5 +1,5 @@
 EVENT(load)
-TEST(video.currentTime.toFixed(1) == 1.5) OK
-TEST(video.currentTime.toFixed(1) == 3.1) OK
+EXPECTED (video.currentTime.toFixed(1) == '1.5') OK
+EXPECTED (video.currentTime.toFixed(1) == '3.1') OK
 END OF TEST
 
index e093e22..0a10fff 100644 (file)
@@ -1,14 +1,14 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-waitForEvent('load',  
-function () { 
-    video.currentTime = 1.5; 
-    test("video.currentTime.toFixed(1) == 1.5");
-    video.play();
-    video.currentTime = 3.1; 
-    test("video.currentTime.toFixed(1) == 3.1");
-    endTest();
-});
-video.src = "content/test.mp4";
+    waitForEvent('load',  
+    function () { 
+        video.currentTime = 1.5; 
+        testExpected("video.currentTime.toFixed(1)", 1.5);
+        video.play();
+        video.currentTime = 3.1; 
+        testExpected("video.currentTime.toFixed(1)", 3.1);
+        endTest();
+    });
+    video.src = "content/test.mp4";
 </script>
index 10ed0c9..ae3a339 100644 (file)
@@ -1,14 +1,14 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.currentTime == 0")
-waitForEventAndTest('load', "video.currentTime == 0");
-video.addEventListener('load', function() { video.play(); setTimeout(testCurrentTime, 500) });
-waitForEvent('play');
-function testCurrentTime()
-{
-    test("video.currentTime > 0")
-    endTest();
-}
-video.src = "content/test.mp4";
+    testExpected("video.currentTime", 0)
+    waitForEvent('load', function() { testExpected("video.currentTime", 0); } );
+    video.addEventListener('load', function() { video.play(); setTimeout(testCurrentTime, 500) });
+    waitForEvent('play');
+    function testCurrentTime()
+    {
+        testExpected("video.currentTime", 0, '>')
+        endTest();
+    }
+    video.src = "content/test.mp4";
 </script>
index e07854a..c1a8979 100644 (file)
@@ -1,6 +1,7 @@
-TEST(!video.autoplay) OK
-TEST(video.autoplay) OK
-TEST(video.getAttribute('autoplay') != null) OK
-EVENT(play) TEST(!video.paused) OK
+EXPECTED (video.autoplay == 'false') OK
+EXPECTED (video.autoplay == 'true') OK
+EXPECTED (video.getAttribute('autoplay') != 'null') OK
+EVENT(play)
+EXPECTED (video.paused == 'false') OK
 END OF TEST
 
index 5dbd1ad..d0523c9 100644 (file)
@@ -1,10 +1,14 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("!video.autoplay");
-video.autoplay = true;
-test("video.autoplay");
-test("video.getAttribute('autoplay') != null");
-waitForEventTestAndEnd('play', "!video.paused");
-video.src = "content/test.mp4";
+    testExpected("video.autoplay", false);
+    video.autoplay = true;
+    testExpected("video.autoplay", true);
+    testExpected("video.getAttribute('autoplay')", null, "!=");
+    waitForEvent('play', function () { 
+        testExpected("video.paused", false);
+        endTest();
+    } );
+
+    video.src = "content/test.mp4";
 </script>
index 110a410..07f4019 100644 (file)
@@ -1,5 +1,6 @@
-TEST(video.end == 0.5) OK
-TEST(video.getAttribute('end') == '0.5s') OK
-EVENT(ended) TEST(video.currentTime == 0.5) OK
+EXPECTED (video.end == '0.5') OK
+EXPECTED (video.getAttribute('end') == '0.5s') OK
+EVENT(ended)
+EXPECTED (video.currentTime == '0.5') OK
 END OF TEST
 
index d659bff..76663a9 100644 (file)
@@ -1,8 +1,12 @@
 <video autoplay src=content/test.mp4 controls></video>
 <script src=video-test.js></script>
 <script>
-video.end = 0.5;
-test("video.end == 0.5");
-test("video.getAttribute('end') == '0.5s'");
-waitForEventTestAndEnd('ended', "video.currentTime == 0.5");
+    video.end = 0.5;
+    testExpected("video.end", 0.5);
+    testExpected("video.getAttribute('end')", "0.5s");
+
+    waitForEvent('ended', function () { 
+        testExpected("video.currentTime", 0.5);
+        endTest();
+    } );
 </script>
index efa7ed9..954da4d 100644 (file)
@@ -1,9 +1,10 @@
 Test that playcount DOM attribute causes playback to end after right number of repeats.
 
-TEST(video.playCount == 3) OK
-TEST(video.currentLoop == 0) OK
-TEST(video.getAttribute('playCount') == 3) OK
+EXPECTED (video.playCount == '3') OK
+EXPECTED (video.currentLoop == '0') OK
+EXPECTED (video.getAttribute('playCount') == '3') OK
 RUN(video.play())
-EVENT(ended) TEST(video.currentLoop == 2) OK
+EVENT(ended)
+EXPECTED (video.currentLoop == '2') OK
 END OF TEST
 
index 87e8fd3..1a0b59f 100644 (file)
@@ -2,10 +2,15 @@
 <p>Test that playcount DOM attribute causes playback to end after right number of repeats.</p>
 <script src=video-test.js></script>
 <script>
-video.playCount = 3;
-test("video.playCount == 3");
-test("video.currentLoop == 0");
-test("video.getAttribute('playCount') == 3");
-waitForEventTestAndEnd('ended', "video.currentLoop == 2");
-run("video.play()");
+    video.playCount = 3;
+    testExpected("video.playCount", 3);
+    testExpected("video.currentLoop", 0);
+    testExpected("video.getAttribute('playCount')", 3);
+
+    waitForEvent('ended', function () { 
+        testExpected("video.currentLoop", 2);
+        endTest();
+    } );
+
+    run("video.play()");
 </script>
index 5de01c5..a0a166e 100644 (file)
@@ -1,11 +1,11 @@
 Test that video loops when time reaches the value specified by the loopEnd DOM attribute.
 
-TEST(video.loopEnd==0.5) OK
-TEST(video.getAttribute('loopend') == '0.5s') OK
+EXPECTED (video.loopEnd == '0.5') OK
+EXPECTED (video.getAttribute('loopend') == '0.5s') OK
 RUN(video.play())
 EVENT(timeupdate)
 EVENT(timeupdate)
-TEST(video.currentLoop == 1) OK
-TEST(video.currentTime.toFixed(1) == 0) OK
+EXPECTED (video.currentLoop == '1') OK
+EXPECTED (video.currentTime.toFixed(1) == '0') OK
 END OF TEST
 
index 81ffbdb..d44b0c8 100644 (file)
@@ -2,16 +2,18 @@
 <p>Test that video loops when time reaches the value specified by the loopEnd DOM attribute.</p>
 <script src=video-test.js></script>
 <script>
-video.loopEnd=0.5;
-test("video.loopEnd==0.5");
-test("video.getAttribute('loopend') == '0.5s'");
-setTimeout(function () { test("video.currentTime<=0.5"); }, 2000);
-waitForEvent('timeupdate', function () {
-    if (video.currentLoop == 1) {
-        test("video.currentLoop == 1");
-        test("video.currentTime.toFixed(1) == 0");
-        endTest();
-    }
-});
-run("video.play()");
+    video.loopEnd=0.5;
+    testExpected("video.loopEnd", 0.5);
+    testExpected("video.getAttribute('loopend')", "0.5s");
+
+    setTimeout(function () { testExpected("video.currentTime", 0.5, "<="); }, 2000);
+
+    waitForEvent('timeupdate', function () {
+        if (video.currentLoop == 1) {
+            testExpected("video.currentLoop", 1);
+            testExpected("video.currentTime.toFixed(1)", 0);
+            endTest();
+        }
+    });
+    run("video.play()");
 </script>
index f78354a..1be513d 100644 (file)
@@ -1,13 +1,13 @@
 Test that playing video rewinds to time specified by the loopStart DOM attribute when it loops.
 
-TEST(video.loopStart==1.0) OK
-TEST(video.getAttribute('loopstart') == '1s') OK
+EXPECTED (video.loopStart == '1') OK
+EXPECTED (video.getAttribute('loopstart') == '1s') OK
 RUN(video.play())
 EVENT(load)
 EVENT(timeupdate)
 EVENT(timeupdate)
 EVENT(timeupdate)
-TEST(video.currentLoop == 1) OK
-TEST(video.currentTime.toFixed(1) == 1.0) OK
+EXPECTED (video.currentLoop == '1') OK
+EXPECTED (video.currentTime.toFixed(1) == '1') OK
 END OF TEST
 
index f57cab4..418d6cc 100644 (file)
@@ -2,20 +2,22 @@
 <p>Test that playing video rewinds to time specified by the loopStart DOM attribute when it loops.</p>
 <script src=video-test.js></script>
 <script>
-video.loopStart = 1.0;
-test("video.loopStart==1.0");
-test("video.getAttribute('loopstart') == '1s'");
-waitForEvent('load', function () {
-    waitForEvent('timeupdate', function () {
-        failTestIn(1000);
-        if (video.currentLoop == 1) {
-            test("video.currentLoop == 1");
-            test("video.currentTime.toFixed(1) == 1.0");
-            endTest();
-        }
+    video.loopStart = 1.0;
+    testExpected("video.loopStart", 1.0);
+    testExpected("video.getAttribute('loopstart') ", '1s');
+
+    waitForEvent('load', function () {
+        waitForEvent('timeupdate', function () {
+            failTestIn(1000);
+            if (video.currentLoop == 1) {
+                testExpected("video.currentLoop", 1);
+                testExpected("video.currentTime.toFixed(1)", 1.0);
+                endTest();
+            }
+        });
+        video.currentTime = video.duration - 0.2;
     });
-    video.currentTime = video.duration - 0.2;
-});
-video.src = "content/test.mp4";
-run("video.play()");
+
+    video.src = "content/test.mp4";
+    run("video.play()");
 </script>
index 39ab3fa..e7203a3 100644 (file)
@@ -1,5 +1,6 @@
-TEST(video.currentSrc=='') OK
-TEST(video.currentSrc=='') OK
-EVENT(load) TEST(relativeURL(video.currentSrc)=='content/test.mp4') OK
+EXPECTED (video.currentSrc == '') OK
+EXPECTED (video.currentSrc == '') OK
+EVENT(load)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index bb35521..6260767 100644 (file)
@@ -1,10 +1,14 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.currentSrc==''");
-video.src = "content/test.mp4";
-test("video.currentSrc==''");
-waitForEventTestAndEnd("load", "relativeURL(video.currentSrc)=='content/test.mp4'");
+    testExpected("video.currentSrc", "");
+    video.src = "content/test.mp4";
+    testExpected("video.currentSrc", "");
 
-video.load();
+    waitForEvent('load', function () { 
+        testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+        endTest();
+    } );
+    
+    video.load();
 </script>
index c6ab6b5..216fa6f 100644 (file)
@@ -1,8 +1,9 @@
 Test that when start DOM attribute is set, playback starts from that time.
 
-TEST(video.start == 1.0) OK
-TEST(video.getAttribute('start') == '1s') OK
+EXPECTED (video.loopStart == '1') OK
+EXPECTED (video.getAttribute('start') == '1s') OK
 RUN(video.load())
-EVENT(canplaythrough) TEST(video.currentTime == 1.0) OK
+EVENT(canplaythrough)
+EXPECTED (video.currentTime == '1') OK
 END OF TEST
 
index 23e58f3..aba8050 100644 (file)
@@ -2,10 +2,14 @@
 <p>Test that when start DOM attribute is set, playback starts from that time.</p>
 <script src=video-test.js></script>
 <script>
-video.start = 1.0;
-test("video.start == 1.0");
-test("video.getAttribute('start') == '1s'");
-waitForEventTestAndEnd('canplaythrough', "video.currentTime == 1.0");
-video.src = "content/test.mp4";
-run("video.load()");
+
+    video.start = 1.0;
+    testExpected("video.loopStart", 1.0);
+
+    testExpected("video.getAttribute('start') ", '1s');
+
+    waitForEvent("canplaythrough", function () { testExpected("video.currentTime", 1.0); endTest(); });
+
+    video.src = "content/test.mp4";
+    run("video.load()");
 </script>
index 6eb4ca2..4676de4 100644 (file)
@@ -1,7 +1,7 @@
-TEST(!video.ended) OK
-TEST(video.end == 0.5) OK
+EXPECTED (video.ended == 'false') OK
+EXPECTED (video.end == '0.5') OK
 EVENT(ended)
-TEST(video.currentTime == 0.5) OK
-TEST(video.ended) OK
+EXPECTED (video.currentTime == '0.5') OK
+EXPECTED (video.ended == 'true') OK
 END OF TEST
 
index b97763d..f0ec5d4 100644 (file)
@@ -1,15 +1,12 @@
 <video src=content/test.mp4 end=0.5s controls></video>
 <script src=video-test.js></script>
 <script>
-test("!video.ended");
-test("video.end == 0.5");
-waitForEvent('ended', 
-    function () 
-    {
-        test("video.currentTime == 0.5");
-        test("video.ended");
+    testExpected("video.ended", false);
+    testExpected("video.end", 0.5);
+    waitForEvent('ended', function () {
+        testExpected("video.currentTime", 0.5);
+        testExpected("video.ended", true);
         endTest();
-    }
-);
-video.play();
+    } );
+    video.play();
 </script>
index f9b3ff7..18d6bc3 100644 (file)
@@ -1,7 +1,9 @@
-TEST(!video.error) OK
+EXPECTED (video.error == 'null') OK
 EVENT(loadstart)
-EVENT(abort) TEST(video.error.code == MediaError.MEDIA_ERR_ABORTED) OK
+EVENT(abort)
+EXPECTED (video.error.code == '1') OK
 EVENT(loadstart)
-EVENT(load) TEST(!video.error) OK
+EVENT(load)
+EXPECTED (video.error == 'null') OK
 END OF TEST
 
index f447b3f..dcf3aec 100644 (file)
@@ -1,10 +1,17 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("!video.error");
-var didLoad = false;
-waitForEvent("loadstart", function () { if (didLoad) return; didLoad = true; video.load(); });
-waitForEventAndTest("abort", "video.error.code == MediaError.MEDIA_ERR_ABORTED");
-waitForEventTestAndEnd("load", "!video.error");
-video.src = "content/test.mp4";
+    testExpected("video.error", null);
+    var didLoad = false;
+
+    waitForEvent("loadstart", function () { if (didLoad) return; didLoad = true; video.load(); });
+
+    waitForEvent("abort", function () { testExpected("video.error.code", MediaError.MEDIA_ERR_ABORTED); } );
+
+    waitForEvent('load', function () { 
+        testExpected("video.error", null);
+        endTest();
+    } );
+
+    video.src = "content/test.mp4";
 </script>
index 5118847..e6f6687 100644 (file)
@@ -1,12 +1,12 @@
 Test that the media element is in correct state after load fails.
 
-TEST(!video.error) OK
+EXPECTED (video.error == 'null') OK
 EVENT(emptied)
-TEST(video.error.code == MediaError.MEDIA_ERR_NETWORK) OK
-TEST(video.duration == 0) OK
-TEST(video.currentTime == 0) OK
-TEST(video.buffered.length == 0) OK
-TEST(video.seekable.length == 0) OK
-TEST(video.buffered.length == 0) OK
+EXPECTED (video.error.code == '2') OK
+EXPECTED (video.duration == '0') OK
+EXPECTED (video.currentTime == '0') OK
+EXPECTED (video.buffered.length == '0') OK
+EXPECTED (video.seekable.length == '0') OK
+EXPECTED (video.buffered.length == '0') OK
 END OF TEST
 
index fabce08..92c3bfa 100644 (file)
@@ -2,15 +2,15 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("!video.error");
+testExpected("video.error", null);
 waitForEventAndTest("load", "false");
 waitForEvent("emptied", function () {
-    test("video.error.code == MediaError.MEDIA_ERR_NETWORK");
-    test("video.duration == 0");
-    test("video.currentTime == 0");
-    test("video.buffered.length == 0");
-    test("video.seekable.length == 0");
-    test("video.buffered.length == 0");
+    testExpected("video.error.code", MediaError.MEDIA_ERR_NETWORK);
+    testExpected("video.duration", 0);
+    testExpected("video.currentTime", 0);
+    testExpected("video.buffered.length", 0);
+    testExpected("video.seekable.length", 0);
+    testExpected("video.buffered.length", 0);
     endTest();
 });
 video.src = "content/does-not-exist.mpeg";
index 577020e..439b1a8 100644 (file)
@@ -1,7 +1,11 @@
-TEST(video.networkState == HTMLMediaElement.EMPTY) OK
-EVENT(loadstart) TEST(video.networkState == HTMLMediaElement.LOADING) OK
-EVENT(loadedmetadata) TEST(video.networkState == HTMLMediaElement.LOADED_METADATA) OK
-EVENT(loadedfirstframe) TEST(video.networkState == HTMLMediaElement.LOADED_FIRST_FRAME) OK
-EVENT(load) TEST(video.networkState == HTMLMediaElement.LOADED) OK
+EXPECTED (video.networkState == '0') OK
+EVENT(loadstart)
+EXPECTED (video.networkState == '1') OK
+EVENT(loadedmetadata)
+EXPECTED (video.networkState == '2') OK
+EVENT(loadedfirstframe)
+EXPECTED (video.networkState == '3') OK
+EVENT(load)
+EXPECTED (video.networkState == '4') OK
 END OF TEST
 
index 387c98d..6a2b5af 100644 (file)
@@ -1,10 +1,17 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.networkState == HTMLMediaElement.EMPTY");
-waitForEventAndTest("loadstart", "video.networkState == HTMLMediaElement.LOADING");
-waitForEventAndTest("loadedmetadata", "video.networkState == HTMLMediaElement.LOADED_METADATA");
-waitForEventAndTest("loadedfirstframe", "video.networkState == HTMLMediaElement.LOADED_FIRST_FRAME");
-waitForEventTestAndEnd("load", "video.networkState == HTMLMediaElement.LOADED");
-video.src = "content/test.mp4";
+    function testNetworkState(expected, endIt)
+    {
+        testExpected("video.networkState", expected);
+        if (endIt)
+            endTest();
+    }
+
+    testExpected("video.networkState", HTMLMediaElement.EMPTY);
+    waitForEvent("loadstart", function () { testNetworkState(HTMLMediaElement.LOADING); } );
+    waitForEvent("loadedmetadata", function () { testNetworkState(HTMLMediaElement.LOADED_METADATA); } );
+    waitForEvent("loadedfirstframe", function () { testNetworkState(HTMLMediaElement.LOADED_FIRST_FRAME); } );
+    waitForEvent("load", function () { testNetworkState(HTMLMediaElement.LOADED, true); } );
+    video.src = "content/test.mp4";
 </script>
index 6370915..f71e5b3 100644 (file)
@@ -1,8 +1,13 @@
-TEST(video.readyState == HTMLMediaElement.DATA_UNAVAILABLE) OK
-EVENT(loadstart) TEST(video.readyState == HTMLMediaElement.DATA_UNAVAILABLE) OK
-EVENT(loadedmetadata) TEST(video.readyState == HTMLMediaElement.DATA_UNAVAILABLE) OK
-EVENT(loadedfirstframe) TEST(video.readyState == HTMLMediaElement.CAN_SHOW_CURRENT_FRAME) OK
-EVENT(canshowcurrentframe) TEST(video.readyState == HTMLMediaElement.CAN_SHOW_CURRENT_FRAME) OK
-EVENT(canplaythrough) TEST(video.readyState == HTMLMediaElement.CAN_PLAY_THROUGH) OK
+EXPECTED (video.readyState == '0') OK
+EVENT(loadstart)
+EXPECTED (video.readyState == '0') OK
+EVENT(loadedmetadata)
+EXPECTED (video.readyState == '0') OK
+EVENT(loadedfirstframe)
+EXPECTED (video.readyState == '1') OK
+EVENT(canshowcurrentframe)
+EXPECTED (video.readyState == '1') OK
+EVENT(canplaythrough)
+EXPECTED (video.readyState == '3') OK
 END OF TEST
 
index 0f5ee32..e6142c2 100644 (file)
@@ -1,11 +1,18 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.readyState == HTMLMediaElement.DATA_UNAVAILABLE");
-waitForEventAndTest("loadstart", "video.readyState == HTMLMediaElement.DATA_UNAVAILABLE");
-waitForEventAndTest("loadedmetadata", "video.readyState == HTMLMediaElement.DATA_UNAVAILABLE");
-waitForEventAndTest("loadedfirstframe", "video.readyState == HTMLMediaElement.CAN_SHOW_CURRENT_FRAME");
-waitForEventAndTest("canshowcurrentframe", "video.readyState == HTMLMediaElement.CAN_SHOW_CURRENT_FRAME");
-waitForEventTestAndEnd("canplaythrough", "video.readyState == HTMLMediaElement.CAN_PLAY_THROUGH");
-video.src = "content/test.mp4";
+    function testReadyState(expected, endIt)
+    {
+        testExpected("video.readyState", expected);
+        if (endIt)
+            endTest();
+    }
+
+    testExpected("video.readyState", HTMLMediaElement.DATA_UNAVAILABLE);
+    waitForEvent("loadstart", function () { testReadyState(HTMLMediaElement.DATA_UNAVAILABLE); } );
+    waitForEvent("loadedmetadata", function () { testReadyState(HTMLMediaElement.DATA_UNAVAILABLE); } );
+    waitForEvent("loadedfirstframe", function () { testReadyState(HTMLMediaElement.CAN_SHOW_CURRENT_FRAME); } );
+    waitForEvent("canshowcurrentframe", function () { testReadyState(HTMLMediaElement.CAN_SHOW_CURRENT_FRAME); } );
+    waitForEvent("canplaythrough", function () { testReadyState(HTMLMediaElement.CAN_PLAY_THROUGH, true); } );
+    video.src = "content/test.mp4";
 </script>
index 2b0e657..eb37dea 100644 (file)
@@ -1,7 +1,8 @@
 Test that playcount attribute causes playback to end after right number of repeats.
 
-TEST(video.playCount == 3) OK
-TEST(video.currentLoop == 0) OK
-EVENT(ended) TEST(video.currentLoop == 2) OK
+EXPECTED (video.playCount == '3') OK
+EXPECTED (video.currentLoop == '0') OK
+EVENT(ended)
+EXPECTED (video.currentLoop == '2') OK
 END OF TEST
 
index 2688f72..0715bf4 100644 (file)
@@ -2,8 +2,13 @@
 <p>Test that playcount attribute causes playback to end after right number of repeats.</p>
 <script src=video-test.js></script>
 <script>
-test("video.playCount == 3");
-test("video.currentLoop == 0");
-waitForEventTestAndEnd('ended', "video.currentLoop == 2");
-video.play();
+    testExpected("video.playCount", 3);
+    testExpected("video.currentLoop", 0);
+
+    waitForEvent('ended', function () { 
+        testExpected("video.currentLoop", 2);
+        endTest();
+    } );
+
+    video.play();
 </script>
index 48437f1..aff175b 100644 (file)
@@ -1,10 +1,10 @@
 Test that video loops when time reaches the value specified by the loopEnd attribute.
 
-TEST(video.loopEnd==0.5) OK
+EXPECTED (video.loopEnd == '0.5') OK
 RUN(video.play())
 EVENT(timeupdate)
 EVENT(timeupdate)
-TEST(video.currentLoop == 1) OK
-TEST(video.currentTime.toFixed(1) == 0) OK
+EXPECTED (video.currentLoop == '1') OK
+EXPECTED (video.currentTime.toFixed(1) == '0') OK
 END OF TEST
 
index 85cdd41..14378ab 100644 (file)
@@ -2,14 +2,14 @@
 <p>Test that video loops when time reaches the value specified by the loopEnd attribute.</p>
 <script src=video-test.js></script>
 <script>
-test("video.loopEnd==0.5");
-setTimeout(function () { test("video.currentTime<=0.5"); }, 2000);
-waitForEvent('timeupdate', function () {
-    if (video.currentLoop == 1) {
-        test("video.currentLoop == 1");
-        test("video.currentTime.toFixed(1) == 0");
-        endTest();
-    }
-});
-run("video.play()");
+    testExpected("video.loopEnd", 0.5);
+    setTimeout(function () { testExpected("video.currentTime", 0.5, "<="); }, 2000);
+    waitForEvent('timeupdate', function () {
+        if (video.currentLoop == 1) {
+            testExpected("video.currentLoop", 1);
+            testExpected("video.currentTime.toFixed(1)", 0);
+            endTest();
+        }
+    });
+    run("video.play()");
 </script>
index fd85493..b8e6b4f 100644 (file)
@@ -1,12 +1,12 @@
 Test that playing video rewinds to time specified by the loopstart attribute when it loops.
 
-TEST(video.loopStart==1.0) OK
+EXPECTED (video.loopStart == '1') OK
 RUN(video.play())
 EVENT(load)
 EVENT(timeupdate)
 EVENT(timeupdate)
 EVENT(timeupdate)
-TEST(video.currentLoop == 1) OK
-TEST(video.currentTime.toFixed(1) == 1.0) OK
+EXPECTED (video.currentLoop == '1') OK
+EXPECTED (video.currentTime.toFixed(1) == '1') OK
 END OF TEST
 
index f750aa1..940b150 100644 (file)
@@ -2,18 +2,24 @@
 <p>Test that playing video rewinds to time specified by the loopstart attribute when it loops.</p>
 <script src=video-test.js></script>
 <script>
-test("video.loopStart==1.0");
-waitForEvent('load', function () {
-    waitForEvent('timeupdate', function () {
-        failTestIn(1000);
-        if (video.currentLoop == 1) {
-            test("video.currentLoop == 1");
-            test("video.currentTime.toFixed(1) == 1.0");
-            endTest();
-        }
+    testExpected("video.loopStart", 1.0);
+
+    waitForEvent('load', function () {
+        waitForEvent('timeupdate', function () {
+            failTestIn(1000);
+            if (video.currentLoop == 1) {
+                testExpected("video.currentLoop", 1);
+
+                testExpected("video.currentTime.toFixed(1)", 1.0);
+
+                endTest();
+            }
+        });
+        video.currentTime = video.duration - 0.2;
     });
-    video.currentTime = video.duration - 0.2;
-});
-video.src = "content/test.mp4";
-run("video.play()");
+
+    video.src = "content/test.mp4";
+
+    run("video.play()");
+
 </script>
index 7c8f6af..4c07883 100644 (file)
@@ -1,12 +1,12 @@
 Test 'muted' attribute
 
-TEST(!video.muted) OK
+EXPECTED (video.muted == 'false') OK
 RUN(video.muted = true)
-TEST(video.muted) OK
+EXPECTED (video.muted == 'true') OK
 RUN(video.load())
 EVENT(load)
-TEST(video.muted) OK
+EXPECTED (video.muted == 'true') OK
 RUN(video.muted = false)
-TEST(!video.muted) OK
+EXPECTED (video.muted == 'false') OK
 END OF TEST
 
index 1a0573c..5136d8f 100644 (file)
@@ -2,15 +2,15 @@
 <p>Test 'muted' attribute<p>
 <script src=video-test.js></script>
 <script>
-test("!video.muted");
-run("video.muted = true");
-test("video.muted");
-video.src = "content/test.mp4";
-run("video.load()");
-waitForEvent("load", function () {
-    test("video.muted");
-    run("video.muted = false");
-    test("!video.muted");
-    endTest();
-});
+    testExpected("video.muted", false);
+    run("video.muted = true");
+    testExpected("video.muted", true);
+    video.src = "content/test.mp4";
+    run("video.load()");
+    waitForEvent("load", function () {
+        testExpected("video.muted", true);
+        run("video.muted = false");
+        testExpected("video.muted", false);
+        endTest();
+    });
 </script>
index 91ff648..005b0c1 100644 (file)
@@ -1,5 +1,7 @@
-TEST(video.paused) OK
+Test that play event does not fire when "src" set with no autoplay attribute.
+
+EXPECTED (video.paused == 'true') OK
 EVENT(load)
-TEST(video.paused) OK
+EXPECTED (video.paused == 'true') OK
 END OF TEST
 
index 05d83db..db8b568 100644 (file)
@@ -1,8 +1,20 @@
 <video controls></video>
+<p>Test that play event does not fire when "src" set with no autoplay attribute.</p>
 <script src=video-test.js></script>
 <script>
-test("video.paused");
-waitForEventAndTest("play", "false");
-waitForEvent("load", function () { setTimeout(testAndEnd('video.paused', 500)) });
-video.src = "content/test.mp4";
+    testExpected("video.paused", true);
+
+    waitForEvent('play', function () { 
+        logResult(false, "PLAY fired");
+        endTest();
+    } );
+
+    function testPaused () 
+    { 
+        testExpected("video.paused", true);
+        endTest();
+    }
+    waitForEvent('load', function () { setTimeout(testPaused, 500);} );
+
+    video.src = "content/test.mp4";
 </script>
index 189b830..1ce9ca5 100644 (file)
@@ -1,6 +1,6 @@
 Test that pause() from EMPTY network state triggers load()
 
-TEST(video.networkState == HTMLMediaElement.EMPTY) OK
+EXPECTED (video.networkState == '0') OK
 RUN(video.pause())
 EVENT(loadstart)
 END OF TEST
index c6743e9..c216283 100644 (file)
@@ -2,9 +2,9 @@
 <p>Test that pause() from EMPTY network state triggers load()</p>
 <script src=video-test.js></script>
 <script>
-video.src = "content/test.mp4";
-test("video.networkState == HTMLMediaElement.EMPTY");
-waitForEventAndEnd('loadstart');
-run("video.pause()");
-consoleWrite("SCRIPT DONE");
+    video.src = "content/test.mp4";
+    testExpected("video.networkState", HTMLMediaElement.EMPTY);
+    waitForEventAndEnd('loadstart');
+    run("video.pause()");
+    consoleWrite("SCRIPT DONE");
 </script>
index eb0cd9b..1ed7886 100644 (file)
@@ -1,9 +1,11 @@
 Test that play() from EMPTY network state triggers load() and async play event.
 
-TEST(video.networkState == HTMLMediaElement.EMPTY) OK
+EXPECTED (video.networkState == '0') OK
 RUN(video.play())
-EVENT(loadstart) TEST(video.paused) OK
+EVENT(loadstart)
+EXPECTED (video.paused == 'true') OK
 SCRIPT DONE
-EVENT(play) TEST(!video.paused) OK
+EVENT(play)
+EXPECTED (video.paused == 'false') OK
 END OF TEST
 
index ac3a405..c826abb 100644 (file)
@@ -2,10 +2,18 @@
 <p>Test that play() from EMPTY network state triggers load() and async play event.</p>
 <script src=video-test.js></script>
 <script>
-video.src = "content/test.mp4";
-test("video.networkState == HTMLMediaElement.EMPTY");
-waitForEventAndTest('loadstart', "video.paused");
-waitForEventTestAndEnd('play', "!video.paused");
-run("video.play()");
-consoleWrite("SCRIPT DONE");
+    video.src = "content/test.mp4";
+    testExpected("video.networkState", HTMLMediaElement.EMPTY);
+
+    waitForEvent('loadstart', function () { 
+        testExpected("video.paused", true);
+    } );
+
+    waitForEvent('play', function () { 
+        testExpected("video.paused", false);
+        endTest();
+    } );
+
+    run("video.play()");
+    consoleWrite("SCRIPT DONE");
 </script>
index 8712aea..0ecc633 100644 (file)
@@ -3,8 +3,11 @@ Test that calling play() and pause() triggers async play, timeupdate and pause e
 RUN(video.play())
 RUN(video.pause())
 SCRIPT DONE
-EVENT(play) TEST(video.paused) OK
-EVENT(timeupdate) TEST(video.paused) OK
-EVENT(pause) TEST(video.paused) OK
+EVENT(play)
+EXPECTED (video.paused == 'true') OK
+EVENT(timeupdate)
+EXPECTED (video.paused == 'true') OK
+EVENT(pause)
+EXPECTED (video.paused == 'true') OK
 END OF TEST
 
index e0051cb..8a51334 100644 (file)
@@ -2,11 +2,13 @@
 <p>Test that calling play() and pause() triggers async play, timeupdate and pause events.</p>
 <script src=video-test.js></script>
 <script>
-video.src = "content/test.mp4";
-waitForEventAndTest('play', "video.paused");
-waitForEventAndTest('timeupdate', "video.paused");
-waitForEventTestAndEnd('pause', "video.paused");
-run("video.play()");
-run("video.pause()");
-consoleWrite("SCRIPT DONE");
+    video.src = "content/test.mp4";
+
+    waitForEvent('play', function () { testExpected("video.paused", true);} );
+    waitForEvent('timeupdate', function () { testExpected("video.paused", true);} );
+    waitForEvent('pause', function () { testExpected("video.paused", true); endTest(); } );
+
+    run("video.play()");
+    run("video.pause()");
+    consoleWrite("SCRIPT DONE");
 </script>
index b5d073b..79011e8 100644 (file)
@@ -1,7 +1,7 @@
 
-TEST(video.getAttribute('poster') == 'content/greenbox.png') OK
-TEST(relativeURL(video.poster) == 'content/greenbox.png') OK
-TEST(video.getAttribute('poster') == 'content/abe.png') OK
-TEST(relativeURL(video.poster) == 'content/abe.png') OK
+EXPECTED (video.getAttribute('poster') == 'content/greenbox.png') OK
+EXPECTED (relativeURL(video.poster) == 'content/greenbox.png') OK
+EXPECTED (video.getAttribute('poster') == 'content/abe.png') OK
+EXPECTED (relativeURL(video.poster) == 'content/abe.png') OK
 END OF TEST
 
index 7b9cb29..fe1e82a 100644 (file)
@@ -1,10 +1,10 @@
 <video poster="content/greenbox.png" controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.getAttribute('poster') == 'content/greenbox.png'");
-test("relativeURL(video.poster) == 'content/greenbox.png'");
-video.setAttribute('poster', 'content/abe.png');
-test("video.getAttribute('poster') == 'content/abe.png'");
-test("relativeURL(video.poster) == 'content/abe.png'");
-endTest();
+    testExpected("video.getAttribute('poster')", "content/greenbox.png");
+    testExpected("relativeURL(video.poster)", "content/greenbox.png");
+    video.setAttribute('poster', 'content/abe.png');
+    testExpected("video.getAttribute('poster')", "content/abe.png");
+    testExpected("relativeURL(video.poster)", "content/abe.png");
+    endTest();
 </script>
index 1c08c43..6dc5cd2 100644 (file)
@@ -4,6 +4,6 @@ RUN(video.load())
 EVENT(load)
 RUN(video.currentTime = 500)
 EVENT(timeupdate)
-TEST(video.currentTime == video.duration) OK
+EXPECTED (video.currentTime == '8.399999618530273') OK
 END OF TEST
 
index 7597139..e1b2e8f 100644 (file)
@@ -2,21 +2,21 @@
 <p>Test that seeking paused video past it's duration time sets currentTime to duration and leaves video paused.</p>
 <script src=video-test.js></script>
 <script>
-waitForEvent('load', function () { 
-    // exact amount of timeupdate events is timing and implementation dependent
-    var first = true;
-    video.addEventListener("timeupdate", function () {
-        if (first) {
-            consoleWrite("EVENT(timeupdate)");
-            test("video.currentTime == video.duration");
-        }
-        else if (video.currentTime != video.duration)
-            test("video.currentTime == video.duration");
-        first = false;
+    waitForEvent('load', function () { 
+        // exact amount of timeupdate events is timing and implementation dependent
+        var first = true;
+        video.addEventListener("timeupdate", function () {
+            if (first) {
+                consoleWrite("EVENT(timeupdate)");
+                testExpected("video.currentTime", video.duration);
+            }
+            else if (video.currentTime != video.duration)
+                testExpected("video.currentTime", video.duration);
+            first = false;
+        });
+        run("video.currentTime = 500");
+        endTestLater();
     });
-    run("video.currentTime = 500");
-    endTestLater();
-});
-video.src = "content/test.mp4";
-run("video.load()");
+    video.src = "content/test.mp4";
+    run("video.load()");
 </script>
index f027746..2a16b7e 100644 (file)
@@ -5,6 +5,6 @@ EVENT(load)
 EVENT(timeupdate)
 EVENT(timeupdate)
 EVENT(timeupdate)
-TEST(video.currentLoop == 1) OK
+EXPECTED (video.currentLoop == '1') OK
 END OF TEST
 
index 13ecd61..972a08b 100644 (file)
@@ -2,16 +2,16 @@
 <p>Test that seeking video with remaining loops past it's end rewinds to the beginning and continues playback.</p>
 <script src=video-test.js></script>
 <script>
-waitForEvent('load', function () { 
-    waitForEvent('timeupdate', function () {
-        failTestIn(1000);
-        if (video.currentLoop == 1) {
-            test("video.currentLoop == 1");
-            endTest();
-        }
+    waitForEvent('load', function () { 
+        waitForEvent('timeupdate', function () {
+            failTestIn(1000);
+            if (video.currentLoop == 1) {
+                testExpected("video.currentLoop", 1);
+                endTest();
+            }
+        });
+        video.currentTime = 500;
     });
-    video.currentTime = 500;
-});
-video.src = "content/test.mp4";
-run("video.play()");
+    video.src = "content/test.mp4";
+    run("video.play()");
 </script>
index d47ada8..a197e75 100644 (file)
@@ -1,12 +1,12 @@
-TEST(video.seekable.length == 0) OK
+EXPECTED (video.seekable.length == '0') OK
 TEST(video.seekable.start(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.seekable.end(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.seekable.start(0)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.seekable.end(0)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 EVENT(load)
-TEST(video.seekable.length == 1) OK
-TEST(video.seekable.start(0) == 0) OK
-TEST(video.seekable.end(0) > 0) OK
+EXPECTED (video.seekable.length == '1') OK
+EXPECTED (video.seekable.start(0) == '0') OK
+EXPECTED (video.seekable.end(0) > '0') OK
 TEST(video.seekable.start(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.seekable.end(-1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.seekable.start(1)) THROWS(DOMException.INDEX_SIZE_ERR) OK
index 10f961a..c3fc8a0 100644 (file)
@@ -1,23 +1,23 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.seekable.length == 0");
-testException("video.seekable.start(-1)", "DOMException.INDEX_SIZE_ERR");
-testException("video.seekable.end(-1)", "DOMException.INDEX_SIZE_ERR");
-testException("video.seekable.start(0)", "DOMException.INDEX_SIZE_ERR");
-testException("video.seekable.end(0)", "DOMException.INDEX_SIZE_ERR");
-waitForEvent('load',
-    function () 
-    {
-        test("video.seekable.length == 1");
-        test("video.seekable.start(0) == 0");
-        test("video.seekable.end(0) > 0");
-        testException("video.seekable.start(-1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.seekable.end(-1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.seekable.start(1)", "DOMException.INDEX_SIZE_ERR");
-        testException("video.seekable.end(1)", "DOMException.INDEX_SIZE_ERR");
-        endTest();
-    }
-);
-video.src = "content/test.mp4";
+    testExpected("video.seekable.length", 0);
+    testException("video.seekable.start(-1)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.seekable.end(-1)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.seekable.start(0)", "DOMException.INDEX_SIZE_ERR");
+    testException("video.seekable.end(0)", "DOMException.INDEX_SIZE_ERR");
+    waitForEvent('load',
+        function () 
+        {
+            testExpected("video.seekable.length", 1);
+            testExpected("video.seekable.start(0)", 0);
+            testExpected("video.seekable.end(0)",  0, ">");
+            testException("video.seekable.start(-1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.seekable.end(-1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.seekable.start(1)", "DOMException.INDEX_SIZE_ERR");
+            testException("video.seekable.end(1)", "DOMException.INDEX_SIZE_ERR");
+            endTest();
+        }
+    );
+    video.src = "content/test.mp4";
 </script>
index a716281..733bb44 100644 (file)
@@ -1,11 +1,11 @@
 Test that seeking attribute is true in timeupdate event after seek and goes back to false when seeking completes
 
 EVENT(load)
-TEST(!video.seeking) OK
+EXPECTED (video.seeking == 'false') OK
 RUN(video.currentTime = 2)
 EVENT(timeupdate)
-TEST(video.seeking) OK
-TEST(video.currentTime == 2) OK
-TEST(!video.seeking) OK
+EXPECTED (video.seeking == 'true') OK
+EXPECTED (video.currentTime == '2') OK
+EXPECTED (video.seeking == 'false') OK
 END OF TEST
 
index b3a2334..5337ef8 100644 (file)
@@ -5,12 +5,13 @@
 waitForEvent('load',
     function () 
     {
-        test("!video.seeking");
+        testExpected("video.seeking", false);
         waitForEvent('timeupdate', function () {
-            test("video.seeking");
-            test("video.currentTime == 2");
+            testExpected("video.seeking", true);
+            testExpected("video.currentTime", 2);
             setTimeout(function () {
-                testAndEnd("!video.seeking");
+                testExpected("video.seeking", false);
+                endTest();
             }, 200);
         });
         run("video.currentTime = 2");
index 25657ce..53ec040 100644 (file)
@@ -1,4 +1,7 @@
-TEST(video.videoWidth == 0 && video.videoHeight == 0) OK
-EVENT(loadedmetadata) TEST(video.videoWidth > 0 && video.videoHeight > 0) OK
+EXPECTED (video.videoWidth == '0') OK
+EXPECTED (video.videoHeight == '0') OK
+EVENT(loadedmetadata)
+EXPECTED (video.videoWidth > '0') OK
+EXPECTED (video.videoHeight > '0') OK
 END OF TEST
 
index 59bfca4..2f56208 100644 (file)
@@ -1,7 +1,14 @@
 <video controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.videoWidth == 0 && video.videoHeight == 0");
-waitForEventTestAndEnd('loadedmetadata', "video.videoWidth > 0 && video.videoHeight > 0");
-video.src = "content/test.mp4";
+    testExpected("video.videoWidth", 0, "==");
+    testExpected("video.videoHeight", 0, "==");
+
+    waitForEvent('loadedmetadata', function () { 
+        testExpected("video.videoWidth", 0, ">");
+        testExpected("video.videoHeight", 0, ">");
+        endTest();
+    } );
+
+    video.src = "content/test.mp4";
 </script>
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index fb10529..9d37c15 100644 (file)
@@ -6,6 +6,10 @@
     <source src=content/test.mp4 media="screen and (min-device-width: 100px)">
 </video>
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+    video = media = document.getElementsByTagName('video')[0];
+    waitForEvent('loadstart', function () { 
+        testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+        endTest();
+    } );
+
 </script>
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index 995c41f..651819b 100644 (file)
@@ -6,6 +6,9 @@
     <source src=content/error2.mpeg type=video/mpeg>
 </video>
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+    video = media = document.getElementsByTagName('video')[0];
+    waitForEvent('loadstart', function () { 
+        testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+        endTest();
+    } );
 </script>
index c128c3f..bfda0bc 100644 (file)
@@ -6,6 +6,10 @@
     <source src=content/error2.mpeg type=video/mpeg>
 </video>
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+    video = media = document.getElementsByTagName('video')[0];
+
+    waitForEvent("loadstart", function () {
+        testExpected("relativeURL(video.currentSrc) ", "content/test.mp4");
+        endTest();
+    });
 </script>
index 2083a74..fe14f3c 100644 (file)
@@ -3,7 +3,11 @@
 <video controls>
     <source src=content/test.mp4>
 </video>
+
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+    video = media = document.getElementsByTagName('video')[0];
+    waitForEvent("loadstart", function () {
+        testExpected("relativeURL(video.currentSrc) ", "content/test.mp4");
+        endTest();
+    });
 </script>
index c1643e7..ce051f5 100644 (file)
@@ -1,9 +1,10 @@
 Test that changing src attribute triggers load when network state is empty.
 Test that it does not trigger load when network state is non-empty.
 EVENT(emptied)
-TEST(video.networkState == HTMLMediaElement.EMPTY) OK
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EXPECTED (video.networkState == '0') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 EVENT(load)
-TEST(video.networkState != HTMLMediaElement.EMPTY) OK
+EXPECTED (video.networkState != '0') OK
 END OF TEST
 
index ca39e50..a0e003e 100644 (file)
@@ -5,15 +5,21 @@ Test that it does not trigger load when network state is non-empty.
 </div>
 <script src=video-test.js></script>
 <script>
-waitForEvent('emptied', function () {
-    test('video.networkState == HTMLMediaElement.EMPTY');
-    video.setAttribute('src', 'content/test.mp4')
-    waitForEventAndTest('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
-    waitForEvent('load', function () {
-        test('video.networkState != HTMLMediaElement.EMPTY');
-        video.setAttribute('src', 'content/test.wav');
-        waitForEventAndFail('loadstart');
-        setTimeout(endTest, 500);
+    waitForEvent('emptied', function () {
+        testExpected("video.networkState", HTMLMediaElement.EMPTY);
+        video.setAttribute('src', 'content/test.mp4')
+        waitForEvent("loadstart", function () { testExpected("relativeURL(video.currentSrc)", "content/test.mp4"); });
+
+        waitForEvent('load', function () {
+            testExpected("video.networkState", HTMLMediaElement.EMPTY, "!=");
+            video.setAttribute('src', 'content/test.wav');
+
+            waitForEvent('loadstart', function () { 
+                logResult("LOADSTART fired");
+                endTest();
+            } );
+
+            setTimeout(endTest, 500);
+        });
     });
-});
 </script>
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index e751dfe..b2a6dd1 100644 (file)
@@ -1,5 +1,6 @@
 Test that removing src attribute triggers load
 EVENT(emptied)
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index 565ea1a..0c224c6 100644 (file)
@@ -7,9 +7,13 @@ Test that removing src attribute triggers load
     <source src=content/test.mp4></source>
 </video>
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEvent('emptied', function () {
-    video.removeAttribute('src')
-    waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
-});
+    video = media = document.getElementsByTagName('video')[0];
+    waitForEvent('emptied', function () {
+        video.removeAttribute('src')
+
+        waitForEvent('loadstart', function () { 
+            testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+            endTest();
+        } );
+    });
 </script>
index 71b4480..57a53ad 100644 (file)
@@ -1,4 +1,5 @@
 Test that setting src attribute triggers load
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index f6a3d6d..75e7665 100644 (file)
@@ -1,9 +1,13 @@
 <video controls></video>
-<div>
-Test that setting src attribute triggers load
-</div>
+<div>Test that setting src attribute triggers load</div>
 <script src=video-test.js></script>
 <script>
-video.setAttribute('src', 'content/test.mp4')
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+    video.setAttribute('src', 'content/test.mp4')
+
+    waitForEvent('loadstart', function () {
+        testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+        endTest();
+    } );
+
+    video.setAttribute('src', 'content/test.mp4')
 </script>
index 6bd976a..b38e115 100644 (file)
@@ -1,3 +1,4 @@
-EVENT(loadstart) TEST(relativeURL(video.currentSrc) == 'content/test.mp4') OK
+EVENT(loadstart)
+EXPECTED (relativeURL(video.currentSrc) == 'content/test.mp4') OK
 END OF TEST
 
index af5db77..687ce49 100644 (file)
@@ -4,6 +4,12 @@
     <source src=content/error.mpeg>
 </video>
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
+
+    video = media = document.getElementsByTagName('video')[0];
+
+    waitForEvent('loadstart', function () { 
+        testExpected("relativeURL(video.currentSrc)", "content/test.mp4");
+        endTest();
+    } );
+
 </script>
index 24f37aa..ebb8e6f 100644 (file)
@@ -1,8 +1,14 @@
 <body>
 <script src=video-test.js></script>
 <video controls></video>
+
 <script>
-video = media = document.getElementsByTagName('video')[0];
-waitForEventTestAndEnd('loadstart', "relativeURL(video.currentSrc) == 'content/test.mp4'");
-video.src = "content/test.mp4";
+    video = media = document.getElementsByTagName('video')[0];
+
+    waitForEvent("loadstart", function () {
+        testExpected("relativeURL(video.currentSrc) ", "content/test.mp4");
+        endTest();
+    });
+
+    video.src = "content/test.mp4";
 </script>
index 460d019..a8cbac6 100644 (file)
@@ -1,4 +1,5 @@
-TEST(video.start == 1.0) OK
-EVENT(canplaythrough) TEST(video.currentTime == 1.0) OK
+EXPECTED (video.start == '1') OK
+EVENT(canplaythrough)
+EXPECTED (video.currentTime == '1') OK
 END OF TEST
 
index 0197bf5..eb976fb 100644 (file)
@@ -1,7 +1,9 @@
 <video start=1s controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.start == 1.0");
-waitForEventTestAndEnd('canplaythrough', "video.currentTime == 1.0");
-video.src = "content/test.mp4";
+    testExpected("video.start", 1.0);
+
+    waitForEvent("canplaythrough", function () { testExpected("video.currentTime", 1.0); endTest(); });
+
+    video.src = "content/test.mp4";
 </script>
index f82467a..a444d3f 100644 (file)
@@ -27,16 +27,12 @@ function testAndEnd(testFuncString)
 
 function test(testFuncString, endit)
 {
-    if (eval(testFuncString))
-        consoleWrite("TEST(" + testFuncString + ") <span style='color:green'>OK</span>");
-    else
-        consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>");    
-
+    logResult(eval(testFuncString), "TEST(" + testFuncString + ")");
     if (endit)
         endTest();  
 }
 
-function testExpected(testFuncString, expected)
+function testExpected(testFuncString, expected, comparison)
 {
     try {
         var observed = eval(testFuncString);
@@ -45,12 +41,23 @@ function testExpected(testFuncString, expected)
         return;
     }
     
-    var msg = "expected " + testFuncString + "=='" + expected + "', observed '" + observed + "'";
+    if (comparison === undefined)
+        comparison = '==';
 
-    if (observed == expected)
-        consoleWrite(msg + " - <span style='color:green'>OK</span>");
-    else
-        consoleWrite(msg + " - <span style='color:red'>FAIL</span>");
+    var success = false;
+    switch (comparison)
+    {
+        case '<':  success = observed <  expected; break;
+        case '>':  success = observed >  expected; break;
+        case '!=': success = observed != expected; break;
+        case '==': success = observed == expected; break;
+    }
+
+    var msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em>" + expected + "</em>')";
+    if (!success)
+        msg +=  ", OBSERVED '<em>" + observed + "</em>'";
+
+    logResult(success, msg);
 }
 
 function run(testFuncString)
@@ -75,7 +82,7 @@ function waitForEvent(eventName, func, endit)
         consoleWrite("EVENT(" + eventName + ")");
         
         if (func)
-            func();
+            func(event);
         
         if (endit)
             endTest();    
@@ -98,11 +105,7 @@ function waitForEventAndTest(eventName, testFuncString, endit)
 {
     function _eventCallback(event)
     {
-        if (eval(testFuncString))
-            consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:green'>OK</span>");
-        else
-            consoleWrite("EVENT(" + eventName + ") TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>");
-        
+        logResult(eval(testFuncString), "EVENT(" + eventName + ") TEST(" + testFuncString + ")");
         if (endit)
             endTest();    
     }
@@ -115,10 +118,7 @@ function testException(testString, exceptionString)
     try {
         eval(testString);
     } catch (ex) { 
-        if (ex.code == eval(exceptionString))
-            consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:green'>OK</span>");
-        else
-            consoleWrite("TEST(" + testString + ") THROWS("+exceptionString+") <span style='color:red'>FAIL</span>");    
+        logResult(ex.code == eval(exceptionString), "TEST(" + testString + ") THROWS("+exceptionString+")");
     }
 }
 
@@ -145,6 +145,14 @@ function failTestIn(ms)
     }, ms);
 }
 
+function logResult(success, text)
+{
+    if (success)
+        consoleWrite(text + " <span style='color:green'>OK</span>");
+    else
+        consoleWrite(text + " <span style='color:red'>FAIL</span>");
+}
+
 function consoleWrite(text)
 {
     if (testEnded)
index 41722e2..eda190b 100644 (file)
@@ -1,17 +1,17 @@
 Test 'volume' attribute
 
-TEST(video.volume == 1.0) OK
+EXPECTED (video.volume == '1') OK
 RUN(video.volume = 0.5)
-TEST(video.volume == 0.5) OK
+EXPECTED (video.volume == '0.5') OK
 RUN(video.volume = 0)
-TEST(video.volume == 0) OK
+EXPECTED (video.volume == '0') OK
 TEST(video.volume = 1.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.volume = -0.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 RUN(video.load())
 EVENT(load)
-TEST(video.volume == 0) OK
+EXPECTED (video.volume == '0') OK
 RUN(video.volume = 0.5)
-TEST(video.volume == 0.5) OK
+EXPECTED (video.volume == '0.5') OK
 TEST(video.volume = 1.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 TEST(video.volume = -0.5) THROWS(DOMException.INDEX_SIZE_ERR) OK
 END OF TEST
index f48ee1d..0ee20bd 100644 (file)
@@ -2,21 +2,21 @@
 <p>Test 'volume' attribute<p>
 <script src=video-test.js></script>
 <script>
-test("video.volume == 1.0");
-run("video.volume = 0.5");
-test("video.volume == 0.5");
-run("video.volume = 0");
-test("video.volume == 0");
-testException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
-testException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
-video.src = "content/test.mp4";
-run("video.load()");
-waitForEvent("load", function () {
-    test("video.volume == 0");
+    testExpected("video.volume", 1.0);
     run("video.volume = 0.5");
-    test("video.volume == 0.5");
+    testExpected("video.volume", 0.5);
+    run("video.volume = 0");
+    testExpected("video.volume", 0);
     testException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
     testException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
-    endTest();
-}); 
+    video.src = "content/test.mp4";
+    run("video.load()");
+    waitForEvent("load", function () {
+        testExpected("video.volume", 0);
+        run("video.volume = 0.5");
+        testExpected("video.volume", 0.5);
+        testException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR");
+        testException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR");
+        endTest();
+    }); 
 </script>
index 3ac7fa5..5e04dbf 100644 (file)
@@ -1,14 +1,14 @@
-TEST(video.width == 100) OK
-TEST(video.height == 50) OK
-TEST(video.offsetWidth == 100) OK
-TEST(video.offsetHeight == 50) OK
-TEST(video.width == 200) OK
-TEST(video.height == 100) OK
-TEST(video.offsetWidth == 200) OK
-TEST(video.offsetHeight == 100) OK
-TEST(video.getAttribute('width') == '400') OK
-TEST(video.getAttribute('height') == '200') OK
-TEST(video.offsetWidth == 400) OK
-TEST(video.offsetHeight == 200) OK
+EXPECTED (video.width == '100') OK
+EXPECTED (video.height == '50') OK
+EXPECTED (video.offsetWidth == '100') OK
+EXPECTED (video.offsetHeight == '50') OK
+EXPECTED (video.width == '200') OK
+EXPECTED (video.height == '100') OK
+EXPECTED (video.offsetWidth == '200') OK
+EXPECTED (video.offsetHeight == '100') OK
+EXPECTED (video.getAttribute('width') == '400') OK
+EXPECTED (video.getAttribute('height') == '200') OK
+EXPECTED (video.offsetWidth == '400') OK
+EXPECTED (video.offsetHeight == '200') OK
 END OF TEST
 
index 7e8626b..3b4e831 100644 (file)
@@ -1,21 +1,21 @@
 <video width=100 height=50 controls></video>
 <script src=video-test.js></script>
 <script>
-test("video.width == 100");
-test("video.height == 50");
-test("video.offsetWidth == 100");
-test("video.offsetHeight == 50");
-video.setAttribute('width', '200');
-video.setAttribute('height', '100');
-test("video.width == 200");
-test("video.height == 100");
-test("video.offsetWidth == 200");
-test("video.offsetHeight == 100");
-video.width = 400;
-video.height = 200;
-test("video.getAttribute('width') == '400'");
-test("video.getAttribute('height') == '200'");
-test("video.offsetWidth == 400");
-test("video.offsetHeight == 200");
-endTest();
+    testExpected("video.width", 100);
+    testExpected("video.height", 50);
+    testExpected("video.offsetWidth", 100);
+    testExpected("video.offsetHeight", 50);
+    video.setAttribute('width', '200');
+    video.setAttribute('height', '100');
+    testExpected("video.width", 200);
+    testExpected("video.height", 100);
+    testExpected("video.offsetWidth", 200);
+    testExpected("video.offsetHeight", 100);
+    video.width = 400;
+    video.height = 200;
+    testExpected("video.getAttribute('width')", 400);
+    testExpected("video.getAttribute('height')", 200);
+    testExpected("video.offsetWidth", 400);
+    testExpected("video.offsetHeight", 200);
+    endTest();
 </script>