1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<!doctype html>
<title>HTMLMediaElement.addTextTrack</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(){
assert_throws(new TypeError(), function(){
video.addTextTrack('foo');
});
assert_throws(new TypeError(), function(){
video.addTextTrack(undefined);
});
assert_throws(new TypeError(), function(){
video.addTextTrack(null);
});
}, document.title + ' bogus first arg');
test(function(){
assert_throws(new TypeError(), function(){
video.addTextTrack('SUBTITLES');
});
}, document.title + ' uppercase first arg');
test(function(){
var t = video.addTextTrack('subtitles');
assert_equals(t.kind, 'subtitles');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' subtitles first arg');
test(function(){
var t = video.addTextTrack('captions');
assert_equals(t.kind, 'captions');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' captions first arg');
test(function(){
var t = video.addTextTrack('descriptions');
assert_equals(t.kind, 'descriptions');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' descriptions first arg');
test(function(){
var t = video.addTextTrack('chapters');
assert_equals(t.kind, 'chapters');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' chapters first arg');
test(function(){
var t = video.addTextTrack('metadata');
assert_equals(t.kind, 'metadata');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' metadata first arg');
test(function(){
var t = video.addTextTrack('subtitles', undefined, undefined);
assert_equals(t.kind, 'subtitles');
assert_equals(t.label, '');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' undefined second and third arg');
test(function(){
var t = video.addTextTrack('subtitles', null, null);
assert_equals(t.kind, 'subtitles');
assert_equals(t.label, 'null');
assert_equals(t.language, 'null');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' null second and third arg');
test(function(){
var t = video.addTextTrack('subtitles', 'foo', 'bar');
assert_equals(t.kind, 'subtitles');
assert_equals(t.label, 'foo');
assert_equals(t.language, 'bar');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' foo and bar second and third arg');
test(function(){
var t = video.addTextTrack('subtitles', 'foo');
assert_equals(t.kind, 'subtitles');
assert_equals(t.label, 'foo');
assert_equals(t.language, '');
assert_equals(t.mode, 'hidden');
assert_true(t.cues instanceof TextTrackCueList);
assert_equals(t.cues.length, 0);
}, document.title + ' foo second arg, third arg omitted');
</script>
|