Commit ef8357c0 authored by acolwell@chromium.org's avatar acolwell@chromium.org

Don't delay loading if autoplay is set and preload equals 'none'.

This fixes a regression that was accidentally introduced in r169669.
If autoplay is set, then loading should not be delayed even if preload
was set to "none".

BUG=372770, 378682
TEST=LayoutTests/media/autoplay-with-preload-none.html

Review URL: https://codereview.chromium.org/313963004

git-svn-id: svn://svn.chromium.org/blink/trunk@175517 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9dba1e2d
This is a testharness.js-based test.
PASS audio.autoplay with preload="none"
PASS video.autoplay with preload="none"
Harness: the test ran to completion.
<!doctype html>
<title>autoplay with preload set to none.</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.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', findMediaFile('audio', 'content/test'));
autoplay_test('video', findMediaFile('video', 'content/test'));
</script>
......@@ -889,7 +889,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c
if (attemptLoad && canLoadURL(url, contentType, keySystem)) {
ASSERT(!webMediaPlayer());
if (m_preload == MediaPlayer::None)
if (!autoplay() && m_preload == MediaPlayer::None)
m_delayingLoadForPreloadNone = true;
else
startPlayerLoad();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment