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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/media/encrypted-media/encrypted-media-many-mediakeys.html
diff --git a/LayoutTests/media/encrypted-media/encrypted-media-many-mediakeys.html b/LayoutTests/media/encrypted-media/encrypted-media-many-mediakeys.html
new file mode 100644
index 0000000000000000000000000000000000000000..236d925ee18018f1f478439772470bf27a7fbe8c
--- /dev/null
+++ b/LayoutTests/media/encrypted-media/encrypted-media-many-mediakeys.html
@@ -0,0 +1,63 @@
+<!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.
+<html>
+ <head>
+ <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.
+ <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
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../../resources/gc.js"></script>
+ </head>
+ <body>
+ <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.
+ <video id="testVideo"></video>
+ <div id="log"></div>
+ <script>
+ test(function()
+ {
+ var video = document.getElementById("testVideo");
+ var mediaKeys;
+ var mediaKeys2;
+
+ assert_not_equals(video, null);
+ assert_equals(video.mediaKeys, null);
+ assert_equals(typeof video.setMediaKeys, "function");
+
+ // Create a pair of MediaKeys objects
+ mediaKeys = new MediaKeys("org.w3.clearkey");
+ mediaKeys2 = new MediaKeys("org.w3.clearkey");
+ assert_not_equals(mediaKeys, null);
+ assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
+ assert_not_equals(mediaKeys2, null);
+ assert_equals(mediaKeys2.keySystem, 'org.w3.clearkey');
+
+ // Run gc(), should not affect MediaKeys objects since we have
+ // a reference to them.
+ gc();
+ assert_not_equals(mediaKeys, null);
+ assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
+ assert_not_equals(mediaKeys2, null);
+ assert_equals(mediaKeys2.keySystem, 'org.w3.clearkey');
+
+ // Drop references to the MediaKeys objects and run gc again.
+ mediaKeys = null;
+ mediaKeys2 = null;
+ gc();
+
+ // Create a large number of MediaKeys objects and then run gc.
+ // All but the last one created should be garbage collected.
+ for(var i=0; i<100; ++i)
+ 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.
+ gc();
+
+ // Last MediaKeys object created should still be referenced.
+ assert_not_equals(mediaKeys, null);
+ assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
+
+ // Release the last MediaKeys object created.
+ mediaKeys = null;
+ gc();
+ }, "create many MediaKeys and garbage collect");
+ </script>
+
xhwang 2014/02/25 21:04:14 extra line not needed?
jrummell 2014/02/25 23:32:07 Done.
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698