Title: [273648] trunk/LayoutTests
Revision
273648
Author
[email protected]
Date
2021-03-01 06:22:49 -0800 (Mon, 01 Mar 2021)

Log Message

[LayoutTests] Convert http/tests/fetch convert PHP to Python
https://bugs.webkit.org/show_bug.cgi?id=222367
<rdar://problem/74702641>

Reviewed by Jonathan Bedard.

* http/tests/fetch/caching-with-different-options.html:
* http/tests/fetch/redirectmode-and-preload-expected.txt:
* http/tests/fetch/redirectmode-and-preload.html:
* http/tests/fetch/resources/redirect-with-cache.php: Removed.
* http/tests/fetch/resources/redirect-with-cache.py: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273647 => 273648)


--- trunk/LayoutTests/ChangeLog	2021-03-01 14:22:35 UTC (rev 273647)
+++ trunk/LayoutTests/ChangeLog	2021-03-01 14:22:49 UTC (rev 273648)
@@ -1,3 +1,17 @@
+2021-03-01  Chris Gambrell  <[email protected]>
+
+        [LayoutTests] Convert http/tests/fetch convert PHP to Python
+        https://bugs.webkit.org/show_bug.cgi?id=222367
+        <rdar://problem/74702641>
+
+        Reviewed by Jonathan Bedard.
+
+        * http/tests/fetch/caching-with-different-options.html:
+        * http/tests/fetch/redirectmode-and-preload-expected.txt:
+        * http/tests/fetch/redirectmode-and-preload.html:
+        * http/tests/fetch/resources/redirect-with-cache.php: Removed.
+        * http/tests/fetch/resources/redirect-with-cache.py: Added.
+
 2021-03-01  Youenn Fablet  <[email protected]>
 
         [GPUP] Fix WebRTC layout test failures with GPU Process enabled

Modified: trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html (273647 => 273648)


--- trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html	2021-03-01 14:22:35 UTC (rev 273647)
+++ trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html	2021-03-01 14:22:49 UTC (rev 273648)
@@ -13,7 +13,7 @@
     <div id="test"></div>
     <script>
 
-var redirectUrl = "./resources/redirect-with-cache.php?url=""
+var redirectUrl = "./resources/redirect-with-cache.py?url=""
 function redirectMode(test, redirect, urlSuffix) {
   var requestInit = {"redirect": redirect};
   requestInit.headers = [["enablecaching", "true"]];

Modified: trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload-expected.txt (273647 => 273648)


--- trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload-expected.txt	2021-03-01 14:22:35 UTC (rev 273647)
+++ trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload-expected.txt	2021-03-01 14:22:49 UTC (rev 273648)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://127.0.0.1:8000/fetch/resources/redirect-with-cache.php?enableCaching&url=""
-CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8000/fetch/resources/redirect-with-cache.php?enableCaching&url="" due to access control checks.
+CONSOLE MESSAGE: Not allowed to follow a redirection while loading http://127.0.0.1:8000/fetch/resources/redirect-with-cache.py?enableCaching&url=""
+CONSOLE MESSAGE: Fetch API cannot load http://127.0.0.1:8000/fetch/resources/redirect-with-cache.py?enableCaching&url="" due to access control checks.
 
 PASS Fetch should check for redirections even if resource is preloaded (different fetch mode, different redirect mode)
 PASS Fetch should check for redirections even if resource is preloaded (different fetch mode, different redirect mode) 2

Modified: trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload.html (273647 => 273648)


--- trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload.html	2021-03-01 14:22:35 UTC (rev 273647)
+++ trunk/LayoutTests/http/tests/fetch/redirectmode-and-preload.html	2021-03-01 14:22:49 UTC (rev 273648)
@@ -8,13 +8,13 @@
     <meta name="author" title="Canon Research France" href=""
     <script src=""
     <script src=""
-    <link rel=preload as=fetch _onload_="startTests()" href=""
+    <link rel=preload as=fetch _onload_="startTests()" href=""
   </head>
   <body>
     <script>
 function startTests()
 {
-    var preloadUrl = "./resources/redirect-with-cache.php?enableCaching&url=""
+    var preloadUrl = "./resources/redirect-with-cache.py?enableCaching&url=""
 
     promise_test(function(test) {
         return fetch(preloadUrl, {redirect: "manual", mode: "cors", credentials: "include"}).then((response) => {

Deleted: trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php (273647 => 273648)


--- trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php	2021-03-01 14:22:35 UTC (rev 273647)
+++ trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php	2021-03-01 14:22:49 UTC (rev 273648)
@@ -1,14 +0,0 @@
-<?php
-    $url = ""
-
-    $enableCaching = isset($_SERVER["ENABLECACHING"]) || isset($_GET["enableCaching"]) ? true : false;
-    $code = isset($_GET["code"]) ? $_GET["code"] : 302;
-
-    header("HTTP/1.1 $code");
-    header("Location: $url");
-
-    if ($enableCaching)
-        header("Cache-Control: max-age=31536000");
-    else
-        header("Cache-Control: no-store");
-?>

Added: trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.py (0 => 273648)


--- trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.py	2021-03-01 14:22:49 UTC (rev 273648)
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+from urllib.parse import parse_qs
+
+query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True)
+url = "" [''])[0]
+code = int(query.get('code', [302])[0])
+
+sys.stdout.write(
+    'status: {}\r\n'
+    'Location: {}\r\n'
+    'Content-Type: text/html\r\n'.format(code, url)
+)
+
+if 'ENABLECACHING' in os.environ.keys() or 'enableCaching' in query.keys():
+    sys.stdout.write('Cache-Control: max-age=31536000\r\n\r\n')
+else:
+    sys.stdout.write('Cache-Control: no-store\r\n\r\n')
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to