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

Side by Side Diff: LayoutTests/media/track/track-add-remove-cue-expected.txt

Issue 72543003: Update TextTrackCue tests to use VTTCue where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 Tests TextTrackCue's addCue and removeCue 1 Tests TextTrack's addCue and removeCue
2 2
3 3
4 *** Test cues loaded from the file. 4 *** Test cues loaded from the file.
5 EXPECTED (cues.length == '4') OK 5 EXPECTED (cues.length == '4') OK
6 EXPECTED (cues.getCueById('1').startTime == '0') OK 6 EXPECTED (cues.getCueById('1').startTime == '0') OK
7 EXPECTED (cues[1].startTime == '31') OK 7 EXPECTED (cues[1].startTime == '31') OK
8 EXPECTED (cues[2].startTime == '61') OK 8 EXPECTED (cues[2].startTime == '61') OK
9 EXPECTED (cues.getCueById('4').startTime == '121') OK 9 EXPECTED (cues.getCueById('4').startTime == '121') OK
10 EXPECTED (cues.getCueById('junk') == 'undefined') OK 10 EXPECTED (cues.getCueById('junk') == 'undefined') OK
11 11
12 *** Create a new cue, check values 12 *** Create a new cue, check values
13 RUN(textCue = new TextTrackCue(33, 3.4, 'Sausage?')) 13 RUN(textCue = new VTTCue(33, 3.4, 'Sausage?'))
14 EXPECTED (textCue.track == 'null') OK 14 EXPECTED (textCue.track == 'null') OK
15 EXPECTED (textCue.id == '') OK 15 EXPECTED (textCue.id == '') OK
16 EXPECTED (textCue.startTime == '33') OK 16 EXPECTED (textCue.startTime == '33') OK
17 EXPECTED (textCue.endTime == '3.4') OK 17 EXPECTED (textCue.endTime == '3.4') OK
18 EXPECTED (textCue.pauseOnExit == 'false') OK 18 EXPECTED (textCue.pauseOnExit == 'false') OK
19 EXPECTED (textCue.vertical == '') OK 19 EXPECTED (textCue.vertical == '') OK
20 EXPECTED (textCue.snapToLines == 'true') OK 20 EXPECTED (textCue.snapToLines == 'true') OK
21 EXPECTED (textCue.line == '-1') OK 21 EXPECTED (textCue.line == '-1') OK
22 EXPECTED (textCue.position == '50') OK 22 EXPECTED (textCue.position == '50') OK
23 EXPECTED (textCue.size == '100') OK 23 EXPECTED (textCue.size == '100') OK
24 EXPECTED (textCue.align == 'middle') OK 24 EXPECTED (textCue.align == 'middle') OK
25 25
26 *** Add the new cue to a track, make sure it is inserted correctly. 26 *** Add the new cue to a track, make sure it is inserted correctly.
27 RUN(testTrack.track.addCue(textCue)) 27 RUN(testTrack.track.addCue(textCue))
28 EXPECTED (textCue.track == '[object TextTrack]') OK 28 EXPECTED (textCue.track == '[object TextTrack]') OK
29 EXPECTED (cues[1].startTime == '31') OK 29 EXPECTED (cues[1].startTime == '31') OK
30 EXPECTED (cues[2].startTime == '33') OK 30 EXPECTED (cues[2].startTime == '33') OK
31 EXPECTED (cues[3].startTime == '61') OK 31 EXPECTED (cues[3].startTime == '61') OK
32 32
33 *** create a new cue and add it to a track created with video.addTextTrack, make sure it is inserted correctly. 33 *** create a new cue and add it to a track created with video.addTextTrack, make sure it is inserted correctly.
34 RUN(newTrack = video.addTextTrack("subtitles", "French subtitles", "fr")) 34 RUN(newTrack = video.addTextTrack("subtitles", "French subtitles", "fr"))
35 RUN(newTrack.addCue(new TextTrackCue(0.0, 1.0, "Test!"))) 35 RUN(newTrack.addCue(new VTTCue(0.0, 1.0, "Test!")))
36 RUN(newCue = newTrack.cues[0]) 36 RUN(newCue = newTrack.cues[0])
37 EXPECTED (newCue.track == '[object TextTrack]') OK 37 EXPECTED (newCue.track == '[object TextTrack]') OK
38 EXPECTED (newCue.id == '') OK 38 EXPECTED (newCue.id == '') OK
39 EXPECTED (newCue.startTime == '0') OK 39 EXPECTED (newCue.startTime == '0') OK
40 EXPECTED (newCue.endTime == '1') OK 40 EXPECTED (newCue.endTime == '1') OK
41 EXPECTED (newCue.pauseOnExit == 'false') OK 41 EXPECTED (newCue.pauseOnExit == 'false') OK
42 EXPECTED (newCue.vertical == '') OK 42 EXPECTED (newCue.vertical == '') OK
43 EXPECTED (newCue.snapToLines == 'true') OK 43 EXPECTED (newCue.snapToLines == 'true') OK
44 EXPECTED (newCue.line == '-1') OK 44 EXPECTED (newCue.line == '-1') OK
45 EXPECTED (newCue.position == '50') OK 45 EXPECTED (newCue.position == '50') OK
46 EXPECTED (newCue.size == '100') OK 46 EXPECTED (newCue.size == '100') OK
47 EXPECTED (newCue.align == 'middle') OK 47 EXPECTED (newCue.align == 'middle') OK
48 48
49 *** Create an old-style cue with an id. 49 *** Create an old-style cue with an id.
50 RUN(oldStyleCue = new TextTrackCue('sausage-cue', 33, 3.4, 'Sausage?')) 50 RUN(oldStyleCue = new VTTCue('sausage-cue', 33, 3.4, 'Sausage?'))
51 EXPECTED (oldStyleCue.id == '') OK 51 EXPECTED (oldStyleCue.id == '') OK
52 EXPECTED (oldStyleCue.startTime.toString() == 'NaN') OK 52 EXPECTED (oldStyleCue.startTime.toString() == 'NaN') OK
53 EXPECTED (oldStyleCue.endTime == '33') OK 53 EXPECTED (oldStyleCue.endTime == '33') OK
54 *** Make sure the old-style cue is not inserted because its start time is not a number. 54 *** Make sure the old-style cue is not inserted because its start time is not a number.
55 EXPECTED (testTrack.track.cues.length == '5') OK 55 EXPECTED (testTrack.track.cues.length == '5') OK
56 RUN(testTrack.track.addCue(oldStyleCue)) 56 RUN(testTrack.track.addCue(oldStyleCue))
57 EXPECTED (testTrack.track.cues.length == '5') OK 57 EXPECTED (testTrack.track.cues.length == '5') OK
58 58
59 *** Remove a cue created with addCue(). 59 *** Remove a cue created with addCue().
60 RUN(testTrack.track.removeCue(textCue)) 60 RUN(testTrack.track.removeCue(textCue))
61 EXPECTED (textCue.track == 'null') OK 61 EXPECTED (textCue.track == 'null') OK
62 EXPECTED (cues[1].startTime == '31') OK 62 EXPECTED (cues[1].startTime == '31') OK
63 EXPECTED (cues[2].startTime == '61') OK 63 EXPECTED (cues[2].startTime == '61') OK
64 64
65 *** Remove a cue added from the WebVTT file. 65 *** Remove a cue added from the WebVTT file.
66 RUN(textCue = cues[2]) 66 RUN(textCue = cues[2])
67 RUN(testTrack.track.removeCue(textCue)) 67 RUN(testTrack.track.removeCue(textCue))
68 EXPECTED (textCue.track == 'null') OK 68 EXPECTED (textCue.track == 'null') OK
69 EXPECTED (cues[1].startTime == '31') OK 69 EXPECTED (cues[1].startTime == '31') OK
70 EXPECTED (cues[2].startTime == '121') OK 70 EXPECTED (cues[2].startTime == '121') OK
71 71
72 *** Try to remove the cue again. 72 *** Try to remove the cue again.
73 TEST(testTrack.track.removeCue(textCue)) THROWS(DOMException.NOT_FOUND_ERR) OK 73 TEST(testTrack.track.removeCue(textCue)) THROWS(DOMException.NOT_FOUND_ERR) OK
74 74
75 *** Add a cue before all the existing cues. 75 *** Add a cue before all the existing cues.
76 RUN(testTrack.track.addCue(new TextTrackCue(0, 31, 'I am first'))) 76 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first')))
77 EXPECTED (cues[0].startTime == '0') OK 77 EXPECTED (cues[0].startTime == '0') OK
78 EXPECTED (cues[0].endTime == '31') OK 78 EXPECTED (cues[0].endTime == '31') OK
79 EXPECTED (cues[1].startTime == '0') OK 79 EXPECTED (cues[1].startTime == '0') OK
80 EXPECTED (cues[1].endTime == '30.5') OK 80 EXPECTED (cues[1].endTime == '30.5') OK
81 EXPECTED (cues[2].startTime == '31') OK 81 EXPECTED (cues[2].startTime == '31') OK
82 END OF TEST 82 END OF TEST
83 83
OLDNEW
« no previous file with comments | « LayoutTests/media/track/track-add-remove-cue.html ('k') | LayoutTests/media/track/track-cue-empty-crash.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698