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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/text-track-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: Simplify GC invocation as per 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 TextTrack won't be collected if it has a custom property.</ title>
3 <head> 3 <script src="../../resources/gc.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script>
7 async_test(function(t) {
8 var video = document.createElement('video');
9 var trackElement = document.createElement('track');
5 10
6 <script src=../media-file.js></script> 11 trackElement.onload = t.step_func(function() {
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 12 assert_equals(video.textTracks.length, 1);
8 (Please avoid writing new tests using video-test.js) --> 13 assert_equals(video.textTracks[0].kind, 'captions');
9 <script src=../video-test.js></script>
10 <script>
11 14
12 function forceGC() 15 video.textTracks[0].myProperty = 'egg salad!?';
13 { 16 assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
14 if (window.GCController)
15 return GCController.collectAll();
16 17
17 // Force garbage collection 18 gc();
18 for (var ndx = 0; ndx < 99000; ndx++) 19 setTimeout(t.step_func_done(function() {
19 var str = new String("1234"); 20 assert_equals(video.textTracks[0].cues.length, 4);
20 } 21 assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
22 }), 0);
23 });
21 24
22 function trackLoaded() 25 trackElement.src = 'captions-webvtt/tc013-settings.vtt';
23 { 26 trackElement.kind = 'captions';
24 findMediaElement(); 27 trackElement.default = true;
25 28 video.appendChild(trackElement);
26 consoleWrite("** Validate."); 29 });
27 testExpected("video.textTracks.length", 1); 30 </script>
28 testExpected("video.textTracks[0].kind", "captions");
29
30 consoleWrite("<br>** Add a custom property to the track.");
31 run("video.textTracks[0].myProperty = 'egg salad!?'");
32 testExpected("video.textTracks[0].myProperty", "egg salad!?");
33
34 consoleWrite("<br>** Force garbage collection.");
35 forceGC();
36 testExpected("video.textTracks[0].cues.length", 4);
37 testExpected("video.textTracks[0].myProperty", "egg salad!?");
38
39 consoleWrite("");
40 endTest();
41 }
42
43 </script>
44 </head>
45 <body>
46 <p>Ensure that a TextTrack won't be collected if it has a custom propert y.</p>
47 <video>
48 <track src="captions-webvtt/tc013-settings.vtt" kind="captions" onlo ad="trackLoaded()" default>
49 </video>
50 </body>
51 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698