Bug 1368489 - Add testcase to testing the order for the events when cue1's endTime is equal to cue2's stratTime. r=rillian
MozReview-Commit-ID: 5Xyw4MsUR5K
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -1102,16 +1102,18 @@ skip-if = toolkit == 'android' # bug 119
skip-if = android_version == '22' # bug 1294833, android(bug 1368010)
tags = webvtt
[test_trackelementsrc.html]
skip-if = android_version == '22' # android(bug 1368010)
tags = webvtt
[test_trackevent.html]
skip-if = android_version == '22' # android(bug 1368010)
tags = webvtt
+[test_webvtt_event_same_time.html]
+tags = webvtt
[test_unseekable.html]
[test_video_to_canvas.html]
skip-if = toolkit == 'android' # android(bug 1232305), bugs 1320418,1347953,1347954,1348140,1348386
[test_video_in_audio_element.html]
skip-if = android_version == '15' || android_version == '17' # bug 1320417, 1326326, android(bug 1232323, bug 1232305)
[test_videoDocumentTitle.html]
skip-if = toolkit == 'android' # android(bug 1232305)
[test_VideoPlaybackQuality.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_webvtt_event_same_time.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset='utf-8'>
+ <title>WebVTT : cue's onenter/onexit event order </title>
+ <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<div id="content">
+</div>
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+var c1exit = false;
+var c3enter = false;
+
+function runTest() {
+ info("--- create video ---");
+ var video = document.createElement("video");
+ video.src = "seek.webm";
+ video.autoplay = true;
+ document.getElementById("content").appendChild(video);
+
+ var track = video.addTextTrack("subtitles", "A", "en");
+ track.mode = "showing";
+
+ var cue1 = new VTTCue(1, 2, "Test cue1");
+ var cue2 = new VTTCue(2, 3, "Test cue2");
+ track.addCue(cue1);
+ track.addCue(cue2);
+
+ cue1.onexit = function () {
+ cue1.onexit = null;
+ c1exit = true;
+ }
+ cue2.onenter = function () {
+ cue2.onenter = null;
+ ok(c1exit, "cue1 onexit event before than cue2 onenter");
+ video.pause();
+ SimpleTest.finish();
+ }
+
+ var cue3 = new VTTCue(1, 2, "Test cue3");
+ var cue4 = new VTTCue(1, 2, "Test cue4");
+ track.addCue(cue3);
+ track.addCue(cue4);
+
+ cue3.onenter = function () {
+ cue3.onenter = null;
+ c3enter = true;
+ }
+ cue4.onenter = function () {
+ cue4.onenter = null;
+ ok(c3enter, "cue3 onenter event before than cue4 onenter");
+ }
+}
+
+onload = runTest;
+</script>
+</body>
+</html>