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

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: 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 TextTrack 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 <script src=../media-file.js></script> 10 // Force garbage collection
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 11 for (var index = 0; index < 99000; index++)
8 (Please avoid writing new tests using video-test.js) --> 12 var str = new String('1234');
mlamouri (slow - plz ping) 2016/04/11 13:12:32 ditto
9 <script src=../video-test.js></script> 13 }
10 <script>
11 14
12 function forceGC() 15 async_test(function(t) {
13 { 16 var video = document.createElement('video');
14 if (window.GCController) 17 var trackElement = document.createElement('track');
15 return GCController.collectAll();
16 18
17 // Force garbage collection 19 trackElement.onload = t.step_func_done(function() {
18 for (var ndx = 0; ndx < 99000; ndx++) 20 assert_equals(video.textTracks.length, 1);
19 var str = new String("1234"); 21 assert_equals(video.textTracks[0].kind, 'captions');
20 }
21 22
22 function trackLoaded() 23 video.textTracks[0].myProperty = 'egg salad!?';
23 { 24 assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
24 findMediaElement();
25 25
26 consoleWrite("** Validate."); 26 forceGC();
27 testExpected("video.textTracks.length", 1); 27 assert_equals(video.textTracks[0].cues.length, 4);
28 testExpected("video.textTracks[0].kind", "captions"); 28 assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
29 });
29 30
30 consoleWrite("<br>** Add a custom property to the track."); 31 trackElement.src = 'captions-webvtt/tc013-settings.vtt';
31 run("video.textTracks[0].myProperty = 'egg salad!?'"); 32 trackElement.kind = 'captions';
32 testExpected("video.textTracks[0].myProperty", "egg salad!?"); 33 trackElement.default = true;
33 34 video.appendChild(trackElement);
34 consoleWrite("<br>** Force garbage collection."); 35 });
35 forceGC(); 36 </script>
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