Bug 1523562 [wpt PR 15075] - Fix preload tests failing on wpt.fyi dashboard, second attempt, a=testonly

Automatic update from web-platform-tests
Fix preload tests failing on wpt.fyi dashboard, second attempt

https://crrev.com/c/1411963 fixed the url conflicts with other tests,
but the test still flakes when running repeatedly, because the resource
is loaded from disk cache in subsequent runs
(https://github.com/web-platform-tests/wpt/pull/14882).

We don't care if the preloaded resources came from cache in these tests,
so let's just verify the number of Resource Timing entries.

Bug: 922343
Change-Id: I2c1d146856a125dbbb641d7efb4e6151094f6a3e
Reviewed-on: https://chromium-review.googlesource.com/c/1436777
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626019}

--

wpt-commits: a52ae0c66f4a764f036d6b85e9d2e611acf45383
wpt-pr: 15075
This commit is contained in:
Kunihiko Sakamoto 2019-02-01 13:40:54 +00:00 коммит произвёл James Graham
Родитель 85175d3bee
Коммит 88ccb362a5
3 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -9,8 +9,8 @@
<script nonce="abc">
window.addEventListener('load', t.step_func(function() {
verifyPreloadAndRTSupport();
verifyNumberOfDownloads("resources/dummy.js?from-header&without-nonce", 0);
verifyNumberOfDownloads("resources/dummy.js?from-header&with-nonce", 1);
verifyNumberOfResourceTimingEntries("resources/dummy.js?from-header&without-nonce", 0);
verifyNumberOfResourceTimingEntries("resources/dummy.js?from-header&with-nonce", 1);
t.done();
}));
</script>

Просмотреть файл

@ -11,16 +11,16 @@
<script>
window.addEventListener("load", t.step_func(function() {
verifyPreloadAndRTSupport();
verifyNumberOfDownloads('resources/square.png?from-header&1x', 1);
verifyNumberOfDownloads('resources/square.png?from-header&2x', 0);
verifyNumberOfDownloads('resources/square.png?from-header&3x', 0);
verifyNumberOfDownloads('resources/square.png?from-header&base', 0);
verifyNumberOfDownloads('resources/square.png?from-header&200', 0);
verifyNumberOfDownloads('resources/square.png?from-header&400', 1);
verifyNumberOfDownloads('resources/square.png?from-header&800', 0);
verifyNumberOfDownloads('resources/square.png?from-header&150', 0);
verifyNumberOfDownloads('resources/square.png?from-header&300', 1);
verifyNumberOfDownloads('resources/square.png?from-header&600', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&1x', 1);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&2x', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&3x', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&base', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&200', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&400', 1);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&800', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&150', 0);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&300', 1);
verifyNumberOfResourceTimingEntries('resources/square.png?from-header&600', 0);
t.done();
}));
</script>

Просмотреть файл

@ -20,3 +20,9 @@ function verifyNumberOfDownloads(url, number)
});
assert_equals(numDownloads, number, url);
}
function verifyNumberOfResourceTimingEntries(url, number)
{
var numEntries = performance.getEntriesByName(getAbsoluteURL(url)).length;
assert_equals(numEntries, number, url);
}