Index: LayoutTests/media/autoplay.html |
diff --git a/LayoutTests/media/autoplay.html b/LayoutTests/media/autoplay.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ca59be325e0c3c18f55759b24e6354649e8b6360 |
--- /dev/null |
+++ b/LayoutTests/media/autoplay.html |
@@ -0,0 +1,36 @@ |
+<!doctype html> |
+<!-- original: https://github.com/w3c/web-platform-tests/blob/6b3893bb99f70e4238011dbcd1f380891e89ec5e/html/semantics/embedded-content-0/media-elements/autoplay.html --> |
+<title>autoplay</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-file.js"></script> |
+<div id="log"></div> |
+<script> |
+function autoplay_test(tagName, src) |
+{ |
+ async_test(function(t) |
+ { |
+ var e = document.createElement(tagName); |
+ e.src = src; |
+ e.autoplay = true; |
+ var actual_events = []; |
+ var expected_events = ['canplay', 'play', 'playing', 'canplaythrough']; |
+ expected_events.forEach(function(type) |
+ { |
+ e.addEventListener(type, t.step_func(function() |
+ { |
+ assert_equals(e.readyState, e.HAVE_ENOUGH_DATA); |
+ assert_false(e.paused); |
+ actual_events.push(type); |
+ if (type == 'canplaythrough') { |
+ assert_array_equals(actual_events, expected_events); |
+ t.done(); |
+ } |
+ })); |
+ }); |
+ }, tagName + '.autoplay'); |
+} |
+ |
+autoplay_test('audio', findMediaFile('audio', 'content/test')); |
+autoplay_test('video', findMediaFile('video', 'content/test')); |
+</script> |