From 97e7e934a31e2c957b5a95d684f562f0ac641162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Pe=C3=B1a=20Moreno?= Date: Tue, 26 Mar 2019 14:08:27 +0000 Subject: [PATCH] Bug 1535613 [wpt PR 15775] - [ResourceTiming] Rename test resource_memory_cached->resource_reuse, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests [ResourceTiming] Rename test resource_memory_cached->resource_reuse The test does not seem to exercise the memory cache, so I propose renaming the test to something that is more implementation-independent. Also, use an img_src variable to avoid repeating the location in the script. Change-Id: I88e4574d5267a75586fc7b74f39f67e0aab2bc04 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516789 Reviewed-by: Yoav Weiss Commit-Queue: Nicolás Peña Moreno Cr-Commit-Position: refs/heads/master@{#640106} -- wpt-commits: c7a85cb312e815f887fb851b7d1951348b54de8c wpt-pr: 15775 --- ...ry_cached.sub.html => resource_reuse.sub.html} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename testing/web-platform/tests/resource-timing/{resource_memory_cached.sub.html => resource_reuse.sub.html} (87%) 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.