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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html

Issue 1867303002: 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 comments 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>Ensure that a TextTrackCue won't be collected if it has a custom property .</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 <script>
6 function forceGC() {
7 if (window.GCController)
8 return GCController.collectAll();
5 9
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 10 // Force garbage collection
7 (Please avoid writing new tests using video-test.js) --> 11 for (var index = 0; index < 99000; index++)
8 <script src=../video-test.js></script> 12 var str = new String('1234');
mlamouri (slow - plz ping) 2016/04/11 13:12:32 Does that actually work? IOW, will GC run without
philipj_slow 2016/04/11 14:39:22 The comment asyncGC method in js-test.js talks abo
Srirama 2016/04/12 05:52:53 Added async GC functionality (forceAsyncGC). Is th
9 <script> 13 }
10 14
11 function forceGC() 15 async_test(function(t) {
12 { 16 var video = document.createElement('video');
13 if (window.GCController) 17 var trackElement = document.createElement('track');
14 return GCController.collectAll();
15 18
16 // Force garbage collection 19 trackElement.onload = t.step_func_done(function() {
17 for (var ndx = 0; ndx < 99000; ndx++) 20 assert_equals(video.textTracks[0].cues.length, 4);
18 var str = new String("1234"); 21 assert_equals(video.textTracks[0].cues[1].startTime, 31);
19 }
20 22
21 function trackLoaded() 23 video.textTracks[0].cues[1].myProperty = 'tuna salad?';
22 { 24 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?');
23 findMediaElement();
24 25
25 consoleWrite("** Validate."); 26 forceGC();
26 testExpected("video.textTracks[0].cues.length", 4); 27 assert_equals(video.textTracks[0].cues.length, 4);
27 testExpected("video.textTracks[0].cues[1].startTime", 31); 28 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?');
29 });
28 30
29 consoleWrite("<br>** Add a custom property to a cue."); 31 trackElement.src = 'captions-webvtt/tc013-settings.vtt';
30 run("video.textTracks[0].cues[1].myProperty = 'tuna salad?'"); 32 trackElement.kind = 'captions';
31 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal ad?"); 33 trackElement.default = true;
32 34 video.appendChild(trackElement);
33 consoleWrite("<br>** Force garbage collection."); 35 });
34 forceGC(); 36 </script>
35 testExpected("video.textTracks[0].cues.length", 4);
36 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal ad?");
37
38 consoleWrite("");
39 endTest();
40 }
41
42 </script>
43 </head>
44 <body>
45 <p>Ensure that a TextTrackCue won't be collected if it has a custom prop erty.</p>
46 <video>
47 <track src="captions-webvtt/tc013-settings.vtt" kind="captions" onlo ad="trackLoaded()" default>
48 </video>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698