Commit da1fcc66 authored by Sriram's avatar Sriram Committed by Commit Bot

Upstream track-large-*, track-load-* and track-mode-* tests

Upstream the below tests from media/track/ to wpt
1. track-large-timestamp.html
2. track-load-error-readyState.html
3. track-load-from-element-readyState.html
4. track-load-from-src-readyState.html
5. track-mode-disabled-crash.html
6. track-mode-not-changed-by-new-track.html
7. track-mode-triggers-loading.html
8. track-mode.html

Bug: 782555
Change-Id: Ic76b8f4d8010650b72c031dec3715d274a02a4ff
Reviewed-on: https://chromium-review.googlesource.com/850155Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: srirama chandra sekhar <srirama.m@samsung.com>
Cr-Commit-Position: refs/heads/master@{#526970}
parent 4766c501
WEBVTT
00:00:00.000 --> 00:00:01.000
Lorem ipsum dolor sit amet,
00:00:02.000 --> 00:00:03.000
consectetuer adipiscing elit,
00:00:04.000 --> 00:00:05.000
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
00:00:06.000 --> 00:00:07.000
Ut wisi enim ad minim veniam,
00:00:08.000 --> 00:00:09.000
quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
00:00:10.000 --> 00:00:11.000
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,
00:00:12.000 --> 00:00:13.000
vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
00:00:14.000 --> 00:00:15.000
dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
00:00:16.000 --> 00:00:17.000
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id
00:00:18.000 --> 00:00:19.000
quod mazim placerat facer possim assum.
00:00:20.000 --> 00:00:21.000
Typi non habent claritatem insitam;
00:00:22.000 --> 00:00:23.000
est usus legentis in iis qui facit eorum claritatem.
<!DOCTYPE html>
<title>Very large timestamp is parsed correctly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/large-timestamp.vtt" default>
<script>
async_test(function(t) {
var testTrack = document.querySelector("track");
testTrack.onload = t.step_func_done(function() {
assert_equals(testTrack.track.cues.length, 1);
var cue = testTrack.track.cues[0];
assert_equals(parseInt(cue.id), 1);
assert_equals(cue.startTime / 3600, 1234567);
assert_equals(cue.endTime / 3600, 1234567890);
});
});
</script>
</video>
\ No newline at end of file
<!DOCTYPE html>
<title>Tests the error event on HTMLTrackElement and ERROR readyState on TextTrack.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<title>Error event on HTMLTrackElement and ERROR readyState on TextTrack</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="junk" default>
<script>
......
<!DOCTYPE html>
<title>Tests the load event on HTMLTrackElement and LOADED readyState on TextTrack when src is set on the element.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<title>Load event on HTMLTrackElement and LOADED readyState on TextTrack when src is set on the element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="captions-webvtt/tc004-webvtt-file.vtt" default>
<track src="resources/webvtt-file.vtt" default>
<script>
async_test(function(t) {
var track = document.querySelector("track");
......
<!DOCTYPE html>
<title>Tests the load event on HTMLTrackElement and LOADED readyState on TextTrack when src is set from JavaScript.</title>
<title>Load event on HTMLTrackElement and LOADED readyState on TextTrack when src is set from JavaScript</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track>
</video>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
async_test(function(t) {
var track = document.querySelector("track");
assert_equals(track.readyState, HTMLTrackElement.NONE);
track.onload = t.step_func_done(function () {
track.onload = t.step_func_done(function() {
assert_equals(track.readyState, HTMLTrackElement.LOADED);
});
track.src = "captions-webvtt/tc004-webvtt-file.vtt";
track.src = "resources/webvtt-file.vtt";
track.track.mode = "hidden";
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<title>Cues are properly removed from the active cue list when their track changes mode to disabled</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/captions-gaps.vtt" kind="captions" default >
<script>
async_test(function(t) {
var video = document.querySelector("video");
var testTrack = document.querySelector("track");
video.src = getVideoURI("/media/counting");
video.oncanplaythrough = t.step_func(startTest);
video.onseeked = t.step_func_done(seeked);
function startTest() {
// Set the mode of the text track to "showing".
testTrack.track.mode = "showing";
// Seek to a time with a caption.
video.currentTime = 1.5;
}
function seeked() {
// Set the mode of the text track to "hidden", then to "showing" again.
testTrack.track.mode = "hidden";
testTrack.track.mode = "showing";
// Set the mode of the text track to "disabled".
testTrack.track.mode = "disabled";
}
});
</script>
</video>
\ No newline at end of file
<!DOCTYPE html>
<title>Tests that a track appended after the initial track configuration does not change other tracks.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<title>A track appended after the initial track configuration does not change other tracks</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track kind="metadata" src="captions-webvtt/metadata.vtt">
<track kind="metadata" src="resources/metadata.vtt">
</video>
<script>
async_test(function(t) {
......@@ -14,7 +14,7 @@ async_test(function(t) {
assert_equals(track1.readyState, HTMLTrackElement.NONE);
assert_equals(track1.track.mode, 'disabled');
video.src = findMediaFile('video', '../content/test');
video.src = getVideoURI('/media/test');
video.oncanplaythrough = t.step_func(canplaythrough);
track1.onload = t.step_func(metadataTrackLoaded);
......@@ -37,7 +37,7 @@ async_test(function(t) {
track2 = document.createElement('track');
track2.setAttribute('kind', 'captions');
track2.setAttribute('default', 'default');
track2.setAttribute('src', 'captions-webvtt/tc004-webvtt-file.vtt');
track2.setAttribute('src', 'resources/webvtt-file.vtt');
track2.onload = t.step_func(captionsTrackLoaded);
video.appendChild(track2);
}
......
<!DOCTYPE html>
<title>Tests that a "metadata" track does not load automatically, but does load when the mode is changed.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<title>A "metadata" track does not load automatically, but it does load when the mode is changed</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track kind="metadata" src="captions-webvtt/metadata.vtt">
<track kind="metadata" src="resources/metadata.vtt">
</video>
<script>
async_test(function(t) {
......@@ -15,7 +15,7 @@ async_test(function(t) {
assert_equals(track.readyState, HTMLTrackElement.NONE);
assert_equals(video.textTracks[0].mode, "disabled");
video.src = findMediaFile("video", "../content/test");
video.src = getVideoURI("/media/test");
video.oncanplaythrough = t.step_func(canplaythrough);
track.onload = t.step_func_done(trackLoaded);
......
<!DOCTYPE html>
<title>TextTrack mode attribute</title>
<script src="/common/media.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video>
<track src="resources/captions-fast.vtt" default>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = document.querySelector("track");
track.onload = t.step_func(trackLoaded);
var cueCount = 0;
var textTrack;
function trackLoaded() {
textTrack = track.track;
// Test default attribute value.
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to bogus value, should return default.
var value = "bogus";
textTrack.mode = value;
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to numeric value (no longer supported), should return default.
textTrack.mode = 2;
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to known values.
setModeAndCheck("disabled");
video.src = getVideoURI("/media/test");
video.play();
// Wait for end of first cue (no events should fire while track is disabled).
t.step_timeout(testHiddenAndShowing, 400);
}
track.oncuechange = t.step_func(function(event) {
cueCount++;
if (cueCount == textTrack.cues.length)
t.done();
});
function setModeAndCheck(value) {
textTrack.mode = value;
assert_equals(textTrack.mode, value);
assert_equals(video.textTracks[0].mode, value);
if (value == "disabled")
assert_equals(textTrack.cues, null);
}
function testHiddenAndShowing() {
setModeAndCheck("hidden");
setModeAndCheck("showing");
}
});
</script>
</video>
\ No newline at end of file
<!DOCTYPE html>
<title>Tests that a very large timestamp is parsed correctly.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video>
<track src="captions-webvtt/large-timestamp.vtt" default>
</video>
<script>
async_test(function(t) {
var testTrack = document.querySelector("track");
testTrack.onload = t.step_func_done(function() {
assert_equals(testTrack.track.cues.length, 1);
var cue = testTrack.track.cues[0];
assert_equals(parseInt(cue.id), 1);
assert_equals(cue.startTime / 3600, 1234567);
assert_equals(cue.endTime / 3600, 1234567890);
});
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<title>Tests that cues are properly removed from the active cue list when their track changes mode to disabled.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video>
<track src="captions-webvtt/captions-gaps.vtt" kind="captions" default >
</video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var testTrack = document.querySelector("track");
video.src = findMediaFile("video", "../content/counting");
video.oncanplaythrough = t.step_func(startTest);
video.onseeked = t.step_func_done(seeked);
function startTest() {
// Set the mode of the text track to showing.
testTrack.track.mode = "showing";
// Seek to a time with a caption.
video.currentTime = 1.5;
}
function seeked() {
// Set the mode of the text track to hidden, then showing again.
testTrack.track.mode = "hidden";
testTrack.track.mode = "showing";
// Set the mode of the text track to disabled.
testTrack.track.mode = "disabled";
// No crash, PASS.
}
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<title>Tests that the TextTrack mode attribute is appropriately set.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video>
<track src="captions-webvtt/captions-fast.vtt" default>
</video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
var track = document.querySelector("track");
track.onload = t.step_func(trackLoaded);
var cueCount = 0;
var textTrack;
function trackLoaded() {
textTrack = track.track;
// Test default attribute value.
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to bogus value, should return default.
var value = "bogus";
textTrack.mode = value;
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to numeric value (no longer supported), should return default.
textTrack.mode = 2;
assert_equals(textTrack.mode, "showing");
assert_equals(video.textTracks[0].mode, "showing");
// Set to known values.
setModeAndCheck("disabled");
video.src = findMediaFile("video", "../content/test");
video.play();
// Wait for end of first cue (no events should fire while track is disabled).
setTimeout(testHiddenAndShowing, 400);
}
track.oncuechange = t.step_func(function(event) {
cueCount++;
if (cueCount == textTrack.cues.length)
t.done();
});
function setModeAndCheck(value) {
textTrack.mode = value;
assert_equals(textTrack.mode, value);
assert_equals(video.textTracks[0].mode, value);
if (value == "disabled")
assert_equals(textTrack.cues, null);
}
function testHiddenAndShowing() {
setModeAndCheck("hidden");
setModeAndCheck("showing");
}
});
</script>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment