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

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: add async GC functionality 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 async_test(function(t) {
7 var video = document.createElement('video');
8 var trackElement = document.createElement('track');
5 9
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 10 trackElement.onload = t.step_func(function() {
7 (Please avoid writing new tests using video-test.js) --> 11 assert_equals(video.textTracks[0].cues.length, 4);
8 <script src=../video-test.js></script> 12 assert_equals(video.textTracks[0].cues[1].startTime, 31);
9 <script>
10 13
11 function forceGC() 14 video.textTracks[0].cues[1].myProperty = 'tuna salad?';
12 { 15 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?');
13 if (window.GCController)
14 return GCController.collectAll();
15 16
17 function gcCallback() {
18 assert_equals(video.textTracks[0].cues.length, 4);
19 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?') ;
20 t.done();
21 }
22
23 function forceAsyncGC() {
philipj_slow 2016/04/12 08:43:34 I'd say just include resources/gc.js, and do this:
Srirama 2016/04/12 09:54:57 Done. Thanks, looks much simpler and cleaner.
24 if (GCController) {
25 GCController.collectAll();
26 } else {
16 // Force garbage collection 27 // Force garbage collection
17 for (var ndx = 0; ndx < 99000; ndx++) 28 for (var index = 0; index < 99000; index++)
18 var str = new String("1234"); 29 var str = new String('1234');
19 } 30 }
20 31
21 function trackLoaded() 32 setTimeout(t.step_func(gcCallback), 0);
22 { 33 }
23 findMediaElement();
24 34
25 consoleWrite("** Validate."); 35 forceAsyncGC();
26 testExpected("video.textTracks[0].cues.length", 4); 36 });
27 testExpected("video.textTracks[0].cues[1].startTime", 31);
28 37
29 consoleWrite("<br>** Add a custom property to a cue."); 38 trackElement.src = 'captions-webvtt/tc013-settings.vtt';
30 run("video.textTracks[0].cues[1].myProperty = 'tuna salad?'"); 39 trackElement.kind = 'captions';
31 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal ad?"); 40 trackElement.default = true;
32 41 video.appendChild(trackElement);
33 consoleWrite("<br>** Force garbage collection."); 42 });
34 forceGC(); 43 </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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698