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

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-many-mediakeys.html

Issue 180203002: Add EME content test that forces garbage collection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: w3c Created 6 years, 10 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
(Empty)
1 <!DOCTYPE html>
xhwang 2014/02/25 21:04:14 In CL title/description, replace "content test" wi
jrummell 2014/02/25 23:32:07 Done.
2 <html>
3 <head>
4 <title>ManyMediaKeys</title>
xhwang 2014/02/25 21:04:14 About this line and the file name: "many" is kind
jrummell 2014/02/25 23:32:07 lifetime-mediakeys.
5 <script src="../w3c-media-utils.js"></script>
xhwang 2014/02/25 21:04:14 Are we using anything from this file?
jrummell 2014/02/25 23:32:07 Was using consoleWrite(), but I removed them, so n
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <script src="../../resources/gc.js"></script>
9 </head>
10 <body>
11 <p>This tests creating many MediaKeys objects.</p>
xhwang 2014/02/25 21:04:14 Recently I am getting rid of of this <p></p> descr
jrummell 2014/02/25 23:32:07 Done.
12 <video id="testVideo"></video>
13 <div id="log"></div>
14 <script>
15 test(function()
16 {
17 var video = document.getElementById("testVideo");
18 var mediaKeys;
19 var mediaKeys2;
20
21 assert_not_equals(video, null);
22 assert_equals(video.mediaKeys, null);
23 assert_equals(typeof video.setMediaKeys, "function");
24
25 // Create a pair of MediaKeys objects
26 mediaKeys = new MediaKeys("org.w3.clearkey");
27 mediaKeys2 = new MediaKeys("org.w3.clearkey");
28 assert_not_equals(mediaKeys, null);
29 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
30 assert_not_equals(mediaKeys2, null);
31 assert_equals(mediaKeys2.keySystem, 'org.w3.clearkey');
32
33 // Run gc(), should not affect MediaKeys objects since we have
34 // a reference to them.
35 gc();
36 assert_not_equals(mediaKeys, null);
37 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
38 assert_not_equals(mediaKeys2, null);
39 assert_equals(mediaKeys2.keySystem, 'org.w3.clearkey');
40
41 // Drop references to the MediaKeys objects and run gc again.
42 mediaKeys = null;
43 mediaKeys2 = null;
44 gc();
45
46 // Create a large number of MediaKeys objects and then run gc.
47 // All but the last one created should be garbage collected.
48 for(var i=0; i<100; ++i)
49 mediaKeys = new MediaKeys("org.w3.clearkey");
xhwang 2014/02/25 21:04:14 Since we are testing gc'ing 100 MediaKeys here, do
jrummell 2014/02/25 23:32:07 I don't think it hurts.
50 gc();
51
52 // Last MediaKeys object created should still be referenced.
53 assert_not_equals(mediaKeys, null);
54 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
55
56 // Release the last MediaKeys object created.
57 mediaKeys = null;
58 gc();
59 }, "create many MediaKeys and garbage collect");
60 </script>
61
xhwang 2014/02/25 21:04:14 extra line not needed?
jrummell 2014/02/25 23:32:07 Done.
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698