Index: LayoutTests/media/autoplay.html |
diff --git a/LayoutTests/media/autoplay.html b/LayoutTests/media/autoplay.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f18b10ceca9846065ce0136abac6016db93bb1c9 |
--- /dev/null |
+++ b/LayoutTests/media/autoplay.html |
@@ -0,0 +1,31 @@ |
+<!doctype 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) { |
acolwell GONE FROM CHROMIUM
2014/02/18 18:30:37
nit: 4-space indent here and everywhere else in th
philipj_slow
2014/02/19 03:10:05
I thought it was best to minimize the changes to t
|
+ 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) { |
acolwell GONE FROM CHROMIUM
2014/02/18 18:30:37
nit: { on next line here and below to match Blink
|
+ 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> |