Title: [174472] trunk/LayoutTests
Revision
174472
Author
[email protected]
Date
2014-10-08 13:04:33 -0700 (Wed, 08 Oct 2014)

Log Message

Layout Test media/track/track-forced-subtitles-in-band.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=137505

Reviewed by Simon Fraser.

Now that the media controls can have audio as well as text tracks, use the aria-labelledby attribute
to get the <ul> containing the text track menu list items.

* media/track/track-forced-subtitles-in-band.html:
* media/track/track-user-preferences-expected.txt:
* media/track/track-user-preferences.html:
* media/trackmenu-test.js:
(trackMenuListByLabel):
(captionTrackMenuList):
(audioTrackMenuList):
(indexOfMenuItemBeginningWith):
(indexOfCaptionMenuItemBeginningWith):
(indexOfAudioTrackMenuItemBeginningWith):
(selectMenuItemFromList):
(selectCaptionMenuItem):
(selectAudioTrackMenuItem):
(listTrackMenu):
(trackMenuList): Deleted.
* media/video-controls-audiotracks-trackmenu.html:
* media/video-controls-captions-trackmenu-includes-enabled-track.html:
* media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html:
* media/video-controls-captions-trackmenu.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (174471 => 174472)


--- trunk/LayoutTests/ChangeLog	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/ChangeLog	2014-10-08 20:04:33 UTC (rev 174472)
@@ -1,3 +1,33 @@
+2014-10-08  Jer Noble  <[email protected]>
+
+        Layout Test media/track/track-forced-subtitles-in-band.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=137505
+
+        Reviewed by Simon Fraser.
+
+        Now that the media controls can have audio as well as text tracks, use the aria-labelledby attribute
+        to get the <ul> containing the text track menu list items.
+
+        * media/track/track-forced-subtitles-in-band.html:
+        * media/track/track-user-preferences-expected.txt:
+        * media/track/track-user-preferences.html:
+        * media/trackmenu-test.js:
+        (trackMenuListByLabel):
+        (captionTrackMenuList):
+        (audioTrackMenuList):
+        (indexOfMenuItemBeginningWith):
+        (indexOfCaptionMenuItemBeginningWith):
+        (indexOfAudioTrackMenuItemBeginningWith):
+        (selectMenuItemFromList):
+        (selectCaptionMenuItem):
+        (selectAudioTrackMenuItem):
+        (listTrackMenu):
+        (trackMenuList): Deleted.
+        * media/video-controls-audiotracks-trackmenu.html:
+        * media/video-controls-captions-trackmenu-includes-enabled-track.html:
+        * media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html:
+        * media/video-controls-captions-trackmenu.html:
+
 2014-10-08  Dean Jackson  <[email protected]>
 
         Add deprecation warning for CSSKeyframesRule::appendRule

Modified: trunk/LayoutTests/TestExpectations (174471 => 174472)


--- trunk/LayoutTests/TestExpectations	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/TestExpectations	2014-10-08 20:04:33 UTC (rev 174472)
@@ -217,5 +217,3 @@
 
 # Promises/A+ 2.3.3 has many tests and it sometimes exceeds the time limit.
 webkit.org/b/136878 js/promises-tests/promises-tests-2-3-3.html [ Slow ]
-
-webkit.org/b/137525 media/track/track-forced-subtitles-in-band.html [ Failure ]

Modified: trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html (174471 => 174472)


--- trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/track/track-forced-subtitles-in-band.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -28,7 +28,7 @@
                 // Click the CC button to show the menu because it isn't created until it becomes visible.
                 clickCCButton();
 
-                trackMenuItems = trackMenuList();
+                trackMenuItems = captionTrackMenuList();
                 if (!trackMenuItems) {
                     failTest("Failed to find track menu!");
                     return;

Modified: trunk/LayoutTests/media/track/track-user-preferences-expected.txt (174471 => 174472)


--- trunk/LayoutTests/media/track/track-user-preferences-expected.txt	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/track/track-user-preferences-expected.txt	2014-10-08 20:04:33 UTC (rev 174472)
@@ -18,9 +18,9 @@
 
 Test 3: select 'fr' track from menu
 - show captions menu.
-EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('French')].className == '') OK
-EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('English')].className == '') OK
-EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('Norwegian')].className == 'selected') OK
+EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('French')].className == '') OK
+EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('English')].className == '') OK
+EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('Norwegian')].className == 'selected') OK
 - click on 'French' menu item.
 EVENT(load)
 EXPECTED (event.target.srclang == 'fr') OK

Modified: trunk/LayoutTests/media/track/track-user-preferences.html (174471 => 174472)


--- trunk/LayoutTests/media/track/track-user-preferences.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/track/track-user-preferences.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -83,10 +83,10 @@
                     break;
 
                 case 4:
-                    trackMenuItems = trackMenuList();
-                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('French')].className", "");
-                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('English')].className", "");
-                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('Norwegian')].className", "selected");
+                    trackMenuItems = captionTrackMenuList();
+                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('French')].className", "");
+                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('English')].className", "");
+                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('Norwegian')].className", "selected");
 
                     selectCaptionMenuItem("French");
                     expectedLanguage = 'fr';

Modified: trunk/LayoutTests/media/trackmenu-test.js (174471 => 174472)


--- trunk/LayoutTests/media/trackmenu-test.js	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/trackmenu-test.js	2014-10-08 20:04:33 UTC (rev 174472)
@@ -42,7 +42,7 @@
   return trackListElement;
 }
 
-function trackMenuList()
+function trackMenuListByLabel(label)
 {
     trackListElement = getTrackListElement();
     if (!trackListElement){
@@ -50,8 +50,13 @@
         return;
     }
 
+    var trackLists = trackListElement.querySelectorAll("ul");
+    var trackList = Array.prototype.find.call(trackLists, function(item) {
+        return item.getAttribute('aria-labelledby') === label;
+    });
+
+
     // Track list should have a <ul> with <li> children.
-    var trackList = trackListElement.querySelector("ul");
     if (!trackList) {
         failTest("Could not find a child ul element in track list menu");
         return;
@@ -65,9 +70,18 @@
     return trackListItems;
 }
 
-function indexOfMenuItemBeginningWith(title)
+function captionTrackMenuList()
 {
-    var trackMenuItems = trackMenuList();
+    return trackMenuListByLabel('webkitMediaControlsClosedCaptionsHeading');
+}
+
+function audioTrackMenuList()
+{
+    return trackMenuListByLabel('webkitMediaControlsAudioTrackHeading');
+}
+
+function indexOfMenuItemBeginningWith(title, trackMenuItems)
+{
     for (i = 0; i < trackMenuItems.length; ++i) {
         if (trackMenuItems[i].textContent.indexOf(title) == 0)
             break;
@@ -75,15 +89,18 @@
     return (i < trackMenuItems.length) ? i : -1;
 }
 
-function selectCaptionMenuItem(title)
+function indexOfCaptionMenuItemBeginningWith(title)
 {
-    var trackMenuItems = trackMenuList();
-    var index = indexOfMenuItemBeginningWith(title);
-    if (index < 0) {
-        failTest("Menu item " + title + " not found in track list menu.");
-        return;
-    }
+    return indexOfMenuItemBeginningWith(title, captionTrackMenuList());
+}
 
+function indexOfAudioTrackMenuItemBeginningWith(title)
+{
+    return indexOfMenuItemBeginningWith(title, audioTrackMenuList());
+}
+
+function selectMenuItemFromList(title, trackMenuItems, index)
+{
     consoleWrite("- click on '" + title + "' menu item.");
     var selectedTrackItem = trackMenuItems[index];
     var boundingRect = selectedTrackItem.getBoundingClientRect();
@@ -94,6 +111,28 @@
     eventSender.mouseUp();
 }
 
+function selectCaptionMenuItem(title)
+{
+    var index = indexOfCaptionMenuItemBeginningWith(title);
+    if (index < 0) {
+        failTest("Menu item " + title + " not found in track list menu.");
+        return;
+    }
+
+    selectMenuItemFromList(title, captionTrackMenuList(), index);
+}
+
+function selectAudioTrackMenuItem(title)
+{
+    var index = indexOfAudioTrackMenuItemBeginningWith(title);
+    if (index < 0) {
+        failTest("Menu item " + title + " not found in track list menu.");
+        return;
+    }
+
+    selectMenuItemFromList(title, audioTrackMenuList(), index);
+}
+
 function showTrackMenu()
 {
     clickCCButton();
@@ -111,7 +150,7 @@
 
 function listTrackMenu()
 {
-    var trackListItems = trackMenuList();
+    var trackListItems = captionTrackMenuList();
     consoleWrite("Track menu:");
     for (i = 0; i < trackListItems.length; i++) {
         var logString = i + ": \"" + trackListItems[i].textContent + "\"";

Modified: trunk/LayoutTests/media/video-controls-audiotracks-trackmenu.html (174471 => 174472)


--- trunk/LayoutTests/media/video-controls-audiotracks-trackmenu.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/video-controls-audiotracks-trackmenu.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -25,7 +25,7 @@
 
             function testMenu()
             {
-                trackListItems = trackMenuList();
+                trackListItems = audioTrackMenuList();
                 var expectedItemCount = video.audioTracks.length;
                 consoleWrite("There should be " + expectedItemCount + " items in the menu.");
                 testExpected("trackListItems.length", expectedItemCount);
@@ -33,7 +33,7 @@
 
             function testAudioTrackEnabled()
             {
-                trackListItems = trackMenuList();
+                trackListItems = audioTrackMenuList();
                 consoleWrite("*** Menu item 0 should be selected");
 
                 testExpected("trackListItems.length", 3);
@@ -47,7 +47,7 @@
             function selectDifferentAudioTrack()
             {
                 consoleWrite("*** Selecting French Track");
-                selectCaptionMenuItem("French");
+                selectAudioTrackMenuItem("French");
                 setTimeout(testAudioTrackDisabled, 100);
             }
 

Modified: trunk/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html (174471 => 174472)


--- trunk/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -15,7 +15,7 @@
 
             function testInitialState()
             {
-                trackListItems = trackMenuList();
+                trackListItems = captionTrackMenuList();
                 consoleWrite("<br>*** Initially both tracks are disabled so neither should be selected.");
                 testExpected("video.textTracks[0].mode", "disabled");
                 testExpected("video.textTracks[1].mode", "disabled");
@@ -35,7 +35,7 @@
             function testMenuAfterEnablingTracks()
             {
                 consoleWrite("<br>*** Both tracks are enabled so both should be selected.");
-                trackListItems = trackMenuList();
+                trackListItems = captionTrackMenuList();
                 testExpected("video.textTracks[0].mode", "showing");
                 testExpected("video.textTracks[1].mode", "showing");
                 consoleWrite("");

Modified: trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html (174471 => 174472)


--- trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -13,7 +13,7 @@
             function testMenu()
             {
                 showTrackMenu();
-                trackListItems = trackMenuList();
+                trackListItems = captionTrackMenuList();
                 var matchingTracks = 0;
                 for (var i = 0; i < video.textTracks.length; ++i) {
                     var kind = video.textTracks[i].kind;

Modified: trunk/LayoutTests/media/video-controls-captions-trackmenu.html (174471 => 174472)


--- trunk/LayoutTests/media/video-controls-captions-trackmenu.html	2014-10-08 20:01:28 UTC (rev 174471)
+++ trunk/LayoutTests/media/video-controls-captions-trackmenu.html	2014-10-08 20:04:33 UTC (rev 174472)
@@ -24,7 +24,7 @@
                 consoleWrite("");
             }
 
-            function trackMenuList()
+            function captionTrackMenuList()
             {
                 var trackListElement = getTrackListElement();
                 if (!trackListElement)
@@ -46,7 +46,7 @@
 
             function testMenu()
             {
-                trackListItems = trackMenuList();
+                trackListItems = captionTrackMenuList();
                 var expectedItemCount = video.textTracks.length + 2;
                 consoleWrite("There should be " + expectedItemCount + " items in the menu.");
                 testExpected("trackListItems.length", expectedItemCount);
@@ -55,7 +55,7 @@
             function selectCaptionMenuItem(index, nextStep)
             {
                 // Click on the selected item
-                var trackListItems = trackMenuList();
+                var trackListItems = captionTrackMenuList();
                 var selectedTrackItem = trackListItems[index];
                 var boundingRect = selectedTrackItem.getBoundingClientRect();
                 var x = boundingRect.left + boundingRect.width / 2;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to