2 <title>autoplay with preload set to none.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
8 function autoplay_test(tagName, src)
10 async_test(function(t)
12 var e = document.createElement(tagName);
13 // add to body to prevent GC pending http://crbug.com/400659
14 document.body.appendChild(e);
18 var actual_events = [];
19 var expected_events = ['canplay', 'play', 'playing', 'canplaythrough'];
20 expected_events.forEach(function(type)
22 e.addEventListener(type, t.step_func(function()
24 assert_equals(e.readyState, e.HAVE_ENOUGH_DATA);
25 assert_false(e.paused);
26 actual_events.push(type);
27 if (type == 'canplaythrough') {
28 assert_array_equals(actual_events, expected_events);
33 }, tagName + '.autoplay with preload="none"');
36 autoplay_test('audio', findMediaFile('audio', 'content/test'));
37 autoplay_test('video', findMediaFile('video', 'content/test'));