Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / video-preload-metadata.html
blobd4a7cdfd29f21254bddaa0a02b21079949e195c4
1 <!DOCTYPE html>
2 <title>Verifies preload=metadata doesn't buffer the entire clip.</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="../../media-resources/media-file.js"></script>
6 <div id="log"></div>
7 <video controls preload=metadata></video>
8 <script>
9 async_test(function(t) {
10 var have_metadata = false;
11 var waiting_for_metadata = false;
12 var video = document.querySelector("video");
14 video.onloadedmetadata = t.step_func(function() {
15 have_metadata = true;
16 if (waiting_for_metadata)
17 video.onsuspend();
18 });
20 video.onsuspend = t.step_func(function() {
21 // The metadata event may not fire before suspend occurs, so wait if needed;
22 // while not spec'd, it'd be nice if this wasn't true, see crbug.com/455866.
23 if (!have_metadata) {
24 waiting_for_metadata = true;
25 return;
28 assert_equals(video.buffered.length, 1);
29 assert_equals(video.seekable.length, 1);
31 // If the entire clip wasn't buffered, the buffered range should be smaller
32 // than the seekable range; which should be the duration since the server
33 // supports range requests.
34 assert_true(video.buffered.end(0) < video.duration);
35 assert_equals(video.seekable.end(0), video.duration);
36 assert_true(video.buffered.end(0) < video.seekable.end(0),
37 video.buffered.end(0) + " < " + video.seekable.end(0));
38 t.done();
39 });
41 // Use a .webm to ensure metadata is near the beginning of the file.
42 var mediaFile = "resources/media-source/webm/test.webm";
43 video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?" +
44 "nph=1&name=" + mediaFile + "&throttle=40&type=video/webm";
45 });
46 </script>