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

Unified Diff: LayoutTests/media/gc-while-seeking.html

Issue 552303006: Prevent more script-observable cases of HTMLMediaElement GC (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: make gc-while-seeking.html non-flaky Created 6 years, 3 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 | « LayoutTests/media/gc-while-playing.html ('k') | LayoutTests/media/track/track-remove-track.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/gc-while-seeking.html
diff --git a/LayoutTests/media/gc-while-seeking.html b/LayoutTests/media/gc-while-seeking.html
new file mode 100644
index 0000000000000000000000000000000000000000..37add4637aa1022679dc31ff4712fa552850b299
--- /dev/null
+++ b/LayoutTests/media/gc-while-seeking.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>GC while seeking</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<script>
+async_test(function(t)
+{
+ var a = document.createElement("audio");
+ a.foo = "bar";
+ a.src = findMediaFile("audio", "content/test");
+ a.onsuspend = t.step_func(function()
+ {
+ assert_equals(a.networkState, a.NETWORK_IDLE);
+ a.currentTime = a.duration / 2;
+ assert_true(a.seeking);
+ // Continue after a timeout since the current event target is the media
+ // element, which means that it cannot be garbage collected now.
+ setTimeout(t.step_func(gcAndAwaitSeeked), 0);
+ });
+ function gcAndAwaitSeeked()
+ {
+ if (!a.seeking) {
+ // The seek may have already completed, in which case it's too late
+ // to verify GC behavior. Since networkState is NETWORK_IDLE there's
+ // no way to make the seek slower, making this test inherently racy.
+ t.done();
+ } else {
+ a.onseeked = t.step_func(function(e)
+ {
+ assert_greater_than(e.target.currentTime, 0);
+ assert_equals(e.target.foo, "bar");
+ t.done();
+ });
+ a = null;
+ gc();
+ }
+ }
+});
+</script>
« no previous file with comments | « LayoutTests/media/gc-while-playing.html ('k') | LayoutTests/media/track/track-remove-track.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698