diff --git a/testing/web-platform/tests/resource-timing/resource_memory_cached.sub.html b/testing/web-platform/tests/resource-timing/resource_reuse.sub.html similarity index 87% rename from testing/web-platform/tests/resource-timing/resource_memory_cached.sub.html rename to testing/web-platform/tests/resource-timing/resource_reuse.sub.html index 89b5874978c9..ff69a2ce73d1 100644 --- a/testing/web-platform/tests/resource-timing/resource_memory_cached.sub.html +++ b/testing/web-platform/tests/resource-timing/resource_reuse.sub.html @@ -2,7 +2,7 @@ -Resource Timing memory cached resources +Resource Timing: test behavior for reused resources @@ -17,6 +17,7 @@ let iframe; let iframeBody; let count = 0; const host = get_host_info(); +const img_src = 'blue.png?id=cached'; function onload_prep() { iframe = document.getElementById('frameContext'); d = iframe.contentWindow.document; @@ -25,13 +26,13 @@ function onload_prep() { const image = d.createElement('IMG'); image.addEventListener('load', function() { step_timeout(onload_test, 0); }); - image.src = 'blue.png?id=cached'; + image.src = img_src; iframeBody.appendChild(image); const image2 = d.createElement('IMG'); image2.addEventListener('load', function() { step_timeout(onload_test, 0); }); - image2.src = 'blue.png?id=cached'; + image2.src = img_src; iframeBody.appendChild(image2); } @@ -47,7 +48,7 @@ function onload_test() { const index = window.location.pathname.lastIndexOf('/'); const pathname = window.location.pathname.substring(0, index); let expected_entries = {}; - expected_entries[pathname + '/resources/blue.png?id=cached'] = 'img'; + expected_entries[pathname + '/resources/' + img_src] = 'img'; test_resource_entries(entries, expected_entries); test_greater_than(entries[0].requestStart, 0, 'requestStart should be non-zero on the same-origin request'); test_greater_or_equals(entries[0].responseEnd, entries[0].startTime, 'responseEnd should not be before startTime'); @@ -59,7 +60,7 @@ function onload_test() { function start_crossorigin_test() { const image3 = d.createElement('IMG'); image3.addEventListener("load", function() { step_timeout(finish_crossorigin_test, 0); }); - image3.src = 'http://' + host.REMOTE_HOST + ':{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached'; + image3.src = 'http://' + host.REMOTE_HOST + ':{{ports[http][1]}}{{location[path]}}/../resources/' + img_src; iframeBody.appendChild(image3); } function finish_crossorigin_test() { @@ -67,7 +68,7 @@ function finish_crossorigin_test() { const entries = context.getEntriesByType('resource'); test_equals(entries.length, 1, 'There should be one entry in second test'); test_true(entries[0].name.startsWith('http://' + host.REMOTE_HOST + ':{{ports[http][1]}}'), 'Entry name should start with cross-origin domain'); - test_true(entries[0].name.endsWith('/resources/blue.png?id=cached'), 'Entry name should end with file name'); + test_true(entries[0].name.endsWith('/resources/' + img_src), 'Entry name should end with file name'); test_equals(entries[0].requestStart, 0, 'requestStart should be 0 on the cross-origin request'); done(); } @@ -77,7 +78,7 @@ window.addEventListener('load', onload_prep);

Description

-

This test validates that a memory cached resource appears in the buffer once.

+

This test validates that a reused resource appears in the buffer once.