Adding testTracks() function to video-test.js
authorannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 02:40:16 +0000 (02:40 +0000)
committerannacc@chromium.org <annacc@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Sep 2011 02:40:16 +0000 (02:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68643

Reviewed by Eric Carlson.

* media/video-test.js:
(testTracks):

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

LayoutTests/ChangeLog
LayoutTests/media/video-test.js

index 9c7b4ea..5452af9 100644 (file)
@@ -1,3 +1,13 @@
+2011-09-22  Anna Cavender  <annacc@chromium.org>
+
+        Adding testTracks() function to video-test.js
+        https://bugs.webkit.org/show_bug.cgi?id=68643
+
+        Reviewed by Eric Carlson.
+
+        * media/video-test.js:
+        (testTracks):
+
 2011-09-22  Tom Sepez  <tsepez@chromium.org>
 
         Make XSSAuditor extract meaningful snippet from script blocks for comparison
index 7d8f3e8..f627317 100644 (file)
@@ -5,6 +5,7 @@ var console = null;
 var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
 var Failed = false;
 
+var track = null; // Current TextTrack being tested.
 var cues = null; // Current TextTrackCueList being tested.
 var numberOfTrackTests = 0;
 var numberOfTracksLoaded = 0;
@@ -240,6 +241,22 @@ function isInTimeRanges(ranges, time)
     return false;
 }
 
+function testTracks(expected)
+{
+    tracks = video.textTracks;
+    testExpected("tracks.length", expected.length);
+
+    for (i = 0; i < tracks.length; i++) {
+        consoleWrite("<br>*** Testing text track " + i);
+
+        track = tracks[i];
+        for (j = 0; j < expected.tests.length; j++) {
+            var test = expected.tests[j];
+            testExpected("track." + test.property, test.values[i]);
+        }
+    }
+}
+
 function testCues(index, expected)
 {
     consoleWrite("<br>*** Testing text track " + index);