Title: [284631] trunk/LayoutTests
Revision
284631
Author
katherine_che...@apple.com
Date
2021-10-21 11:26:12 -0700 (Thu, 21 Oct 2021)

Log Message

http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=231971
<rdar://problem/84270108>

Reviewed by John Wilander.

Update ITP tests to wait for resetCookies() to finish before ending
the test. Flaky timeouts were being caused by resetCookies() being
partially finished which resets the top loading frame checked in
TestRunner::notifyDone().

* http/tests/cookies/resources/delete-cookie.py: Added.
(delete_cookie):
* http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html:
* http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html:
* http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html:
* http/tests/resourceLoadStatistics/resources/util.js:
(async resetCookiesITP.setUp):
(async resetCookiesITP):
* http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html:
* http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
* http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html:
* http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284630 => 284631)


--- trunk/LayoutTests/ChangeLog	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/ChangeLog	2021-10-21 18:26:12 UTC (rev 284631)
@@ -1,3 +1,29 @@
+2021-10-21  Kate Cheney  <katherine_che...@apple.com>
+
+        http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky timeout
+        https://bugs.webkit.org/show_bug.cgi?id=231971
+        <rdar://problem/84270108>
+
+        Reviewed by John Wilander.
+
+        Update ITP tests to wait for resetCookies() to finish before ending
+        the test. Flaky timeouts were being caused by resetCookies() being
+        partially finished which resets the top loading frame checked in
+        TestRunner::notifyDone().
+
+        * http/tests/cookies/resources/delete-cookie.py: Added.
+        (delete_cookie):
+        * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html:
+        * http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html:
+        * http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html:
+        * http/tests/resourceLoadStatistics/resources/util.js:
+        (async resetCookiesITP.setUp):
+        (async resetCookiesITP):
+        * http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html:
+        * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html:
+        * http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html:
+        * http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html:
+
 2021-10-21  Ayumi Kojima  <ayumi_koj...@apple.com>
 
         [ iOS macOS wk2 ]compositing/video/video-border-radius-clipping.html is a flakey image failure.

Added: trunk/LayoutTests/http/tests/cookies/resources/delete-cookie.py (0 => 284631)


--- trunk/LayoutTests/http/tests/cookies/resources/delete-cookie.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/resources/delete-cookie.py	2021-10-21 18:26:12 UTC (rev 284631)
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from datetime import datetime, timedelta
+from urllib.parse import parse_qs
+
+file = __file__.split(':/cygwin')[-1]
+http_root = os.path.dirname(os.path.dirname(os.path.abspath(os.path.dirname(file))))
+sys.path.insert(0, http_root)
+
+from resources.portabilityLayer import get_cookies
+
+cookies = get_cookies()
+
+
+def delete_cookie(name):
+    expires = datetime.utcnow() - timedelta(seconds=86400)
+    sys.stdout.write('Set-Cookie: {}=deleted; expires={} GMT; Max-Age=0; path=/\r\n'.format(name, expires.strftime('%a, %d-%b-%Y %H:%M:%S')))
+
+
+query_function = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True).get('queryfunction', [''])[0]
+
+sys.stdout.write('Content-Type: text/html\r\n')
+
+for cookie in cookies.keys():
+    delete_cookie(cookie)
+
+sys.stdout.write('\r\n<script>parent.postMessage(\'done\', \'*\');</script>\n')
Property changes on: trunk/LayoutTests/http/tests/cookies/resources/delete-cookie.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-not-removed-with-user-interaction-6-days-ago.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -230,10 +230,10 @@
     const otherOrigin = "http://localhost:8000"
     const topFrameOrigin = "http://127.0.0.2:8000";
     const timeStamp = Math.round((new Date()).getTime() / 1000);
-    function finishTest() {
+    async function finishTest() {
         if (!testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
             addOutput("FAIL: " + originUnderTest + " doesn't have user interaction after processing.");
-        resetCookies();
+        await resetCookiesITP();
         setEnableFeature(false, function() {
             testRunner.notifyDone();
         });

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-but-cookies-removed-with-user-interaction-7-days-ago.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -230,10 +230,10 @@
     const otherOrigin = "http://localhost:8000"
     const topFrameOrigin = "http://127.0.0.2:8000";
     const timeStamp = Math.round((new Date()).getTime() / 1000);
-    function finishTest() {
+    async function finishTest() {
         if (!testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
             addOutput("FAIL: " + originUnderTest + " doesn't have user interaction after processing.");
-        resetCookies();
+        await resetCookiesITP();
         setEnableFeature(false, function() {
             testRunner.notifyDone();
         });

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/operating-dates-all-website-data-removed.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -227,10 +227,10 @@
     }
 
     const originUnderTest  = "http://127.0.0.1:8000";
-    function finishTest() {
+    async function finishTest() {
         if (testRunner.isStatisticsHasHadUserInteraction(originUnderTest))
             addOutput("FAIL: " + originUnderTest + " still has user interaction after processing.");
-        resetCookies();
+        await resetCookiesITP();
         setEnableFeature(false, function() {
             testRunner.notifyDone();
         });

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/resources/util.js	2021-10-21 18:26:12 UTC (rev 284631)
@@ -13,3 +13,37 @@
         });
     }
 }
+
+async function resetCookiesITP() {
+    var testURL = "http://127.0.0.1:8000";
+    console.assert(testURL == document.location.origin);
+
+    function setUp() {
+        return new Promise((resolve) => {
+            if (window.testRunner) {
+                testRunner.setAlwaysAcceptCookies(true);
+            }
+            resolve();
+        });
+    }
+
+    function cleanUp() {
+        return new Promise((resolve) => {
+            if (window.testRunner)
+                testRunner.setAlwaysAcceptCookies(false);
+            resolve();
+        });
+    }
+
+    let promise = setUp();
+    promise = promise.then(() => {
+        return new Promise((resolve, reject) => {
+            window.addEventListener("message", (messageEvent) => resolve(messageEvent), {capture: true, once: true});
+            const element = document.createElement("iframe");
+            element.src = ""
+            document.body.appendChild(element);
+        });
+    });
+    return promise.then(cleanUp);
+}
+

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/standalone-web-application-exempt-from-website-data-deletion.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -228,8 +228,8 @@
         });
     }
 
-    function finishTest() {
-        resetCookies();
+    async function finishTest() {
+        await resetCookiesITP();
         testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
             setEnableFeature(false, function() {
                 testRunner.notifyDone();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -227,8 +227,8 @@
         });
     }
 
-    function finishTest() {
-        resetCookies();
+    async function finishTest() {
+        await resetCookiesITP();
         testRunner.dumpResourceLoadStatistics();
         setEnableFeature(false, function() {
             testRunner.notifyDone();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-with-user-interaction.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -227,8 +227,8 @@
         });
     }
 
-    function finishTest() {
-        resetCookies();
+    async function finishTest() {
+        await resetCookiesITP();
         testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
             setEnableFeature(false, function() {
                 testRunner.notifyDone();

Modified: trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html (284630 => 284631)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html	2021-10-21 18:25:04 UTC (rev 284630)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-without-user-interaction.html	2021-10-21 18:26:12 UTC (rev 284631)
@@ -227,8 +227,8 @@
         });
     }
 
-    function finishTest() {
-        resetCookies();
+    async function finishTest() {
+        await resetCookiesITP();
         testRunner.setStatisticsFirstPartyWebsiteDataRemovalMode(false, function() {
             setEnableFeature(false, function() {
                 testRunner.notifyDone();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to