Truly independent web browser
<!DOCTYPE html>
<script src="include.js"></script>
<script>
asyncTest(async done => {
const video = document.createElement("video");
// The Metadata preload state may suspend the download at HAVE_CURRENT_DATA, before the scan reaches the end, which
// would fire an extra suspend event. This test is about the suspend that follows the final progress event.
video.preload = "auto";
document.body.append(video);
for (let load = 0; load < 2; ++load) {
let progressEnd = -1;
let suspends = 0;
video.onprogress = () => {
progressEnd = video.buffered.length ? video.buffered.end(video.buffered.length - 1) : -1;
};
await new Promise(resolve => {
video.onsuspend = () => {
++suspends;
println(`Load ${load}: final progress covers duration: ${progressEnd === video.duration}`);
println(`Load ${load}: idle at suspend: ${video.networkState === HTMLMediaElement.NETWORK_IDLE}`);
resolve();
};
video.src = "../../Assets/test-webm.webm";
});
await new Promise(resolve => setTimeout(resolve, 100));
println(`Load ${load}: suspend count: ${suspends}`);
}
done();
});
</script>