mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,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>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>HTMLMediaElement.textTracks</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_equals(video.textTracks, video.textTracks);
|
||||
assert_equals(video.textTracks.length, 0);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.default</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track['default'], false);
|
||||
assert_equals(track.getAttribute('default'), null);
|
||||
}, document.title + ' missing value');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('default', '');
|
||||
assert_equals(track['default'], true);
|
||||
assert_equals(track.getAttribute('default'), '');
|
||||
}, document.title + ' empty string content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track['default'] = '';
|
||||
assert_equals(track['default'], false);
|
||||
assert_equals(track.getAttribute('default'), null);
|
||||
}, document.title + ' empty string IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('default', 'foo');
|
||||
assert_equals(track['default'], true);
|
||||
assert_equals(track.getAttribute('default'), 'foo');
|
||||
}, document.title + ' foo in content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track['default'] = 'foo';
|
||||
assert_equals(track['default'], true);
|
||||
assert_equals(track.getAttribute('default'), '');
|
||||
}, document.title + ' foo in IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track['default'] = true;
|
||||
assert_equals(track['default'], true);
|
||||
assert_equals(track.getAttribute('default'), '');
|
||||
}, document.title + ' true in IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('default', '');
|
||||
track['default'] = false;
|
||||
assert_equals(track['default'], false);
|
||||
assert_equals(track.getAttribute('default'), null);
|
||||
}, document.title + ' false in IDL attribute');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.kind</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.kind, 'subtitles');
|
||||
assert_equals(track.getAttribute('kind'), null);
|
||||
}, document.title + ' missing value');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'invalid');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
assert_equals(track.getAttribute('kind'), 'invalid');
|
||||
}, document.title + ' invalid value in content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'CAPTIONS');
|
||||
assert_equals(track.kind, 'captions');
|
||||
assert_equals(track.getAttribute('kind'), 'CAPTIONS');
|
||||
}, document.title + ' content attribute uppercase');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'CAPT\u0130ONS');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
assert_equals(track.getAttribute('kind'), 'CAPT\u0130ONS');
|
||||
}, document.title + ' content attribute with uppercase turkish I (with dot)');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'capt\u0131ons');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
assert_equals(track.getAttribute('kind'), 'capt\u0131ons');
|
||||
}, document.title + ' content attribute with lowercase turkish i (dotless)');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'subtitles');
|
||||
assert_equals(track.kind, 'subtitles');
|
||||
assert_equals(track.getAttribute('kind'), 'subtitles');
|
||||
}, document.title + ' content attribute "subtitles"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'captions');
|
||||
assert_equals(track.kind, 'captions');
|
||||
assert_equals(track.getAttribute('kind'), 'captions');
|
||||
}, document.title + ' content attribute "captions"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'descriptions');
|
||||
assert_equals(track.kind, 'descriptions');
|
||||
assert_equals(track.getAttribute('kind'), 'descriptions');
|
||||
}, document.title + ' content attribute "descriptions"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'chapters');
|
||||
assert_equals(track.kind, 'chapters');
|
||||
assert_equals(track.getAttribute('kind'), 'chapters');
|
||||
}, document.title + ' content attribute "chapters"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'metadata');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
assert_equals(track.getAttribute('kind'), 'metadata');
|
||||
}, document.title + ' content attribute "metadata"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'captions\u0000');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
assert_equals(track.getAttribute('kind'), 'captions\u0000');
|
||||
}, document.title + ' content attribute "captions\\u0000"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'subtitles';
|
||||
assert_equals(track.getAttribute('kind'), 'subtitles');
|
||||
assert_equals(track.kind, 'subtitles');
|
||||
}, document.title + ' setting IDL attribute to "subtitles"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'captions';
|
||||
assert_equals(track.getAttribute('kind'), 'captions');
|
||||
assert_equals(track.kind, 'captions');
|
||||
}, document.title + ' setting IDL attribute to "captions"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'descriptions';
|
||||
assert_equals(track.getAttribute('kind'), 'descriptions');
|
||||
assert_equals(track.kind, 'descriptions');
|
||||
}, document.title + ' setting IDL attribute to "descriptions"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'chapters';
|
||||
assert_equals(track.getAttribute('kind'), 'chapters');
|
||||
assert_equals(track.kind, 'chapters');
|
||||
}, document.title + ' setting IDL attribute to "chapters"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'metadata';
|
||||
assert_equals(track.getAttribute('kind'), 'metadata');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
}, document.title + ' setting IDL attribute to "metadata"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'CAPTIONS';
|
||||
assert_equals(track.getAttribute('kind'), 'CAPTIONS');
|
||||
assert_equals(track.kind, 'captions');
|
||||
}, document.title + ' setting IDL attribute to "CAPTIONS"');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'CAPT\u0130ONS';
|
||||
assert_equals(track.getAttribute('kind'), 'CAPT\u0130ONS');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
}, document.title + ' setting IDL attribute with uppercase turkish I (with dot)');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'capt\u0131ons';
|
||||
assert_equals(track.getAttribute('kind'), 'capt\u0131ons');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
}, document.title + ' setting IDL attribute with lowercase turkish I (dotless)');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'captions\u0000';
|
||||
assert_equals(track.getAttribute('kind'), 'captions\u0000');
|
||||
assert_equals(track.kind, 'metadata');
|
||||
}, document.title + ' setting IDL attribute with \\u0000');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.label</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.label, '');
|
||||
assert_equals(track.getAttribute('label'), null);
|
||||
}, document.title + ' missing value');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('label', '');
|
||||
assert_equals(track.label, '');
|
||||
assert_equals(track.getAttribute('label'), '');
|
||||
}, document.title + ' empty string content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.label = '';
|
||||
assert_equals(track.label, '');
|
||||
assert_equals(track.getAttribute('label'), '');
|
||||
}, document.title + ' empty string IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('label', 'foo');
|
||||
assert_equals(track.label, 'foo');
|
||||
assert_equals(track.getAttribute('label'), 'foo');
|
||||
}, document.title + ' lowercase content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('label', 'FOO');
|
||||
assert_equals(track.label, 'FOO');
|
||||
assert_equals(track.getAttribute('label'), 'FOO');
|
||||
}, document.title + ' uppercase content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('label', '\u0000');
|
||||
assert_equals(track.label, '\u0000');
|
||||
assert_equals(track.getAttribute('label'), '\u0000');
|
||||
}, document.title + '\\u0000 in content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.label = 'foo';
|
||||
assert_equals(track.label, 'foo');
|
||||
assert_equals(track.getAttribute('label'), 'foo');
|
||||
}, document.title + ' lowercase IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.label = 'FOO';
|
||||
assert_equals(track.label, 'FOO');
|
||||
assert_equals(track.getAttribute('label'), 'FOO');
|
||||
}, document.title + ' uppercase IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('label', ' foo \n');
|
||||
assert_equals(track.label, ' foo \n');
|
||||
assert_equals(track.getAttribute('label'), ' foo \n');
|
||||
}, document.title + ' whitespace in content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.label = ' foo \n';
|
||||
assert_equals(track.label, ' foo \n');
|
||||
assert_equals(track.getAttribute('label'), ' foo \n');
|
||||
}, document.title + ' whitespace in IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.label = '\u0000';
|
||||
assert_equals(track.label, '\u0000');
|
||||
assert_equals(track.getAttribute('label'), '\u0000');
|
||||
}, document.title + ' \\u0000 in IDL attribute');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.readyState</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.readyState, 0);
|
||||
}, document.title + ' default value');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.src</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.src, '');
|
||||
assert_equals(track.getAttribute('src'), null);
|
||||
}, document.title + ' missing value');
|
||||
|
||||
function resolve(url) {
|
||||
var link = document.createElement('a');
|
||||
link.setAttribute('href', url);
|
||||
return link.href;
|
||||
}
|
||||
|
||||
var tests = [
|
||||
{input:'', expectedIDL:resolve(''), desc:'empty string'},
|
||||
{input:'http://foo bar', expectedIDL:'http://foo bar', desc:'unresolvable value'},
|
||||
{input:'test', expectedIDL:resolve('test'), desc:'resolvable value'},
|
||||
// Leading and trailing C0 controls and space is stripped per url spec.
|
||||
{input:'\u0000', expectedIDL:resolve(''), desc:'\\u0000'},
|
||||
{input:'foo\u0000bar', expectedIDL:resolve('foo%00bar'), desc:'foo\\u0000bar'},
|
||||
];
|
||||
|
||||
tests.forEach(function(t) {
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('src', t.input);
|
||||
assert_equals(track.src, t.expectedIDL);
|
||||
assert_equals(track.getAttribute('src'), t.input);
|
||||
}, [document.title, t.desc, 'in content attribute'].join(' '));
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.src = t.input;
|
||||
assert_equals(track.src, t.expectedIDL);
|
||||
assert_equals(track.getAttribute('src'), t.input);
|
||||
}, [document.title, 'assigning', t.desc, 'to IDL attribute'].join(' '));
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.srclang</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.srclang, '');
|
||||
assert_equals(track.getAttribute('srclang'), null);
|
||||
}, document.title + ' missing value');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('srclang', '');
|
||||
assert_equals(track.srclang, '');
|
||||
assert_equals(track.getAttribute('srclang'), '');
|
||||
}, document.title + ' empty string content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.srclang = '';
|
||||
assert_equals(track.srclang, '');
|
||||
assert_equals(track.getAttribute('srclang'), '');
|
||||
}, document.title + ' empty string IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('srclang', 'foo');
|
||||
assert_equals(track.srclang, 'foo');
|
||||
assert_equals(track.getAttribute('srclang'), 'foo');
|
||||
}, document.title + ' lowercase content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('srclang', 'FOO');
|
||||
assert_equals(track.srclang, 'FOO');
|
||||
assert_equals(track.getAttribute('srclang'), 'FOO');
|
||||
}, document.title + ' uppercase content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('srclang', '\u0000');
|
||||
assert_equals(track.srclang, '\u0000');
|
||||
assert_equals(track.getAttribute('srclang'), '\u0000');
|
||||
}, document.title + ' \\u0000 content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.srclang = 'foo';
|
||||
assert_equals(track.srclang, 'foo');
|
||||
assert_equals(track.getAttribute('srclang'), 'foo');
|
||||
}, document.title + ' lowercase IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.srclang = 'FOO';
|
||||
assert_equals(track.srclang, 'FOO');
|
||||
assert_equals(track.getAttribute('srclang'), 'FOO');
|
||||
}, document.title + ' uppercase IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('srclang', ' foo \n');
|
||||
assert_equals(track.srclang, ' foo \n');
|
||||
assert_equals(track.getAttribute('srclang'), ' foo \n');
|
||||
}, document.title + ' whitespace in content attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.srclang = ' foo \n';
|
||||
assert_equals(track.srclang, ' foo \n');
|
||||
assert_equals(track.getAttribute('srclang'), ' foo \n');
|
||||
}, document.title + ' whitespace in IDL attribute');
|
||||
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.srclang = '\u0000';
|
||||
assert_equals(track.srclang, '\u0000');
|
||||
assert_equals(track.getAttribute('srclang'), '\u0000');
|
||||
}, document.title + ' \\u0000 in IDL attribute');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<title>HTMLTrackElement.track</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.track, track.track, 'same object should be returned');
|
||||
assert_true(track.track instanceof TextTrack, 'returned object should be a TextTrack');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.activeCues</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/common/media.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
window.track = document.createElement('track');
|
||||
track['default'] = true;
|
||||
video.appendChild(track);
|
||||
window.t2 = track.track;
|
||||
t2.mode = 'showing';
|
||||
window.t1_cues = t1.activeCues;
|
||||
window.t2_cues = t2.activeCues;
|
||||
document.body.appendChild(video);
|
||||
if (!t1)
|
||||
throw new Error('t1 was undefined')
|
||||
}, {timeout:25000});
|
||||
function smoke_test() {
|
||||
assert_true('HTMLTrackElement' in window, 'track not supported');
|
||||
}
|
||||
|
||||
test(function(){
|
||||
smoke_test();
|
||||
assert_equals(t1.activeCues, t1_cues, 't1.activeCues should return same object');
|
||||
assert_equals(t2.activeCues, t2_cues, 't2.activeCues should return same object');
|
||||
assert_not_equals(t1.activeCues, t2.activeCues, 't1.activeCues and t2.activeCues should be different objects');
|
||||
assert_not_equals(t1.activeCues, null, 't1.activeCues should not be null');
|
||||
assert_not_equals(t2.activeCues, null, 't2.activeCues should not be null');
|
||||
assert_equals(t1.activeCues.length, 0, 't1.activeCues should have length 0');
|
||||
assert_equals(t2.activeCues.length, 0, 't2.activeCues should have length 0');
|
||||
}, document.title+', empty list');
|
||||
test(function(){
|
||||
smoke_test();
|
||||
var c = new VTTCue(0, 1, "text");
|
||||
t1.addCue(c);
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return same object");
|
||||
assert_equals(t1.activeCues.length, 0, "t1.activeCues.length");
|
||||
var c2 = new VTTCue(1, 2, "text2");
|
||||
t1.addCue(c2);
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return the same object after adding a second cue");
|
||||
assert_equals(t1.activeCues.length, 0, "t1.activeCues.length after adding a second cue");
|
||||
}, document.title+', after addCue()');
|
||||
test(function(){
|
||||
smoke_test();
|
||||
t1.mode = 'showing';
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return the same object after setting mode to showing");
|
||||
t1.mode = 'hidden';
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return the same object after setting mode to hidden");
|
||||
t1.mode = 'disabled';
|
||||
assert_equals(t1.activeCues, null, "t1.activeCues should be null when mode is disabled");
|
||||
assert_equals(t1_cues.length, 0, "t1_cues should still be intact after setting mode to disabled");
|
||||
}, document.title+', different modes');
|
||||
|
||||
// ok now let's load in a video
|
||||
var test1 = async_test(document.title+', video loading', {timeout:20000});
|
||||
var test2 = async_test(document.title+', video playing', {timeout:20000});
|
||||
var test3 = async_test(document.title+', adding cue during playback', {timeout:20000});
|
||||
test1.step(smoke_test);
|
||||
test2.step(smoke_test);
|
||||
test3.step(smoke_test);
|
||||
test1.step(function(){
|
||||
t1.mode = 'showing';
|
||||
video.onloadeddata = test1.step_func(function(e) {
|
||||
video.onplaying = test2.step_func(function(e) {
|
||||
try {
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return the same object after playing a video");
|
||||
assert_equals(t1.activeCues.length, 1, "t1.activeCues.length after the video has started playing");
|
||||
} catch(ex) {
|
||||
test2.step(function() { throw ex; });
|
||||
test3.step(function() { assert_unreached(); });
|
||||
return;
|
||||
}
|
||||
test3.step(function(){
|
||||
var c3 = new VTTCue(0, 2, "text3");
|
||||
t1.addCue(c3);
|
||||
assert_equals(t1.activeCues.length, 1, "t1.activeCues.length after adding a cue in the same script");
|
||||
setTimeout(test3.step_func(function(){
|
||||
assert_equals(t1.activeCues.length, 2, "t1.activeCues.length after the event loop has spun");
|
||||
test3.done();
|
||||
}, 0));
|
||||
});
|
||||
test2.done();
|
||||
});
|
||||
try {
|
||||
assert_equals(t1.activeCues, t1_cues, "t1.activeCues should return the same object after loading a video");
|
||||
assert_equals(t2.activeCues, t2_cues, "t2.activeCues should return the same object after loading a video");
|
||||
assert_equals(t1.activeCues.length, 0, "t1.activeCues.length before the video has started playing");
|
||||
assert_equals(t2.activeCues.length, 0, "t1.activeCues.length before the video has started playing");
|
||||
} catch(ex) {
|
||||
test1.step(function() { throw ex; });
|
||||
test2.step(function() { assert_unreached(); });
|
||||
test3.step(function() { assert_unreached(); });
|
||||
return;
|
||||
}
|
||||
video.play();
|
||||
test1.done();
|
||||
});
|
||||
video.src = getVideoURI("/media/movie_5");
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.addCue()</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
}, {timeout:5000});
|
||||
test(function() {
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t2 = video.addTextTrack('subtitles');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
t2.addCue(c1);
|
||||
assert_equals(c1.track, t2);
|
||||
}, document.title+', adding a cue to two different tracks');
|
||||
test(function() {
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(c1.track, t1);
|
||||
t1.addCue(c1);
|
||||
assert_equals(c1.track, t1);
|
||||
}, document.title+', adding a cue to a track twice');
|
||||
test(function() {
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t2 = video.addTextTrack('subtitles');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(c1.track, t1);
|
||||
t1.removeCue(c1);
|
||||
assert_equals(c1.track, null);
|
||||
t2.addCue(c1);
|
||||
assert_equals(c1.track, t2);
|
||||
}, document.title+', adding a removed cue to a different track');
|
||||
test(function() {
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(t1.cues.length, 1, 't1.cues.length after first addition');
|
||||
t1.removeCue(c1);
|
||||
assert_equals(t1.cues.length, 0, 't1.cues.length after removal');
|
||||
t1.addCue(c1);
|
||||
assert_equals(t1.cues.length, 1, 't1.cues.length after second addition');
|
||||
}, document.title+', adding an associated but removed cue to the same track');
|
||||
|
||||
var t = async_test(document.title+', adding a cue associated with a track element to other track');
|
||||
t.step(function(){
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var track = document.createElement('track');
|
||||
track.onload = t.step_func(function(){
|
||||
var cue = track.track.cues[0];
|
||||
track.track.removeCue(cue);
|
||||
t1.addCue(cue);
|
||||
assert_equals(cue.track, t1);
|
||||
t.done();
|
||||
});
|
||||
track.onerror = t.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
track.src= 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:01.000\ntest\n');
|
||||
track.kind = 'subtitles';
|
||||
track.track.mode = 'hidden';
|
||||
video.appendChild(track);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack constants</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(t1.DISABLED, undefined, "t1.DISABLED");
|
||||
assert_equals(t1.HIDDEN, undefined, "t1.HIDDEN");
|
||||
assert_equals(t1.SHOWING, undefined, "t1.SHOWING");
|
||||
assert_equals(TextTrack.prototype.DISABLED, undefined, "TextTrack.prototype.DISABLED");
|
||||
assert_equals(TextTrack.prototype.HIDDEN, undefined, "TextTrack.prototype.HIDDEN");
|
||||
assert_equals(TextTrack.prototype.SHOWING, undefined, "TextTrack.prototype.SHOWING");
|
||||
assert_equals(TextTrack.DISABLED, undefined, "TextTrack.DISABLED");
|
||||
assert_equals(TextTrack.HIDDEN, undefined, "TextTrack.HIDDEN");
|
||||
assert_equals(TextTrack.SHOWING, undefined, "TextTrack.SHOWING");
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.cues</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
assert_equals(t1.cues, t1.cues, 't1.cues should return same object');
|
||||
assert_not_equals(t1.cues, null, 't1.cues should not be null');
|
||||
assert_true(t1.cues instanceof TextTrackCueList, 't1.cues instanceof TextTrackCueList');
|
||||
assert_equals(t1.cues.length, 0, 't1.cues.length');
|
||||
}, document.title+', empty list');
|
||||
|
||||
function addCue(texttrack, start, end, text, id) {
|
||||
var c = new VTTCue(start, end, text);
|
||||
c.id = id;
|
||||
texttrack.addCue(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t1_cues = t1.cues;
|
||||
var c = addCue(t1, 0, 1, 'text', 'id');
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return same object");
|
||||
assert_equals(t1.cues.length, 1, "t1.cues.length");
|
||||
var c2 = addCue(t1, 1, 2, 'text2', 'id2');
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after adding a second cue");
|
||||
assert_equals(t1.cues.length, 2, "t1.cues.length after adding a second cue");
|
||||
assert_equals(t1.cues[0].id, "id");
|
||||
assert_equals(t1.cues[1].id, "id2");
|
||||
}, document.title+', after addCue()');
|
||||
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t1_cues = t1.cues;
|
||||
var c = addCue(t1, 0, 1, 'text', 'id');
|
||||
var c2 = addCue(t1, 1, 2, 'text2', 'id2');
|
||||
t1.mode = 'showing';
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after setting mode to 'showing'");
|
||||
t1.mode = 'hidden';
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after setting mode to 'hidden'");
|
||||
t1.mode = 'disabled';
|
||||
assert_equals(t1.cues, null, "t1.cues should be null when mode is 'disabled'");
|
||||
assert_equals(t1_cues.length, 2, "t1_cues should still be intact after setting mode to 'disabled'");
|
||||
assert_equals(t1_cues[0].id, "id", "t1_cues first cue should still be intact after setting mode to 'disabled'");
|
||||
assert_equals(t1_cues[1].id, "id2", "t1_cues second cue should still be intact after setting mode to 'disabled'");
|
||||
t1.mode = 'hidden';
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after setting mode to 'disabled' and then 'hidden'");
|
||||
t1.mode = 'disabled';
|
||||
assert_equals(t1.cues, null, "t1.cues should be null when mode is set to 'disabled' again");
|
||||
assert_equals(t1_cues.length, 2, "t1_cues should still be intact after setting mode to 'disabled' again");
|
||||
assert_equals(t1_cues[0].id, "id", "t1_cues first cue should still be intact after setting mode to 'disabled' again");
|
||||
assert_equals(t1_cues[1].id, "id2", "t1_cues second cue should still be intact after setting mode to 'disabled' again");
|
||||
t1.mode = 'showing';
|
||||
assert_equals(t1.cues, t1_cues, "t1.cues should return the same object after setting mode to 'disabled' and then 'showing'");
|
||||
}, document.title+', different modes');
|
||||
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t1_cues = t1.cues;
|
||||
var c = addCue(t1, 0, 1, 'text', 'id');
|
||||
var c2 = addCue(t1, 1, 2, 'text2', 'id2');
|
||||
t1.mode = 'showing';
|
||||
t1.cues[1].startTime = 0; // this should change the text track cue order
|
||||
assert_equals(t1.cues[0].id, 'id2');
|
||||
assert_equals(t1.cues[1].id, 'id');
|
||||
t1.cues[0].startTime = 0.5; // this should change it back
|
||||
assert_equals(t1.cues[0].id, 'id');
|
||||
assert_equals(t1.cues[1].id, 'id2');
|
||||
}, document.title+', changing order');
|
||||
|
||||
async_test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t1_cues = t1.cues;
|
||||
t1.mode = 'hidden';
|
||||
var track = document.createElement('track');
|
||||
track['default'] = true;
|
||||
video.appendChild(track); // queues a task to "honor user preferences...", media element event task source
|
||||
var t2 = track.track;
|
||||
assert_equals(t2.cues, null, 't2.cues should be null');
|
||||
// We need to wait until the "honor user preferences..." steps have run so we invoke play()
|
||||
// which queues an event with the same task source.
|
||||
video.onplay = this.step_func(function(){
|
||||
assert_equals(t2.cues, t2.cues, 't2.cues should return same object');
|
||||
assert_not_equals(t1.cues, t2.cues, 't1.cues and t2.cues should be different objects');
|
||||
assert_not_equals(t2.cues, null, 't2.cues should not be null');
|
||||
assert_true(t2.cues instanceof TextTrackCueList, 't2.cues instanceof TextTrackCueList');
|
||||
assert_equals(t2.cues.length, 0, 't2.cues should have length 0');
|
||||
this.done();
|
||||
});
|
||||
video.play(); // queues a task to fire 'play', media element event task source
|
||||
}, document.title+', default attribute');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.kind</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t2 = video.addTextTrack('captions');
|
||||
var t3 = video.addTextTrack('descriptions');
|
||||
var t4 = video.addTextTrack('chapters');
|
||||
var t5 = video.addTextTrack('metadata');
|
||||
assert_equals(t1.kind, 'subtitles');
|
||||
assert_equals(t2.kind, 'captions');
|
||||
assert_equals(t3.kind, 'descriptions');
|
||||
assert_equals(t4.kind, 'chapters');
|
||||
assert_equals(t5.kind, 'metadata');
|
||||
}, document.title+', addTextTrack');
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.setAttribute('kind', 'CAPTIONS');
|
||||
var t = track.track;
|
||||
assert_equals(t.kind, 'captions');
|
||||
}, document.title+', track element');
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
track.kind = 'captions\u0000';
|
||||
assert_equals(track.track.kind, 'metadata');
|
||||
}, document.title+', \\u0000');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.label</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles', 'foo');
|
||||
window.track = document.createElement('track');
|
||||
track.setAttribute('label', 'bar');
|
||||
video.appendChild(track);
|
||||
window.t2 = track.track;
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(t1.label, 'foo');
|
||||
assert_equals(t2.label, 'bar');
|
||||
track.label = 'baz';
|
||||
assert_equals(t2.label, 'baz');
|
||||
track.removeAttribute('label');
|
||||
assert_equals(t2.label, '');
|
||||
});
|
||||
test(function(){
|
||||
track.label = '\u0000a';
|
||||
assert_equals(t2.label, '\u0000a');
|
||||
track.setAttribute('label', '\u0000b', 'IDL attribute');
|
||||
assert_equals(t2.label, '\u0000b', 'content attribute');
|
||||
}, document.title+', \\u0000');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.language</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles', 'foo', 'foo');
|
||||
window.track = document.createElement('track');
|
||||
track.setAttribute('srclang', 'bar');
|
||||
video.appendChild(track);
|
||||
window.t2 = track.track;
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(t1.language, 'foo');
|
||||
assert_equals(t2.language, 'bar');
|
||||
track.srclang = 'baz';
|
||||
assert_equals(t2.language, 'baz');
|
||||
track.removeAttribute('srclang');
|
||||
assert_equals(t2.language, '');
|
||||
});
|
||||
test(function(){
|
||||
track.srclang = '\u0000a';
|
||||
assert_equals(t2.language, '\u0000a', 'IDL attribute');
|
||||
track.setAttribute('srclang', '\u0000b');
|
||||
assert_equals(t2.language, '\u0000b', 'content attribute');
|
||||
}, document.title+', \\u0000');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.mode</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.track.mode, 'disabled', 'initial');
|
||||
track.track.mode = 1;
|
||||
assert_equals(track.track.mode, 'disabled', '1');
|
||||
track.track.mode = '';
|
||||
assert_equals(track.track.mode, 'disabled', '""');
|
||||
track.track.mode = null;
|
||||
assert_equals(track.track.mode, 'disabled', 'null');
|
||||
track.track.mode = undefined;
|
||||
assert_equals(track.track.mode, 'disabled', 'undefined');
|
||||
track.track.mode = 'showing';
|
||||
assert_equals(track.track.mode, 'showing', 'showing (correct value)');
|
||||
track.track.mode = 'DISABLED';
|
||||
assert_equals(track.track.mode, 'showing', '"DISABLED"');
|
||||
track.track.mode = 'd\u0130sabled'; // dotted uppercase i
|
||||
assert_equals(track.track.mode, 'showing', '"d\u0130sabled" (dotted uppercase i)');
|
||||
track.track.mode = 'd\u0131sabled'; // dotless lowercase i
|
||||
assert_equals(track.track.mode, 'showing', '"d\u0131sabled" (dotless lowercase i)');
|
||||
track.track.mode = 'disabled ';
|
||||
assert_equals(track.track.mode, 'showing', '"disabled "');
|
||||
track.track.mode = ' disabled';
|
||||
assert_equals(track.track.mode, 'showing', '" disabled"');
|
||||
track.track.mode = {};
|
||||
assert_equals(track.track.mode, 'showing', '{}');
|
||||
track.track.mode = 'HIDDEN';
|
||||
assert_equals(track.track.mode, 'showing', '"HIDDEN"');
|
||||
track.track.mode = 'h\u0130dden'; // dotted uppercase i
|
||||
assert_equals(track.track.mode, 'showing', '"h\u0130dden" (dotted uppercase i)');
|
||||
track.track.mode = 'h\u0131dden'; // dotless lowercase i
|
||||
assert_equals(track.track.mode, 'showing', '"h\u0131dden" (dotless lowercase i)');
|
||||
}, document.title+', wrong value');
|
||||
test(function() {
|
||||
var track = document.createElement('track');
|
||||
assert_equals(track.track.mode, 'disabled', 'initial');
|
||||
track.track.mode = 'disabled'; // no-op
|
||||
assert_equals(track.track.mode, 'disabled', 'disabled (1)');
|
||||
track.track.mode = 'hidden';
|
||||
assert_equals(track.track.mode, 'hidden', 'hidden (1)');
|
||||
track.track.mode = 'hidden'; // no-op
|
||||
assert_equals(track.track.mode, 'hidden', 'hidden (2)');
|
||||
track.track.mode = 'showing';
|
||||
assert_equals(track.track.mode, 'showing', 'showing (1)');
|
||||
track.track.mode = 'showing'; // no-op
|
||||
assert_equals(track.track.mode, 'showing', 'showing (2)');
|
||||
track.track.mode = {toString:function() { return 'disabled'; }};
|
||||
assert_equals(track.track.mode, 'disabled', '{toString:...}');
|
||||
}, document.title+', correct value');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.oncuechange</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
window.ev = new Event('cuechange');
|
||||
window.ran = false;
|
||||
window.cb = function() { ran = true; };
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(t1.oncuechange, null);
|
||||
t1.oncuechange = cb;
|
||||
t1.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
t1.oncuechange = null;
|
||||
ran = false;
|
||||
t1.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
});
|
||||
test(function(){
|
||||
t1.addEventListener('cuechange', cb, false);
|
||||
t1.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
t1.removeEventListener('cuechange', cb, false);
|
||||
ran = false;
|
||||
t1.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
}, 'TextTrack.addEventListener/removeEventListener');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<!doctype html>
|
||||
<title>TextTrack.removeCue()</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
}, {timeout:5000});
|
||||
test(function() {
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var t2 = video.addTextTrack('subtitles');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_throws("NOT_FOUND_ERR", function() {
|
||||
t1.removeCue(c1);
|
||||
}, 'standalone');
|
||||
t1.addCue(c1);
|
||||
assert_throws("NOT_FOUND_ERR", function() {
|
||||
t2.removeCue(c1);
|
||||
}, 'listed in t1, remove from t2');
|
||||
t1.removeCue(c1);
|
||||
assert_throws("NOT_FOUND_ERR", function() {
|
||||
t1.removeCue(c1);
|
||||
}, 'standalone, remove from t1');
|
||||
assert_throws("NOT_FOUND_ERR", function() {
|
||||
t2.removeCue(c1);
|
||||
}, 'standalone, remove from t2');
|
||||
}, document.title+', two elementless tracks');
|
||||
var t = async_test(document.title+', cue from track element');
|
||||
t.step(function(){
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
var track = document.createElement('track');
|
||||
track.onload = t.step_func(function(){
|
||||
var cue = track.track.cues[0];
|
||||
assert_throws('NOT_FOUND_ERR', function() { t1.removeCue(cue); }, 'listed in track.track, remove from t1');
|
||||
track.track.removeCue(cue);
|
||||
assert_throws('NOT_FOUND_ERR', function() { track.track.removeCue(cue); }, 'standalone, remove from track.track');
|
||||
assert_throws('NOT_FOUND_ERR', function() { t1.removeCue(cue); }, 'standalone, remove from t1');
|
||||
t.done();
|
||||
});
|
||||
track.onerror = t.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
track.src= 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:01.000\ntest\n');
|
||||
track.kind = 'subtitles';
|
||||
track.track.mode = 'hidden';
|
||||
video.appendChild(track);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.endTime</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(-2, -1, 'text1');
|
||||
assert_equals(c1.endTime, -1);
|
||||
c1.endTime = c1.endTime;
|
||||
assert_equals(c1.endTime, -1);
|
||||
assert_throws(new TypeError(), function(){ c1.endTime = NaN; });
|
||||
assert_throws(new TypeError(), function(){ c1.endTime = +Infinity; });
|
||||
assert_throws(new TypeError(), function(){ c1.endTime = -Infinity; });
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c = t.track.cues;
|
||||
assert_equals(c[0].endTime, 0.001);
|
||||
assert_equals(c[1].endTime, 3600.001);
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest'+
|
||||
'\n\nfoobar\n01:00:00.000 --> 01:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.id</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
c1.id = 'id1\r\n\u0000';
|
||||
assert_equals(c1.id, 'id1\r\n\u0000');
|
||||
c1.id = c1.id;
|
||||
assert_equals(c1.id, 'id1\r\n\u0000');
|
||||
c1.id = null;
|
||||
assert_equals(c1.id, 'null');
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c = t.track.cues;
|
||||
assert_equals(c[0].id, '');
|
||||
assert_equals(c[1].id, 'foobar');
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest'+
|
||||
'\n\nfoobar\n00:00:00.000 --> 00:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.onenter</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.c1 = new VTTCue(0, 1, 'text1');
|
||||
window.ev = new Event('enter');
|
||||
window.ran = false;
|
||||
window.cb = function() { ran = true; };
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(c1.onenter, null, 'initial value');
|
||||
c1.onenter = undefined;
|
||||
assert_equals(c1.onenter, null, 'assigning undefined');
|
||||
c1.onenter = cb;
|
||||
assert_equals(c1.onenter, cb, 'assigning onenter');
|
||||
c1.dispatchEvent(ev);
|
||||
assert_true(ran, 'dispatching event');
|
||||
c1.onenter = null;
|
||||
assert_equals(c1.onenter, null, 'assigning null');
|
||||
ran = false;
|
||||
c1.dispatchEvent(ev);
|
||||
assert_false(ran, 'dispatching event after nulling onenter');
|
||||
});
|
||||
test(function(){
|
||||
c1.addEventListener('enter', cb, false);
|
||||
c1.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
c1.removeEventListener('enter', cb, false);
|
||||
ran = false;
|
||||
c1.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
}, 'TextTrackCue.addEventListener/removeEventListener');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.onexit</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.c1 = new VTTCue(0, 1, 'text1');
|
||||
window.ev = new Event('exit');
|
||||
window.ran = false;
|
||||
window.cb = function() { ran = true; };
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(c1.onexit, null, 'initial value');
|
||||
c1.onexit = undefined;
|
||||
assert_equals(c1.onexit, null, 'assigning undefined');
|
||||
c1.onexit = cb;
|
||||
assert_equals(c1.onexit, cb, 'assigning onexit');
|
||||
c1.dispatchEvent(ev);
|
||||
assert_true(ran, 'dispatching event');
|
||||
c1.onexit = null;
|
||||
assert_equals(c1.onexit, null, 'assigning null');
|
||||
ran = false;
|
||||
c1.dispatchEvent(ev);
|
||||
assert_false(ran, 'dispatching event after nulling onexit');
|
||||
});
|
||||
test(function(){
|
||||
c1.addEventListener('exit', cb, false);
|
||||
c1.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
c1.removeEventListener('exit', cb, false);
|
||||
ran = false;
|
||||
c1.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
}, 'TextTrackCue.addEventListener/removeEventListener');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.pauseOnExit</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_equals(c1.pauseOnExit, false);
|
||||
c1.pauseOnExit = null;
|
||||
assert_equals(c1.pauseOnExit, false);
|
||||
c1.pauseOnExit = 'foo';
|
||||
assert_equals(c1.pauseOnExit, true);
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c1 = t.track.cues[0];
|
||||
assert_equals(c1.pauseOnExit, false);
|
||||
c1.pauseOnExit = null;
|
||||
assert_equals(c1.pauseOnExit, false);
|
||||
c1.pauseOnExit = 'foo';
|
||||
assert_equals(c1.pauseOnExit, true);
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.startTime</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(-1, 1, 'text1');
|
||||
assert_equals(c1.startTime, -1);
|
||||
c1.startTime = c1.startTime;
|
||||
assert_equals(c1.startTime, -1);
|
||||
assert_throws(new TypeError(), function(){ c1.startTime = NaN; });
|
||||
assert_throws(new TypeError(), function(){ c1.startTime = +Infinity; });
|
||||
assert_throws(new TypeError(), function(){ c1.startTime = -Infinity; });
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c = t.track.cues;
|
||||
assert_equals(c[0].startTime, 0);
|
||||
assert_equals(c[1].startTime, 3600);
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest'+
|
||||
'\n\nfoobar\n01:00:00.000 --> 01:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCue.track</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_equals(c1.track, null);
|
||||
t1.addCue(c1);
|
||||
assert_equals(c1.track, t1);
|
||||
t1.removeCue(c1);
|
||||
assert_equals(c1.track, null);
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c = t.track.cues[0];
|
||||
assert_equals(c.track, t.track);
|
||||
t.track.removeCue(c);
|
||||
assert_equals(c.track, null);
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCueList.getCueById</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
var cues = t.cues;
|
||||
var c = new VTTCue(0, 1, 'text1');
|
||||
t.addCue(c);
|
||||
assert_equals(cues.getCueById(""), null, '""');
|
||||
assert_equals(cues.getCueById(null), null, 'null');
|
||||
assert_equals(cues.getCueById(undefined), null, 'undefined');
|
||||
}, document.title+ ', no id');
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
var cues = t.cues;
|
||||
var c = new VTTCue(0, 1, 'text1');
|
||||
c.id = 'foo';
|
||||
t.addCue(c);
|
||||
assert_equals(cues.getCueById(""), null, '""');
|
||||
assert_equals(cues.getCueById("foo"), c, '"foo"');
|
||||
assert_equals(cues.getCueById({toString:function(){return "foo"}}), c, 'object');
|
||||
}, document.title+ ', id foo');
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
var cues = t.cues;
|
||||
var c = new VTTCue(0, 1, 'text1');
|
||||
c.id = '1';
|
||||
t.addCue(c);
|
||||
assert_equals(cues.getCueById(""), null, '""');
|
||||
assert_equals(cues.getCueById("1"), c, '"1"');
|
||||
assert_equals(cues.getCueById(1), c, '1');
|
||||
}, document.title+ ', no 1');
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
var cues = t.cues;
|
||||
var c = new VTTCue(0, 1, 'text1');
|
||||
c.id = 'a\u0000b';
|
||||
t.addCue(c);
|
||||
assert_equals(cues.getCueById("a\u0000b"), c, '"a\\u0000b"');
|
||||
assert_equals(cues.getCueById("a"), null, '"a"');
|
||||
}, document.title+ ', id a\\u0000b');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCueList getter</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var cues = t1.cues;
|
||||
assert_equals(cues[0], undefined, 'cues[0] before');
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(cues[0], c1, 'cues[0]');
|
||||
assert_equals(cues[1], undefined, 'cues[1]');
|
||||
assert_equals(cues[-1], undefined, 'cues[-1]');
|
||||
t1.removeCue(c1);
|
||||
assert_equals(cues[0], undefined, 'cues[0] after');
|
||||
});
|
||||
test(function(){
|
||||
var cues = t1.cues;
|
||||
assert_equals(cues[0], undefined);
|
||||
cues[0] = 'foo';
|
||||
assert_equals(cues[0], undefined);
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(cues[0], c1);
|
||||
cues[0] = 'foo';
|
||||
assert_equals(cues[0], c1);
|
||||
t1.removeCue(c1);
|
||||
}, document.title+', no indexed set/create');
|
||||
test(function(){
|
||||
'use strict';
|
||||
var cues = t1.cues;
|
||||
assert_equals(cues[0], undefined);
|
||||
assert_throws(new TypeError(), function() { cues[0] = 'foo'; });
|
||||
assert_equals(cues[0], undefined);
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(cues[0], c1);
|
||||
assert_throws(new TypeError(), function() { cues[0] = 'foo'; });
|
||||
assert_equals(cues[0], c1);
|
||||
t1.removeCue(c1);
|
||||
}, document.title+', no indexed set/create (strict)');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackCueList.length</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var cues = t1.cues;
|
||||
assert_equals(cues.length, 0);
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
t1.addCue(c1);
|
||||
assert_equals(cues.length, 1);
|
||||
t1.removeCue(c1);
|
||||
assert_equals(cues.length, 0);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackList.getTrackById</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var track1 = video.addTextTrack('subtitles');
|
||||
var track2 = video.addTextTrack('subtitles');
|
||||
assert_equals(track1.id, '');
|
||||
assert_equals(track2.id, '');
|
||||
assert_equals(video.textTracks.getTrackById(''), track1);
|
||||
assert_equals(video.textTracks.getTrackById('fake-id'), null);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackList getter</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
video.addTextTrack('subtitles', 'b');
|
||||
window.track = document.createElement('track');
|
||||
track.label = 'a';
|
||||
video.appendChild(track);
|
||||
video.addTextTrack('subtitles', 'c');
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(video.textTracks[0].label, 'a');
|
||||
assert_equals(video.textTracks[1].label, 'b');
|
||||
assert_equals(video.textTracks[2].label, 'c');
|
||||
});
|
||||
test(function(){
|
||||
var track_before = video.textTracks[0];
|
||||
video.textTracks[0] = 'foo';
|
||||
assert_equals(video.textTracks[0], track_before);
|
||||
}, document.title+', no indexed set/create');
|
||||
test(function(){
|
||||
'use strict';
|
||||
var track_before = video.textTracks[0];
|
||||
assert_throws(new TypeError(), function(){ video.textTracks[0] = 'foo'; });
|
||||
assert_equals(video.textTracks[0], track_before);
|
||||
}, document.title+', no indexed set/create (strict)');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackList.length</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
video.addTextTrack('subtitles');
|
||||
window.track = document.createElement('track');
|
||||
video.appendChild(track);
|
||||
video.addTextTrack('subtitles');
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(video.textTracks.length, 3);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackList.onaddtrack</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.tracks = document.createElement('video').textTracks;
|
||||
window.ev = new Event('addtrack');
|
||||
window.ran = false;
|
||||
window.cb = function() { ran = true; };
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(tracks.onaddtrack, null);
|
||||
tracks.onaddtrack = cb;
|
||||
assert_equals(tracks.onaddtrack, cb);
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
tracks.onaddtrack = null;
|
||||
ran = false;
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
});
|
||||
test(function(){
|
||||
tracks.addEventListener('addtrack', cb, false);
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
tracks.removeEventListener('addtrack', cb, false);
|
||||
ran = false;
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
}, 'TextTrackList.addEventListener/removeEventListener');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<title>TextTrackList.onremovetrack</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.tracks = document.createElement('video').textTracks;
|
||||
window.ev = new Event('removetrack');
|
||||
window.ran = false;
|
||||
window.cb = function() { ran = true; };
|
||||
});
|
||||
test(function(){
|
||||
assert_equals(tracks.onremovetrack, null);
|
||||
tracks.onremovetrack = cb;
|
||||
assert_equals(tracks.onremovetrack, cb);
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
tracks.onremovetrack = null;
|
||||
ran = false;
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
});
|
||||
test(function(){
|
||||
tracks.addEventListener('removetrack', cb, false);
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_true(ran);
|
||||
tracks.removeEventListener('removetrack', cb, false);
|
||||
ran = false;
|
||||
tracks.dispatchEvent(ev);
|
||||
assert_false(ran);
|
||||
}, 'TextTrackList.addEventListener/removeEventListener');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<title>TrackEvent constructor</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var ev = new TrackEvent('foo');
|
||||
assert_true(ev instanceof TrackEvent, 'ev instanceof TrackEvent');
|
||||
assert_true(ev instanceof Event, 'ev instanceof Event');
|
||||
assert_equals(ev.track, null, 'ev.track');
|
||||
ev.track = {};
|
||||
assert_equals(ev.track, null, 'ev.track after assignment');
|
||||
}, document.title+', one arg');
|
||||
test(function(){
|
||||
var obj = {};
|
||||
var ev = new TrackEvent('foo', {track:obj});
|
||||
assert_true(ev instanceof TrackEvent, 'ev instanceof TrackEvent');
|
||||
assert_true(ev instanceof Event, 'ev instanceof Event');
|
||||
assert_equals(ev.track, obj, 'ev.track');
|
||||
ev.track = {};
|
||||
assert_equals(ev.track, obj, 'ev.track after assignment');
|
||||
}, document.title+', two args');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>TrackEvent created with createEvent</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=17268
|
||||
assert_throws('NOT_SUPPORTED_ERR', function() {
|
||||
var ev = document.createEvent('TrackEvent');
|
||||
});
|
||||
var ev = new TrackEvent('foo');
|
||||
assert_false('initTrackEvent' in ev, 'initTrackEvent');
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue