<!doctype html>
<title>autoplay with preload set to none.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
function autoplay_test(tagName, src)
{
async_test(function(t)
{
var e = document.createElement(tagName);
e.src = src;
e.preload = "none";
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 with preload="none"');
}
autoplay_test('audio', 'content/test.oga');
autoplay_test('video', 'content/test.ogv');
</script>