Title: [239137] trunk/LayoutTests
Revision
239137
Author
cdu...@apple.com
Date
2018-12-12 17:19:22 -0800 (Wed, 12 Dec 2018)

Log Message

[Mojave Release Wk2] Layout Test http/tests/cache/disk-cache/disk-cache-validation-attachment.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=190323
<rdar://problem/45056253>

Reviewed by Youenn Fablet.

* http/tests/cache/disk-cache/disk-cache-validation-attachment-expected.txt:
* http/tests/cache/disk-cache/disk-cache-validation-attachment.html:
Simplify test a bit to only test the header combinations it cares about.

* http/tests/cache/disk-cache/resources/cache-test.js:
(runTestsNow):
(runTests):
The flakiness was due to logic in CachedResourceLoader::determineRevalidationPolicy() which more aggressively
reuses cached resources (bypassing freshness checks) until the load event has fired. This means that the
test would give different results depending on whether or not the load event had a chance to fire before
we do the checks. To address the issue, update runTests() to wait for the load event if it has not yet
fired. This will likely address flakiness in other disk-cache tests as well.

* platform/mac-wk2/TestExpectations:
Unskip test that is no longer flaky.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239136 => 239137)


--- trunk/LayoutTests/ChangeLog	2018-12-13 01:13:29 UTC (rev 239136)
+++ trunk/LayoutTests/ChangeLog	2018-12-13 01:19:22 UTC (rev 239137)
@@ -1,3 +1,27 @@
+2018-12-12  Chris Dumez  <cdu...@apple.com>
+
+        [Mojave Release Wk2] Layout Test http/tests/cache/disk-cache/disk-cache-validation-attachment.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=190323
+        <rdar://problem/45056253>
+
+        Reviewed by Youenn Fablet.
+
+        * http/tests/cache/disk-cache/disk-cache-validation-attachment-expected.txt:
+        * http/tests/cache/disk-cache/disk-cache-validation-attachment.html:
+        Simplify test a bit to only test the header combinations it cares about.
+
+        * http/tests/cache/disk-cache/resources/cache-test.js:
+        (runTestsNow):
+        (runTests):
+        The flakiness was due to logic in CachedResourceLoader::determineRevalidationPolicy() which more aggressively
+        reuses cached resources (bypassing freshness checks) until the load event has fired. This means that the
+        test would give different results depending on whether or not the load event had a chance to fire before
+        we do the checks. To address the issue, update runTests() to wait for the load event if it has not yet
+        fired. This will likely address flakiness in other disk-cache tests as well.
+
+        * platform/mac-wk2/TestExpectations:
+        Unskip test that is no longer flaky.
+
 2018-12-12  Youenn Fablet  <you...@apple.com>
 
         Recycling the m section should work if it was rejected remotely

Modified: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment-expected.txt (239136 => 239137)


--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment-expected.txt	2018-12-13 01:13:29 UTC (rev 239136)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment-expected.txt	2018-12-13 01:19:22 UTC (rev 239137)
@@ -3,21 +3,9 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-running 6 tests
+running 2 tests
 
 --------Testing loads from disk cache--------
-response headers: undefined
-response source: Network
-
-response headers: {"Cache-control":"max-age=0"}
-response source: Network
-
-response headers: {"Cache-control":"max-age=100"}
-response source: Disk cache
-
-response headers: {"Content-Disposition":"attachment; filename=\"f.txt\""}
-response source: Network
-
 response headers: {"Cache-control":"max-age=0","Content-Disposition":"attachment; filename=\"f.txt\""}
 response source: Network
 
@@ -25,18 +13,6 @@
 response source: Disk cache
 
 --------Testing loads through memory cache (XHR behavior)--------
-response headers: undefined
-response source: Network
-
-response headers: {"Cache-control":"max-age=0"}
-response source: Network
-
-response headers: {"Cache-control":"max-age=100"}
-response source: Memory cache
-
-response headers: {"Content-Disposition":"attachment; filename=\"f.txt\""}
-response source: Network
-
 response headers: {"Cache-control":"max-age=0","Content-Disposition":"attachment; filename=\"f.txt\""}
 response source: Network
 
@@ -44,18 +20,6 @@
 response source: Memory cache
 
 --------Testing loads through memory cache (subresource behavior)--------
-response headers: undefined
-response source: Network
-
-response headers: {"Cache-control":"max-age=0"}
-response source: Network
-
-response headers: {"Cache-control":"max-age=100"}
-response source: Memory cache
-
-response headers: {"Content-Disposition":"attachment; filename=\"f.txt\""}
-response source: Network
-
 response headers: {"Cache-control":"max-age=0","Content-Disposition":"attachment; filename=\"f.txt\""}
 response source: Network
 

Modified: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment.html (239136 => 239137)


--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment.html	2018-12-13 01:13:29 UTC (rev 239136)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-validation-attachment.html	2018-12-13 01:19:22 UTC (rev 239137)
@@ -6,14 +6,9 @@
 var testMatrix =
 [
  [
-  {},
-  { responseHeaders: {'Cache-control': 'max-age=0' } },
-  { responseHeaders: {'Cache-control': 'max-age=100' } },
+  { responseHeaders: {'Cache-control': 'max-age=0', 'Content-Disposition': 'attachment; filename="f.txt"' } },
+  { responseHeaders: {'Cache-control': 'max-age=100', 'Content-Disposition': 'attachment; filename="f.txt"' } },
   ],
- [
-  {},
-  { responseHeaders: {'Content-Disposition': 'attachment; filename="f.txt"' } },
-  ],
  ];
 
 description("Tests that responses with 'content-disposition: attachment' are cacheable");

Modified: trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js (239136 => 239137)


--- trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js	2018-12-13 01:13:29 UTC (rev 239136)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js	2018-12-13 01:19:22 UTC (rev 239137)
@@ -111,7 +111,7 @@
     }
 }
 
-function runTests(tests, completionHandler)
+function runTestsNow(tests, completionHandler)
 {
     loadResources(tests, function () {
         // Wait a bit so things settle down in the disk cache.
@@ -136,6 +136,20 @@
     });
 }
 
+function runTests(tests, completionHandler)
+{
+    if (document.readyState == 'complete') {
+        runTestsNow(tests, completionHandler);
+        return;
+    }
+
+    // We need to wait for the load event to have fired because CachedResourceLoader::determineRevalidationPolicy()
+    // agressively reuses resources until the load event has fired.
+    addEventListener("load", () => {
+        runTestsNow(tests, completionHandler);
+    });
+}
+
 function mergeFields(field, componentField)
 {
     for (var name in componentField) {

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (239136 => 239137)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-12-13 01:13:29 UTC (rev 239136)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-12-13 01:19:22 UTC (rev 239137)
@@ -896,8 +896,6 @@
 
 webkit.org/b/189598 compositing/backing/backing-store-attachment-fill-forwards-animation.html [ Pass Failure ]
 
-webkit.org/b/190323 http/tests/cache/disk-cache/disk-cache-validation-attachment.html [ Pass Failure ]
-
 # Skip local authenticator tests for mac now.
 http/wpt/webauthn/public-key-credential-create-failure-local.https.html [ Skip ]
 http/wpt/webauthn/public-key-credential-create-success-local.https.html [ Skip ]
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to