Title: [275424] trunk/LayoutTests
Revision
275424
Author
[email protected]
Date
2021-04-02 10:01:06 -0700 (Fri, 02 Apr 2021)

Log Message

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

Reviewed by Alex Christensen.

* http/tests/multipart/invalid-image-data-standalone.html:
* http/tests/multipart/invalid-image-data.html:
* http/tests/multipart/multipart-async-image.html:
* http/tests/multipart/multipart-image.html:
* http/tests/multipart/resources/multipart.php: Removed.
* http/tests/multipart/resources/multipart.py: Added.
(send_part):
* http/tests/multipart/stop-crash.html:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275423 => 275424)


--- trunk/LayoutTests/ChangeLog	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/ChangeLog	2021-04-02 17:01:06 UTC (rev 275424)
@@ -1,3 +1,20 @@
+2021-04-02  Chris Gambrell  <[email protected]>
+
+        [LayoutTests] Convert http/tests/multipart convert PHP to Python
+        https://bugs.webkit.org/show_bug.cgi?id=223475
+        <rdar://problem/75587716>
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/multipart/invalid-image-data-standalone.html:
+        * http/tests/multipart/invalid-image-data.html:
+        * http/tests/multipart/multipart-async-image.html:
+        * http/tests/multipart/multipart-image.html:
+        * http/tests/multipart/resources/multipart.php: Removed.
+        * http/tests/multipart/resources/multipart.py: Added.
+        (send_part):
+        * http/tests/multipart/stop-crash.html:
+
 2021-04-02  Carlos Alberto Lopez Perez  <[email protected]>
 
         [GTK][WPE] Gardening of flaky tests

Modified: trunk/LayoutTests/http/tests/multipart/invalid-image-data-standalone.html (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/invalid-image-data-standalone.html	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/invalid-image-data-standalone.html	2021-04-02 17:01:06 UTC (rev 275424)
@@ -19,6 +19,6 @@
     <p>
         There should be a green square below.
     </p>
-    <iframe width="120" height="120" src="" _onload_="loadedFirstPart()"></iframe>
+    <iframe width="120" height="120" src="" _onload_="loadedFirstPart()"></iframe>
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/multipart/invalid-image-data.html (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/invalid-image-data.html	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/invalid-image-data.html	2021-04-02 17:01:06 UTC (rev 275424)
@@ -19,6 +19,6 @@
     <p>
         There should be a bright green square below.
     </p>
-    <img width="100" height="100" src="" _onload_="loadedFirstPart()">
+    <img width="100" height="100" src="" _onload_="loadedFirstPart()">
 </body>
 </html>

Modified: trunk/LayoutTests/http/tests/multipart/multipart-async-image.html (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/multipart-async-image.html	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/multipart-async-image.html	2021-04-02 17:01:06 UTC (rev 275424)
@@ -8,7 +8,7 @@
         function multipartUrl() {
             var relativePath = "../../../../fast/images/resources/";
  
-            return "resources/multipart.php"
+            return "resources/multipart.py"
                     + "?interval=0.1"
                     + "&img1=" + relativePath + "red-100x100.png"
                     + "&img2=" + relativePath + "green-400x400.png"

Modified: trunk/LayoutTests/http/tests/multipart/multipart-image.html (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/multipart-image.html	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/multipart-image.html	2021-04-02 17:01:06 UTC (rev 275424)
@@ -25,5 +25,5 @@
     The last image is repeated due to https://bugs.webkit.org/show_bug.cgi?id=36536, which causes last part to not render. 
     It's repeated three times because otherwise the test didn't pass in 10.8, for an unknown mysterious reason.
 -->
-<img id=test src="" _onload_="loadedFirstPart()">
+<img id=test src="" _onload_="loadedFirstPart()">
 </html>

Deleted: trunk/LayoutTests/http/tests/multipart/resources/multipart.php (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/resources/multipart.php	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/resources/multipart.php	2021-04-02 17:01:06 UTC (rev 275424)
@@ -1,40 +0,0 @@
-<?php
-    set_time_limit(0);
-    $boundary = "cutHere";
-
-    function sendPart($data)
-    {
-        global $boundary;
-
-        echo("Content-Type: image/png\r\n\r\n");
-        echo($data);
-        echo("\r\n--$boundary\r\n");
-        flush();
-    }
-
-    $i = 1;
-    while ($img = $_GET['img' . $i]) {
-        $images[$i] = file_get_contents($img);
-        $i++;
-    }
-
-    if (isset($_GET['interval']))
-        $interval = $_GET['interval'] * 1000000;
-    else
-        $interval = 1000000;
-
-    header("Content-Type: multipart/x-mixed-replace; boundary=$boundary");
-
-    echo("--$boundary\r\n");
-
-    ob_end_flush();
-    do {
-        for ($k = 1; $k < $i; $k++) {
-            sendPart($images[$k]);
-            usleep($interval);
-        }
-    } while ($_GET['loop']);
-
-    if (isset($_GET['wait']))
-        usleep($_GET['wait'] * 1000000);
-?>

Added: trunk/LayoutTests/http/tests/multipart/resources/multipart.py (0 => 275424)


--- trunk/LayoutTests/http/tests/multipart/resources/multipart.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/multipart/resources/multipart.py	2021-04-02 17:01:06 UTC (rev 275424)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import time
+from urllib.parse import parse_qs
+
+boundary = 'cutHere'
+def send_part(data):
+    sys.stdout.write('Content-Type: image/png\r\n\r\n')
+    sys.stdout.flush()
+    sys.stdout.buffer.write(data)
+    sys.stdout.write('\r\n--{}\r\n'.format(boundary))
+    sys.stdout.flush()
+
+query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True)
+interval = query.get('interval', [None])[0]
+loop = query.get('loop', [None])[0]
+wait = query.get('wait', [None])[0]
+
+i = 1
+images = []
+while True:
+    img = query.get('img{}'.format(i), [None])[0]
+    if img is None:
+        break
+
+    with open(os.path.join('/'.join(__file__.split('/')[0:-1]), img), 'rb') as file:
+        images.append(file.read())
+    i += 1
+
+if interval is not None:
+    interval = float(interval)
+else:
+    interval = 1
+
+sys.stdout.write(
+    'Content-Type: multipart/x-mixed-replace; boundary={boundary}\r\n\r\n'
+    '--{boundary}\r\n'.format(boundary=boundary)
+)
+sys.stdout.flush()
+
+while True:
+    for k in range(1, i):
+        send_part(images[k - 1])
+        time.sleep(interval)
+
+    if loop is None:
+        break
+
+if wait is not None:
+    time.sleep(float(wait))
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/multipart/resources/multipart.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/http/tests/multipart/stop-crash.html (275423 => 275424)


--- trunk/LayoutTests/http/tests/multipart/stop-crash.html	2021-04-02 16:48:51 UTC (rev 275423)
+++ trunk/LayoutTests/http/tests/multipart/stop-crash.html	2021-04-02 17:01:06 UTC (rev 275424)
@@ -23,7 +23,7 @@
     <p>
         If WebKit does not assert or crash after the test, then it passed.
     </p>
-    <img width=24 height=24 src="" _onload_="firstPartLoaded()">
+    <img width=24 height=24 src="" _onload_="firstPartLoaded()">
     <p id="results"></p>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to