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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-cue-negative-timestamp.html

Issue 1879353002: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment Created 4 years, 8 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests negative timestamps.</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../resources/testharnessreport.js"></script>
5 <video>
6 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" default>
7 </video>
8 <script>
9 async_test(function(t) {
10 var track = document.querySelector("track");
5 11
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 12 track.onload = t.step_func_done(function() {
7 (Please avoid writing new tests using video-test.js) --> 13 // Test that cues with negative startTime are not added.
8 <script src=../video-test.js></script> 14 assert_equals(testTrack.track.cues.length, 4);
9 <script> 15 textCue = new VTTCue(-3439332606, 3.4, "Sausage?");
16 testTrack.track.addCue(textCue);
17 assert_equals(testTrack.track.cues.length, 4);
10 18
11 function trackLoaded() 19 // Test that cues with negative startTime and negative endTime are not a dded.
12 { 20 assert_equals(testTrack.track.cues.length, 4);
13 consoleWrite("Test that cues with negative startTime are not add ed:"); 21 textCue = new VTTCue(-110, -3.4, "Pepperoni?");
14 testExpected("testTrack.track.cues.length", 4); 22 testTrack.track.addCue(textCue);
15 run("textCue = new VTTCue(-3439332606, 3.4, 'Sausage?')"); 23 assert_equals(testTrack.track.cues.length, 4);
16 run("testTrack.track.addCue(textCue)");
17 testExpected("testTrack.track.cues.length", 4);
18 24
19 consoleWrite("<br>Test that cues with negative startTime and neg ative endTime are not added:"); 25 // Test that setting startTime and endTime to negative values does not a ffect the value.
20 testExpected("testTrack.track.cues.length", 4); 26 assert_equals(testTrack.track.cues[3].startTime, 121);
21 run("textCue = new VTTCue(-110, -3.4, 'Pepperoni?')"); 27 testTrack.track.cues[3].startTime = -5;
22 run("testTrack.track.addCue(textCue)"); 28 assert_equals(testTrack.track.cues[3].startTime, 121);
23 testExpected("testTrack.track.cues.length", 4); 29 assert_equals(testTrack.track.cues[3].endTime, 361200.5);
24 30 testTrack.track.cues[3].endTime = -3439332606;
25 consoleWrite("<br>Test that setting startTime and endTime to neg ative values does not affect the value:"); 31 assert_equals(testTrack.track.cues[3].endTime, 361200.5);
26 testExpected("testTrack.track.cues[3].startTime", 121); 32 });
27 run("testTrack.track.cues[3].startTime = -5"); 33 });
28 testExpected("testTrack.track.cues[3].startTime", 121); 34 </script>
29 testExpected("testTrack.track.cues[3].endTime", 361200.5);
30 run("testTrack.track.cues[3].endTime = -3439332606");
31 testExpected("testTrack.track.cues[3].endTime", 361200.5);
32
33 endTest();
34 }
35
36 </script>
37
38 </head>
39 <body>
40 <p>Tests negative timestamps.</p>
41 <video>
42 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" onloa d="trackLoaded()" default>
43 </video>
44 </body>
45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698