Move http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html off of testRu...
authorwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2019 20:10:23 +0000 (20:10 +0000)
committerwilander@apple.com <wilander@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Jun 2019 20:10:23 +0000 (20:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198863
<rdar://problem/47854589>

Unreviewed test gardening.

testRunner.setAlwaysAcceptCookies() is not working right (tracked
in rdar://problem/51757107). Therefore, we need to change
http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
to make it work properly.

* http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt:
* http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt
LayoutTests/http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html

index 2a772e8..077bf6c 100644 (file)
@@ -1,3 +1,19 @@
+2019-06-14  John Wilander  <wilander@apple.com>
+
+        Move http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html off of testRunner.setAlwaysAcceptCookies()
+        https://bugs.webkit.org/show_bug.cgi?id=198863
+        <rdar://problem/47854589>
+
+        Unreviewed test gardening.
+
+        testRunner.setAlwaysAcceptCookies() is not working right (tracked
+        in rdar://problem/51757107). Therefore, we need to change
+        http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
+        to make it work properly.
+
+        * http/tests/resourceLoadStatistics/remove-blocking-in-redirect-expected.txt:
+        * http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html:
+
 2019-06-14  Saam Barati  <sbarati@apple.com>
 
         [WHLSL] Implement out-of-bounds and nullptr behavior
index fea8232..400a49e 100644 (file)
@@ -11,43 +11,41 @@ TEST COMPLETE
 --------
 Frame: '<!--frame1-->'
 --------
-Set cookie.
-
+Should receive first-party cookie for localhost.
+Did not receive cookie named 'firstPartyCookieIP'.
+Received cookie named 'firstPartyCookieLocalhost'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie: firstPartyCookieLocalhost=localhost
 
 --------
 Frame: '<!--frame2-->'
 --------
-Should receive first-party cookie.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=value
-
---------
-Frame: '<!--frame3-->'
---------
 Redirect case 1, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1
+Received cookie named 'firstPartyCookieIP'.
+Did not receive cookie named 'firstPartyCookieLocalhost'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie: firstPartyCookieIP=127.0.0.1
 
 --------
-Frame: '<!--frame4-->'
+Frame: '<!--frame3-->'
 --------
-Try to set third-party cookie in blocked mode.
+Try to set third-party cookie for localhost in blocked mode.
 
 
 --------
-Frame: '<!--frame5-->'
+Frame: '<!--frame4-->'
 --------
 Should receive no cookie.
-Did not receive cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
+Did not receive cookie named 'firstPartyCookieIP'.
+Did not receive cookie named 'firstPartyCookieLocalhost'.
+Did not receive cookie named 'thirdPartyCookie'.
 Client-side document.cookie:
 
 --------
-Frame: '<!--frame6-->'
+Frame: '<!--frame5-->'
 --------
 Redirect case 2, should receive first-party cookie for 127.0.0.1.
-Received cookie named 'firstPartyCookie'.
-Did not receive cookie named 'partitionedCookie'.
-Client-side document.cookie: firstPartyCookie=127.0.0.1
+Received cookie named 'firstPartyCookieIP'.
+Did not receive cookie named 'firstPartyCookieLocalhost'.
+Did not receive cookie named 'thirdPartyCookie'.
+Client-side document.cookie: firstPartyCookieIP=127.0.0.1
index f103b7b..e00ca36 100644 (file)
     const thirdPartyOrigin = "http://localhost:8000";
     const resourcePath = "/resourceLoadStatistics/resources";
     const thirdPartyBaseUrl = thirdPartyOrigin + resourcePath;
-    const firstPartyCookieName = "firstPartyCookie";
-    const subPathToSetFirstPartyCookie = "/set-cookie.php?name=" + firstPartyCookieName + "&value=value";
-    const partitionedCookieName = "partitionedCookie";
-    const subPathToSetPartitionedCookie = "/set-cookie.php?name=" + partitionedCookieName + "&value=value";
-    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName + "&name2=" + partitionedCookieName;
+    const firstPartyCookieNamePrefix = "firstPartyCookie";
+    const firstPartyCookieNameIP = firstPartyCookieNamePrefix + "IP";
+    const firstPartyCookieNameLocalhost = firstPartyCookieNamePrefix + "Localhost";
+    const thirdPartyCookieName = "thirdPartyCookie";
+    const subPathToSetThirdPartyCookie = "/set-cookie.php?name=" + thirdPartyCookieName + "&value=value";
+    const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieNameIP + "&name2=" + firstPartyCookieNameLocalhost + "&name3=" + thirdPartyCookieName;
     const redirectChainUrl = thirdPartyOrigin + resourcePath + "/redirect.php?redirectTo=http://" + partitionHost + resourcePath + subPathToGetCookies;
 
     function openIframe(url, onLoadHandler) {
         switch (document.location.hash) {
             case "#step1":
                 // Set first-party cookies for 127.0.0.1 and localhost.
-                document.location.hash = "step2";
-                document.cookie = firstPartyCookieName + "=127.0.0.1;path='/'";
-                if (window.testRunner)
-                    testRunner.setAlwaysAcceptCookies(true);
-                openIframe(thirdPartyBaseUrl + subPathToSetFirstPartyCookie + "&message=Set cookie.", runTest);
+                if (document.location.origin === thirdPartyOrigin) {
+                    document.cookie = firstPartyCookieNameLocalhost + "=localhost;path='/'";
+                    document.location.href = "http://127.0.0.1:8000/resourceLoadStatistics/remove-blocking-in-redirect.html#step2";
+                } else {
+                    document.cookie = firstPartyCookieNameIP + "=127.0.0.1;path='/'";
+                    document.location.href = "http://localhost:8000/resourceLoadStatistics/remove-blocking-in-redirect.html#step1";
+                }
                 break;
             case "#step2":
                 // Check that the cookie gets sent for localhost under 127.0.0.1 since localhost is not prevalent.
                 document.location.hash = "step3";
-                if (window.testRunner)
-                    testRunner.setAlwaysAcceptCookies(false);
-                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie.", runTest);
+                openIframe(thirdPartyBaseUrl + subPathToGetCookies + "&message=Should receive first-party cookie for localhost.", runTest);
                 break;
             case "#step3":
                 document.location.hash = "step4";
@@ -64,7 +65,7 @@
             case "#step5":
                 // Try to set partitioned cookie for localhost under 127.0.0.1.
                 document.location.hash = "step6";
-                openIframe(thirdPartyBaseUrl + subPathToSetPartitionedCookie + "&message=Try to set third-party cookie in blocked mode.", runTest);
+                openIframe(thirdPartyBaseUrl + subPathToSetThirdPartyCookie + "&message=Try to set third-party cookie for localhost in blocked mode.", runTest);
                 break;
             case "#step6":
                 // Check that no cookie gets sent for localhost under 127.0.0.1 since localhost's cookies are blocked.