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

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