Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: LayoutTests/media/track/opera/interfaces/TextTrack/addCue.html

Issue 944823003: Update a cue's insertion order when reinserting it with addCue() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>TextTrack.addCue()</title> 2 <title>TextTrack.addCue()</title>
3 <script src=../../../../../resources/testharness.js></script> 3 <script src=../../../../../resources/testharness.js></script>
4 <script src=../../../../../resources/testharnessreport.js></script> 4 <script src=../../../../../resources/testharnessreport.js></script>
5 <div id=log></div> 5 <div id=log></div>
6 <script> 6 <script>
7 setup(function(){ 7 setup(function(){
8 window.video = document.createElement('video'); 8 window.video = document.createElement('video');
9 document.body.appendChild(video); 9 document.body.appendChild(video);
10 }, {timeout:5000}); 10 }, {timeout:5000});
11 test(function() { 11 test(function() {
12 var t1 = video.addTextTrack('subtitles'); 12 var t1 = video.addTextTrack('subtitles');
13 var t2 = video.addTextTrack('subtitles'); 13 var t2 = video.addTextTrack('subtitles');
14 var c1 = new VTTCue(0, 1, 'text1'); 14 var c1 = new VTTCue(0, 1, 'text1');
15 t1.addCue(c1); 15 t1.addCue(c1);
16 t2.addCue(c1); 16 t2.addCue(c1);
17 assert_equals(c1.track, t2); 17 assert_equals(c1.track, t2);
18 }, document.title+', adding a cue to two different tracks'); 18 }, document.title+', adding a cue to two different tracks');
19 test(function() { 19 test(function() {
20 var t1 = video.addTextTrack('subtitles'); 20 var t1 = video.addTextTrack('subtitles');
21 var c1 = new VTTCue(0, 1, 'text1'); 21 var c1 = new VTTCue(0, 1, 'text1');
22 t1.addCue(c1); 22 t1.addCue(c1);
23 assert_equals(c1.track, t1); 23 assert_equals(c1.track, t1);
24 t1.addCue(c1); 24 t1.addCue(c1);
25 assert_equals(c1.track, t1); 25 assert_equals(c1.track, t1);
26 }, document.title+', adding a cue to a track twice'); 26 }, document.title+', adding a cue to a track twice');
27 test(function() { 27 test(function() {
28 var t1 = video.addTextTrack('subtitles'); 28 var t1 = video.addTextTrack('subtitles');
29 var c1 = new VTTCue(0, 1, 'text1');
30 t1.addCue(c1);
31 assert_equals(t1.cues.length, 1, 't1.cues.length after first addition');
32 assert_equals(t1.cues[0], c1, 'position of c1 in the list');
33 var c2 = new VTTCue(0, 1, 'text2');
34 t1.addCue(c2);
35 assert_equals(t1.cues.length, 2, 't1.cues.length after second addition');
36 assert_equals(t1.cues[1], c2, 'position of c2 in the list');
37 t1.addCue(c1);
38 assert_equals(t1.cues.length, 2, 't1.cues.length after reinserting c1');
39 assert_equals(t1.cues[1], c1, 'position of c1 in the list');
40 assert_equals(t1.cues[0], c2, 'position of c2 in the list');
41 }, document.title+', adding a cue to a track twice when another cue has same tim estamps');
42 test(function() {
43 var t1 = video.addTextTrack('subtitles');
29 var t2 = video.addTextTrack('subtitles'); 44 var t2 = video.addTextTrack('subtitles');
30 var c1 = new VTTCue(0, 1, 'text1'); 45 var c1 = new VTTCue(0, 1, 'text1');
31 t1.addCue(c1); 46 t1.addCue(c1);
32 assert_equals(c1.track, t1); 47 assert_equals(c1.track, t1);
33 t1.removeCue(c1); 48 t1.removeCue(c1);
34 assert_equals(c1.track, null); 49 assert_equals(c1.track, null);
35 t2.addCue(c1); 50 t2.addCue(c1);
36 assert_equals(c1.track, t2); 51 assert_equals(c1.track, t2);
37 }, document.title+', adding a removed cue to a different track'); 52 }, document.title+', adding a removed cue to a different track');
38 test(function() { 53 test(function() {
(...skipping 17 matching lines...) Expand all
56 t1.addCue(cue); 71 t1.addCue(cue);
57 assert_equals(cue.track, t1); 72 assert_equals(cue.track, t1);
58 t.done(); 73 t.done();
59 }); 74 });
60 track.src= 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 0 0:00:01.000\ntest\n'); 75 track.src= 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 0 0:00:01.000\ntest\n');
61 track.kind = 'subtitles'; 76 track.kind = 'subtitles';
62 track.track.mode = 'hidden'; 77 track.track.mode = 'hidden';
63 video.appendChild(track); 78 video.appendChild(track);
64 }); 79 });
65 </script> 80 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/track/TextTrack.cpp » ('j') | Source/core/html/track/TextTrack.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698