Bug 1523562 [wpt PR 15075] - Fix preload tests failing on wpt.fyi dashboard, second attempt, a=testonly
authorKunihiko Sakamoto <ksakamoto@chromium.org>
Fri, 01 Feb 2019 13:40:54 +0000
changeset 458184 34865e88897289c24a6cfd1a04fc3373d7bbebcb
parent 458183 aa47b599a24f4919ab4b31066f30fda92adfa0a7
child 458185 bbc29fb3d0bf74fde45e99eb0a43b1f61551daa7
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1523562, 15075, 1411963, 14882, 922343, 1436777, 626019
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/tests/preload/link-header-preload-nonce.html
testing/web-platform/tests/preload/link-header-preload-srcset.tentative.html
testing/web-platform/tests/preload/resources/preload_helper.js
--- a/testing/web-platform/tests/preload/link-header-preload-nonce.html
+++ b/testing/web-platform/tests/preload/link-header-preload-nonce.html
@@ -4,13 +4,13 @@
 <script nonce="abc" src="/preload/resources/preload_helper.js"></script>
 <script nonce="abc">
     var t = async_test('Makes sure that Link headers preload resources with CSP nonce');
 </script>
 <script nonce="abc" src="resources/dummy.js?pipe=trickle(d5)&link-header-preload-nonce"></script>
 <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>
--- a/testing/web-platform/tests/preload/link-header-preload-srcset.tentative.html
+++ b/testing/web-platform/tests/preload/link-header-preload-srcset.tentative.html
@@ -6,22 +6,22 @@
 <script>
     var t = async_test('Makes sure that Link headers preload images with (experimental) imagesrcset/imagesizes attributes.');
 </script>
 <body>
 <script src="resources/dummy.js?pipe=trickle(d3)&link-header-preload-srcset"></script>
 <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>
 </body>
--- a/testing/web-platform/tests/preload/resources/preload_helper.js
+++ b/testing/web-platform/tests/preload/resources/preload_helper.js
@@ -15,8 +15,14 @@ function verifyNumberOfDownloads(url, nu
     var numDownloads = 0;
     performance.getEntriesByName(getAbsoluteURL(url)).forEach(entry => {
         if (entry.transferSize > 0) {
             numDownloads++;
         }
     });
     assert_equals(numDownloads, number, url);
 }
+
+function verifyNumberOfResourceTimingEntries(url, number)
+{
+    var numEntries = performance.getEntriesByName(getAbsoluteURL(url)).length;
+    assert_equals(numEntries, number, url);
+}