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

Unified Diff: LayoutTests/media/encrypted-media/encrypted-media-lifetime-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: lifetime-mediakeys 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
« no previous file with comments | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys.html
diff --git a/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys.html b/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys.html
new file mode 100644
index 0000000000000000000000000000000000000000..a281486b4a73af7343f32e77a890fc61943521c7
--- /dev/null
+++ b/LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test MediaKeys lifetime</title>
ddorwin 2014/02/26 22:40:40 This doesn't seem to do much more than test the st
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../../resources/gc.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function()
+ {
+ var mediaKeys;
+
+ // Create a MediaKeys object.
+ mediaKeys = new MediaKeys("org.w3.clearkey");
+ assert_not_equals(mediaKeys, null);
+ assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
+
+ // Run gc(), should not affect MediaKeys object since we have
+ // a reference to it.
+ gc();
+ assert_not_equals(mediaKeys, null);
+ assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
+
+ // Drop reference to the MediaKeys object and run gc again.
+ // Object should be collected this time.
+ mediaKeys = null;
+ gc();
+
+ // Create a large number of MediaKeys objects and then run gc.
+ // All but the last one created should be garbage collected.
ddorwin 2014/02/26 22:40:40 We can't actually verify the others are GC'd unles
+ for (var i = 0; i < 100; ++i)
+ mediaKeys = new MediaKeys("org.w3.clearkey");
+ 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();
+ }, "MediaKeys lifetime");
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeys-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698