| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../resources/js-test.js"></script> |
| <script src="../resources/accessibility-helper.js"></script> |
| </head> |
| <body> |
| |
| <video |
| id="video-with-src-attribute" |
| aria-label="Video with src attribute" |
| style="width:640px;height:360px;" |
| src="resources/test.mp4" |
| > |
| </video> |
| |
| <video |
| id="video-with-source-element" |
| aria-label="Video with <source> element" |
| style="width:640px;height:360px;" |
| > |
| <source src="resources/test.mp4" type="video/mp4"> |
| </video> |
| |
| <video |
| id="video-with-empty-source-element" |
| aria-label="Video with empty <source> element" |
| style="width:640px;height:360px;" |
| > |
| <source type="video/mp4"> |
| </video> |
| |
| <video |
| id="empty-video" |
| aria-label="Video that has neither a src attribute nor <source> element" |
| style="width:640px;height:360px;" |
| > |
| </video> |
| |
| <script> |
| description("This test ensures video accessibility elements return URL attribute values when appropriate."); |
| |
| const baseVideoPath = "resources/test.mp4"; |
| debug(`baseVideoPath = "${baseVideoPath}"`); |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| var domVideo, video; |
| setTimeout(async function() { |
| await waitFor(() => { |
| domVideo = document.getElementById("video-with-src-attribute"); |
| return domVideo && domVideo.readyState >= 2; |
| }); |
| video = accessibilityController.accessibleElementById(domVideo.id); |
| shouldBe("video.url.includes(baseVideoPath)", "true"); |
| |
| await waitFor(() => { |
| domVideo = document.getElementById("video-with-source-element"); |
| return domVideo && domVideo.readyState >= 2; |
| }); |
| video = accessibilityController.accessibleElementById(domVideo.id); |
| shouldBe("video.url.includes(baseVideoPath)", "true"); |
| |
| video = accessibilityController.accessibleElementById("video-with-empty-source-element"); |
| shouldBe("!video.url", "true"); |
| |
| video = accessibilityController.accessibleElementById("empty-video"); |
| shouldBe("!video.url", "true") |
| |
| finishJSTest(); |
| }, 0); |
| } |
| </script> |
| </body> |
| </html> |
| |