| <!DOCTYPE html> |
| <title>This test case simulates a slow network, and starts a web worker thread to write a log message when retrieving media metadata to see if the webkit thread is blocked by media retrieving thread.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <video></video> |
| <script> |
| // This test case is for https://bugs.webkit.org/show_bug.cgi?id=80978. |
| async_test(function(t) { |
| var workerExecuted = false; |
| var video = document.querySelector("video"); |
| |
| video.onloadedmetadata = t.step_func_done(function() { |
| assert_true(workerExecuted); |
| }); |
| |
| video.onerror = t.unreached_func(); |
| assert_equals(video.error, null); |
| |
| var worker = new Worker("video-throttled-load-metadata-worker.js"); |
| worker.onmessage = t.step_func(function() { |
| workerExecuted = true; |
| }); |
| |
| // Use a .webm to ensure metadata is near the beginning of the file. |
| var mediaFile = "resources/media-source/webm/test.webm"; |
| video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?" + |
| "nph=1&name=" + mediaFile + "&throttle=40&type=video/webm" + |
| "avoidCache=" + Math.random(); |
| }); |
| </script> |