| Differences between
and this patch
- a/LayoutTests/ChangeLog +30 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2014-10-08  Jer Noble  <jer.noble@apple.com>
2
3
        Layout Test media/track/track-forced-subtitles-in-band.html is flaky
4
        https://bugs.webkit.org/show_bug.cgi?id=137505
5
6
        Reviewed by Simon Fraser.
7
8
        Now that the media controls can have audio as well as text tracks, use the aria-labelledby attribute
9
        to get the <ul> containing the text track menu list items.
10
11
        * media/track/track-forced-subtitles-in-band.html:
12
        * media/track/track-user-preferences-expected.txt:
13
        * media/track/track-user-preferences.html:
14
        * media/trackmenu-test.js:
15
        (trackMenuListByLabel):
16
        (captionTrackMenuList):
17
        (audioTrackMenuList):
18
        (indexOfMenuItemBeginningWith):
19
        (indexOfCaptionMenuItemBeginningWith):
20
        (indexOfAudioTrackMenuItemBeginningWith):
21
        (selectMenuItemFromList):
22
        (selectCaptionMenuItem):
23
        (selectAudioTrackMenuItem):
24
        (listTrackMenu):
25
        (trackMenuList): Deleted.
26
        * media/video-controls-audiotracks-trackmenu.html:
27
        * media/video-controls-captions-trackmenu-includes-enabled-track.html:
28
        * media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html:
29
        * media/video-controls-captions-trackmenu.html:
30
1
2014-10-08  Andy Estes  <aestes@apple.com>
31
2014-10-08  Andy Estes  <aestes@apple.com>
2
32
3
        REGRESSION (r174403): media/track/track-forced-subtitles-in-band.html fails
33
        REGRESSION (r174403): media/track/track-forced-subtitles-in-band.html fails
- a/LayoutTests/TestExpectations -2 lines
Lines 228-232 webkit.org/b/137167 js/kde/function_arguments.html [ Failure ] a/LayoutTests/TestExpectations_sec1
228
228
229
# Promises/A+ 2.3.3 has many tests and it sometimes exceeds the time limit.
229
# Promises/A+ 2.3.3 has many tests and it sometimes exceeds the time limit.
230
webkit.org/b/136878 js/promises-tests/promises-tests-2-3-3.html [ Slow ]
230
webkit.org/b/136878 js/promises-tests/promises-tests-2-3-3.html [ Slow ]
231
232
webkit.org/b/137525 media/track/track-forced-subtitles-in-band.html [ Failure ]
- a/LayoutTests/media/track/track-forced-subtitles-in-band.html -1 / +1 lines
Lines 28-34 a/LayoutTests/media/track/track-forced-subtitles-in-band.html_sec1
28
                // Click the CC button to show the menu because it isn't created until it becomes visible.
28
                // Click the CC button to show the menu because it isn't created until it becomes visible.
29
                clickCCButton();
29
                clickCCButton();
30
30
31
                trackMenuItems = trackMenuList();
31
                trackMenuItems = captionTrackMenuList();
32
                if (!trackMenuItems) {
32
                if (!trackMenuItems) {
33
                    failTest("Failed to find track menu!");
33
                    failTest("Failed to find track menu!");
34
                    return;
34
                    return;
- a/LayoutTests/media/track/track-user-preferences-expected.txt -3 / +3 lines
Lines 18-26 EXPECTED (event.target.readyState == '2') OK a/LayoutTests/media/track/track-user-preferences-expected.txt_sec1
18
18
19
Test 3: select 'fr' track from menu
19
Test 3: select 'fr' track from menu
20
- show captions menu.
20
- show captions menu.
21
EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('French')].className == '') OK
21
EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('French')].className == '') OK
22
EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('English')].className == '') OK
22
EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('English')].className == '') OK
23
EXPECTED (trackMenuItems[indexOfMenuItemBeginningWith('Norwegian')].className == 'selected') OK
23
EXPECTED (trackMenuItems[indexOfCaptionMenuItemBeginningWith('Norwegian')].className == 'selected') OK
24
- click on 'French' menu item.
24
- click on 'French' menu item.
25
EVENT(load)
25
EVENT(load)
26
EXPECTED (event.target.srclang == 'fr') OK
26
EXPECTED (event.target.srclang == 'fr') OK
- a/LayoutTests/media/track/track-user-preferences.html -4 / +4 lines
Lines 83-92 a/LayoutTests/media/track/track-user-preferences.html_sec1
83
                    break;
83
                    break;
84
84
85
                case 4:
85
                case 4:
86
                    trackMenuItems = trackMenuList();
86
                    trackMenuItems = captionTrackMenuList();
87
                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('French')].className", "");
87
                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('French')].className", "");
88
                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('English')].className", "");
88
                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('English')].className", "");
89
                    testExpected("trackMenuItems[indexOfMenuItemBeginningWith('Norwegian')].className", "selected");
89
                    testExpected("trackMenuItems[indexOfCaptionMenuItemBeginningWith('Norwegian')].className", "selected");
90
90
91
                    selectCaptionMenuItem("French");
91
                    selectCaptionMenuItem("French");
92
                    expectedLanguage = 'fr';
92
                    expectedLanguage = 'fr';
- a/LayoutTests/media/trackmenu-test.js -12 / +51 lines
Lines 42-48 function getTrackListElement() a/LayoutTests/media/trackmenu-test.js_sec1
42
  return trackListElement;
42
  return trackListElement;
43
}
43
}
44
44
45
function trackMenuList()
45
function trackMenuListByLabel(label)
46
{
46
{
47
    trackListElement = getTrackListElement();
47
    trackListElement = getTrackListElement();
48
    if (!trackListElement){
48
    if (!trackListElement){
Lines 50-57 function trackMenuList() a/LayoutTests/media/trackmenu-test.js_sec2
50
        return;
50
        return;
51
    }
51
    }
52
52
53
    var trackLists = trackListElement.querySelectorAll("ul");
54
    var trackList = Array.prototype.find.call(trackLists, function(item) {
55
        return item.getAttribute('aria-labelledby') === label;
56
    });
57
58
53
    // Track list should have a <ul> with <li> children.
59
    // Track list should have a <ul> with <li> children.
54
    var trackList = trackListElement.querySelector("ul");
55
    if (!trackList) {
60
    if (!trackList) {
56
        failTest("Could not find a child ul element in track list menu");
61
        failTest("Could not find a child ul element in track list menu");
57
        return;
62
        return;
Lines 65-73 function trackMenuList() a/LayoutTests/media/trackmenu-test.js_sec3
65
    return trackListItems;
70
    return trackListItems;
66
}
71
}
67
72
68
function indexOfMenuItemBeginningWith(title)
73
function captionTrackMenuList()
74
{
75
    return trackMenuListByLabel('webkitMediaControlsClosedCaptionsHeading');
76
}
77
78
function audioTrackMenuList()
79
{
80
    return trackMenuListByLabel('webkitMediaControlsAudioTrackHeading');
81
}
82
83
function indexOfMenuItemBeginningWith(title, trackMenuItems)
69
{
84
{
70
    var trackMenuItems = trackMenuList();
71
    for (i = 0; i < trackMenuItems.length; ++i) {
85
    for (i = 0; i < trackMenuItems.length; ++i) {
72
        if (trackMenuItems[i].textContent.indexOf(title) == 0)
86
        if (trackMenuItems[i].textContent.indexOf(title) == 0)
73
            break;
87
            break;
Lines 75-89 function indexOfMenuItemBeginningWith(title) a/LayoutTests/media/trackmenu-test.js_sec4
75
    return (i < trackMenuItems.length) ? i : -1;
89
    return (i < trackMenuItems.length) ? i : -1;
76
}
90
}
77
91
78
function selectCaptionMenuItem(title)
92
function indexOfCaptionMenuItemBeginningWith(title)
79
{
93
{
80
    var trackMenuItems = trackMenuList();
94
    return indexOfMenuItemBeginningWith(title, captionTrackMenuList());
81
    var index = indexOfMenuItemBeginningWith(title);
95
}
82
    if (index < 0) {
83
        failTest("Menu item " + title + " not found in track list menu.");
84
        return;
85
    }
86
96
97
function indexOfAudioTrackMenuItemBeginningWith(title)
98
{
99
    return indexOfMenuItemBeginningWith(title, audioTrackMenuList());
100
}
101
102
function selectMenuItemFromList(title, trackMenuItems, index)
103
{
87
    consoleWrite("- click on '" + title + "' menu item.");
104
    consoleWrite("- click on '" + title + "' menu item.");
88
    var selectedTrackItem = trackMenuItems[index];
105
    var selectedTrackItem = trackMenuItems[index];
89
    var boundingRect = selectedTrackItem.getBoundingClientRect();
106
    var boundingRect = selectedTrackItem.getBoundingClientRect();
Lines 94-99 function selectCaptionMenuItem(title) a/LayoutTests/media/trackmenu-test.js_sec5
94
    eventSender.mouseUp();
111
    eventSender.mouseUp();
95
}
112
}
96
113
114
function selectCaptionMenuItem(title)
115
{
116
    var index = indexOfCaptionMenuItemBeginningWith(title);
117
    if (index < 0) {
118
        failTest("Menu item " + title + " not found in track list menu.");
119
        return;
120
    }
121
122
    selectMenuItemFromList(title, captionTrackMenuList(), index);
123
}
124
125
function selectAudioTrackMenuItem(title)
126
{
127
    var index = indexOfAudioTrackMenuItemBeginningWith(title);
128
    if (index < 0) {
129
        failTest("Menu item " + title + " not found in track list menu.");
130
        return;
131
    }
132
133
    selectMenuItemFromList(title, audioTrackMenuList(), index);
134
}
135
97
function showTrackMenu()
136
function showTrackMenu()
98
{
137
{
99
    clickCCButton();
138
    clickCCButton();
Lines 111-117 function hideTrackMenu() a/LayoutTests/media/trackmenu-test.js_sec6
111
150
112
function listTrackMenu()
151
function listTrackMenu()
113
{
152
{
114
    var trackListItems = trackMenuList();
153
    var trackListItems = captionTrackMenuList();
115
    consoleWrite("Track menu:");
154
    consoleWrite("Track menu:");
116
    for (i = 0; i < trackListItems.length; i++) {
155
    for (i = 0; i < trackListItems.length; i++) {
117
        var logString = i + ": \"" + trackListItems[i].textContent + "\"";
156
        var logString = i + ": \"" + trackListItems[i].textContent + "\"";
- a/LayoutTests/media/video-controls-audiotracks-trackmenu.html -3 / +3 lines
Lines 25-31 a/LayoutTests/media/video-controls-audiotracks-trackmenu.html_sec1
25
25
26
            function testMenu()
26
            function testMenu()
27
            {
27
            {
28
                trackListItems = trackMenuList();
28
                trackListItems = audioTrackMenuList();
29
                var expectedItemCount = video.audioTracks.length;
29
                var expectedItemCount = video.audioTracks.length;
30
                consoleWrite("There should be " + expectedItemCount + " items in the menu.");
30
                consoleWrite("There should be " + expectedItemCount + " items in the menu.");
31
                testExpected("trackListItems.length", expectedItemCount);
31
                testExpected("trackListItems.length", expectedItemCount);
Lines 33-39 a/LayoutTests/media/video-controls-audiotracks-trackmenu.html_sec2
33
33
34
            function testAudioTrackEnabled()
34
            function testAudioTrackEnabled()
35
            {
35
            {
36
                trackListItems = trackMenuList();
36
                trackListItems = audioTrackMenuList();
37
                consoleWrite("*** Menu item 0 should be selected");
37
                consoleWrite("*** Menu item 0 should be selected");
38
38
39
                testExpected("trackListItems.length", 3);
39
                testExpected("trackListItems.length", 3);
Lines 47-53 a/LayoutTests/media/video-controls-audiotracks-trackmenu.html_sec3
47
            function selectDifferentAudioTrack()
47
            function selectDifferentAudioTrack()
48
            {
48
            {
49
                consoleWrite("*** Selecting French Track");
49
                consoleWrite("*** Selecting French Track");
50
                selectCaptionMenuItem("French");
50
                selectAudioTrackMenuItem("French");
51
                setTimeout(testAudioTrackDisabled, 100);
51
                setTimeout(testAudioTrackDisabled, 100);
52
            }
52
            }
53
53
- a/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html -2 / +2 lines
Lines 15-21 a/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html_sec1
15
15
16
            function testInitialState()
16
            function testInitialState()
17
            {
17
            {
18
                trackListItems = trackMenuList();
18
                trackListItems = captionTrackMenuList();
19
                consoleWrite("<br>*** Initially both tracks are disabled so neither should be selected.");
19
                consoleWrite("<br>*** Initially both tracks are disabled so neither should be selected.");
20
                testExpected("video.textTracks[0].mode", "disabled");
20
                testExpected("video.textTracks[0].mode", "disabled");
21
                testExpected("video.textTracks[1].mode", "disabled");
21
                testExpected("video.textTracks[1].mode", "disabled");
Lines 35-41 a/LayoutTests/media/video-controls-captions-trackmenu-includes-enabled-track.html_sec2
35
            function testMenuAfterEnablingTracks()
35
            function testMenuAfterEnablingTracks()
36
            {
36
            {
37
                consoleWrite("<br>*** Both tracks are enabled so both should be selected.");
37
                consoleWrite("<br>*** Both tracks are enabled so both should be selected.");
38
                trackListItems = trackMenuList();
38
                trackListItems = captionTrackMenuList();
39
                testExpected("video.textTracks[0].mode", "showing");
39
                testExpected("video.textTracks[0].mode", "showing");
40
                testExpected("video.textTracks[1].mode", "showing");
40
                testExpected("video.textTracks[1].mode", "showing");
41
                consoleWrite("");
41
                consoleWrite("");
- a/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html -1 / +1 lines
Lines 13-19 a/LayoutTests/media/video-controls-captions-trackmenu-only-captions-descriptions-and-subtitles.html_sec1
13
            function testMenu()
13
            function testMenu()
14
            {
14
            {
15
                showTrackMenu();
15
                showTrackMenu();
16
                trackListItems = trackMenuList();
16
                trackListItems = captionTrackMenuList();
17
                var matchingTracks = 0;
17
                var matchingTracks = 0;
18
                for (var i = 0; i < video.textTracks.length; ++i) {
18
                for (var i = 0; i < video.textTracks.length; ++i) {
19
                    var kind = video.textTracks[i].kind;
19
                    var kind = video.textTracks[i].kind;
- a/LayoutTests/media/video-controls-captions-trackmenu.html -3 / +3 lines
Lines 24-30 a/LayoutTests/media/video-controls-captions-trackmenu.html_sec1
24
                consoleWrite("");
24
                consoleWrite("");
25
            }
25
            }
26
26
27
            function trackMenuList()
27
            function captionTrackMenuList()
28
            {
28
            {
29
                var trackListElement = getTrackListElement();
29
                var trackListElement = getTrackListElement();
30
                if (!trackListElement)
30
                if (!trackListElement)
Lines 46-52 a/LayoutTests/media/video-controls-captions-trackmenu.html_sec2
46
46
47
            function testMenu()
47
            function testMenu()
48
            {
48
            {
49
                trackListItems = trackMenuList();
49
                trackListItems = captionTrackMenuList();
50
                var expectedItemCount = video.textTracks.length + 2;
50
                var expectedItemCount = video.textTracks.length + 2;
51
                consoleWrite("There should be " + expectedItemCount + " items in the menu.");
51
                consoleWrite("There should be " + expectedItemCount + " items in the menu.");
52
                testExpected("trackListItems.length", expectedItemCount);
52
                testExpected("trackListItems.length", expectedItemCount);
Lines 55-61 a/LayoutTests/media/video-controls-captions-trackmenu.html_sec3
55
            function selectCaptionMenuItem(index, nextStep)
55
            function selectCaptionMenuItem(index, nextStep)
56
            {
56
            {
57
                // Click on the selected item
57
                // Click on the selected item
58
                var trackListItems = trackMenuList();
58
                var trackListItems = captionTrackMenuList();
59
                var selectedTrackItem = trackListItems[index];
59
                var selectedTrackItem = trackListItems[index];
60
                var boundingRect = selectedTrackItem.getBoundingClientRect();
60
                var boundingRect = selectedTrackItem.getBoundingClientRect();
61
                var x = boundingRect.left + boundingRect.width / 2;
61
                var x = boundingRect.left + boundingRect.width / 2;

Return to Bug 137505