Skip to content

Commit

Permalink
Merge 4d63465 into 17c790c
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev authored Jul 20, 2017
2 parents 17c790c + 4d63465 commit 4c0bd4b
Showing 1 changed file with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!doctype html>
<title>HTMLMediaElement.removeTextTrack</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
var video = document.createElement('video');
test(function(){
var t = video.addTextTrack('captions');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 1);
video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' captions');

test(function(){
var t = video.addTextTrack('subtitles');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 1);
video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' subtitles');

test(function(){
var t = video.addTextTrack('chapters');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 1);
video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' chapters');

test(function(){
var t = video.addTextTrack('metadata');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 1);
video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' metadata');

test(function(){
var t = video.addTextTrack('descriptions');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 1);
video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' descriptions');

test(function(){
var t = document.createElement('track').track;
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
assert_throws('NOT_FOUND_ERROR', function() {
video.removeTextTrack(t);
}, 'standalone');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' orphaned track');


test(function() {
var tel = document.createElement('track');
video.appendChild(tel);
assert_equals(video.textTracks.length, 1);
assert_true(video.contains(tel));
video.removeTextTrack(tel.track);
assert_false(video.contains(tel));
assert_equals(video.textTracks.length, 0);

}, document.title + ' also remove associated track element');
</script>

0 comments on commit 4c0bd4b

Please sign in to comment.