chromium/third_party/blink/web_tests/media/autoplay.html

<!doctype html>
<!-- original: https://github.com/web-platform-tests/wpt/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>
function autoplay_test(tagName, src)
{
    async_test(function(t)
    {
        var media = document.createElement(tagName);
        media.src = src;
        media.autoplay = true;
        var actual_events = [];
        var expected_events = ['canplay', 'play', 'playing', 'canplaythrough'];
        expected_events.forEach(function(type)
        {
            media.addEventListener(type, t.step_func(function()
            {
                assert_equals(media.readyState, media.HAVE_ENOUGH_DATA);
                assert_false(media.paused);
                actual_events.push(type);
                if (type == 'canplaythrough') {
                    assert_array_equals(actual_events, expected_events);
                    t.done();
                }
            }));
        });
    }, tagName + '.autoplay');
}

autoplay_test('audio', 'content/test.oga');
autoplay_test('video', 'content/test.ogv');
</script>