Commit 6404bad3 authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

Re-add disabled audio/video preload tests

This CL adds back the resource load priority preload audio and video
tests so they are not forgotten, but disables them which was the
intention of crrev.com/c/1440522. Also adds a note indicating pointing
to the spec complexity around why they are disabled.

R=yoavweiss@chromium.org

Bug: 735014,977033
Change-Id: I2707a1bd39102e894b803f10f3305b8b8efea796
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902481
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716885}
parent b3d0b90b
......@@ -5871,3 +5871,6 @@ crbug.com/1025437 virtual/not-site-per-process/http/tests/devtools/debugger/fetc
# Sheriff 2019-11-18
crbug.com/1025944 [ Linux ] external/wpt/pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked.html [ Pass Failure ]
# Timeout media preload test until preloading media destinations gets enabled.
crbug.com/977033 http/tests/priorities/resource-load-priorities-media-preload.html [ Timeout ]
<title>ResourceLoadPriority Media Preload tests</title>
<script src="resources/common.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
window.onmessage = function(message) {
if (message.data.hasOwnProperty('Priority')) {
window.onRequestPriorityUpdated(message.data['Priority']);
}
if (message.data.hasOwnProperty('Status')) {
window.onRequestStatusChanged(message.data['Status']);
}
}
// TODO: These tests should be moved to resource-load-priorities.html, and their
// timeout expectations be deleted when we support preloading the audio and
// video destinations. See crbug.com/977033 and
// https://github.com/w3c/preload/issues/97 for more information.
resource_load_priority_test(
'preload/as-audio.html', kLow,
'Preloaded audio files should be loaded with kLow priority');
resource_load_priority_test(
'preload/as-video.html', kLow,
'Preloaded videos should be loaded with kLow priority');
</script>
......@@ -6,15 +6,10 @@
<script src="/serviceworker/resources/test-helpers.js"></script>
<script>
function openWindow(url, t) {
const win = window.open(url, '_blank');
t.add_cleanup(() => win.close());
}
window.onmessage = function(message) {
if (message.data.hasOwnProperty('Status')) {
window.onRequestStatusChanged(message.data['Status']);
}
if (message.data.hasOwnProperty('Status')) {
window.onRequestStatusChanged(message.data['Status']);
}
}
// This test creates a window controlled by the server worker, which makes a
......
......@@ -5,41 +5,13 @@
<script src="/resources/testharnessreport.js"></script>
<script>
function openWindow(url) {
const win = window.open(url, '_blank');
add_result_callback(() => win.close());
return win;
}
window.onmessage = function(message) {
if (message.data.hasOwnProperty('Priority')) {
window.onRequestPriorityUpdated(message.data['Priority']);
}
if (message.data.hasOwnProperty('Status')) {
window.onRequestStatusChanged(message.data['Status']);
}
}
function resource_load_priority_test(windowURL, expected_priority,
description) {
promise_test(async () => {
openWindow('resources/' + windowURL);
// The order in which these two events are sent can't be relied upon.
const priority_event_promise =
new Promise(resolve => window.onRequestPriorityUpdated = resolve);
const subresource_finished_loading_event_promise =
new Promise(resolve => window.onRequestStatusChanged = resolve);
const priority_event = await priority_event_promise;
assert_equals(priority_event, expected_priority);
const subresource_finished_loading_event =
await subresource_finished_loading_event_promise;
assert_equals(subresource_finished_loading_event, 'LOADED',
'The resource loaded successfully');
}, description);
if (message.data.hasOwnProperty('Priority')) {
window.onRequestPriorityUpdated(message.data['Priority']);
}
if (message.data.hasOwnProperty('Status')) {
window.onRequestStatusChanged(message.data['Status']);
}
}
resource_load_priority_test(
......
......@@ -11,6 +11,33 @@ const kVeryLow = 0,
kHigh = 3,
kVeryHigh = 4;
function openWindow(url) {
const win = window.open(url, '_blank');
add_result_callback(() => win.close());
}
function resource_load_priority_test(windowURL, expected_priority,
description) {
promise_test(async () => {
openWindow('resources/' + windowURL);
// The order in which these two events are sent can't be relied upon.
const priority_event_promise =
new Promise(resolve => window.onRequestPriorityUpdated = resolve);
const subresource_finished_loading_event_promise =
new Promise(resolve => window.onRequestStatusChanged = resolve);
const priority_event = await priority_event_promise;
assert_equals(priority_event, expected_priority);
const subresource_finished_loading_event =
await subresource_finished_loading_event_promise;
assert_equals(subresource_finished_loading_event, 'LOADED',
'The resource loaded successfully');
}, description);
}
function observeAndReportResourceLoadPriority(url, optionalDoc, message) {
const documentToUse = optionalDoc ? optionalDoc : document;
return internals.getResourcePriority(url, documentToUse)
......
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