Title: [274962] trunk/LayoutTests
Revision
274962
Author
cgambr...@apple.com
Date
2021-03-24 12:42:05 -0700 (Wed, 24 Mar 2021)

Log Message

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

Reviewed by Jonathan Bedard.

* TestExpectations:
* http/tests/preload/download_resources_from_header_iframe.html:
* http/tests/preload/link-header-on-subresource-expected.txt:
* http/tests/preload/link-header-on-subresource.html:
* http/tests/preload/preload-encoding.php: Removed.
* http/tests/preload/preload-encoding.py: Added.
* http/tests/preload/resources/download_resources_from_header.php: Removed.
* http/tests/preload/resources/download_resources_from_header.py: Added.
* http/tests/preload/resources/dummy-preloads-subresource.css.php: Removed.
* http/tests/preload/resources/dummy-preloads-subresource.css.py: Added.
* http/tests/preload/single_download_preload_headers.php: Removed.
* http/tests/preload/single_download_preload_headers.py: Added.
* http/tests/preload/single_download_preload_headers_charset.php: Removed.
* http/tests/preload/single_download_preload_headers_charset.py: Added.
* http/tests/preload/viewport/meta-viewport-link-headers.php: Removed.
* http/tests/preload/viewport/meta-viewport-link-headers.py: Added.
* platform/ios/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274961 => 274962)


--- trunk/LayoutTests/ChangeLog	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/ChangeLog	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,3 +1,30 @@
+2021-03-24  Chris Gambrell  <cgambr...@apple.com>
+
+        [LayoutTests] Convert http/tests/preload convert PHP to Python
+        https://bugs.webkit.org/show_bug.cgi?id=223602
+        <rdar://problem/75709989>
+
+        Reviewed by Jonathan Bedard.
+
+        * TestExpectations:
+        * http/tests/preload/download_resources_from_header_iframe.html:
+        * http/tests/preload/link-header-on-subresource-expected.txt:
+        * http/tests/preload/link-header-on-subresource.html:
+        * http/tests/preload/preload-encoding.php: Removed.
+        * http/tests/preload/preload-encoding.py: Added.
+        * http/tests/preload/resources/download_resources_from_header.php: Removed.
+        * http/tests/preload/resources/download_resources_from_header.py: Added.
+        * http/tests/preload/resources/dummy-preloads-subresource.css.php: Removed.
+        * http/tests/preload/resources/dummy-preloads-subresource.css.py: Added.
+        * http/tests/preload/single_download_preload_headers.php: Removed.
+        * http/tests/preload/single_download_preload_headers.py: Added.
+        * http/tests/preload/single_download_preload_headers_charset.php: Removed.
+        * http/tests/preload/single_download_preload_headers_charset.py: Added.
+        * http/tests/preload/viewport/meta-viewport-link-headers.php: Removed.
+        * http/tests/preload/viewport/meta-viewport-link-headers.py: Added.
+        * platform/ios/TestExpectations:
+        * platform/win/TestExpectations:
+
 2021-03-24  Robert Jenner  <jen...@apple.com>
 
         Remove unused JS and CSS files of media controls

Modified: trunk/LayoutTests/TestExpectations (274961 => 274962)


--- trunk/LayoutTests/TestExpectations	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/TestExpectations	2021-03-24 19:42:05 UTC (rev 274962)
@@ -2577,7 +2577,7 @@
 ### END OF display: contents failures
 ########################################
 
-webkit.org/b/170122 http/tests/preload/single_download_preload_headers_charset.php [ Pass Failure ]
+webkit.org/b/170122 http/tests/preload/single_download_preload_headers_charset.py [ Pass Failure ]
 
 ########################################
 ### START OF -disabled tests

Modified: trunk/LayoutTests/http/tests/preload/download_resources_from_header_iframe.html (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/download_resources_from_header_iframe.html	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/download_resources_from_header_iframe.html	2021-03-24 19:42:05 UTC (rev 274962)
@@ -5,5 +5,5 @@
         testRunner.dumpChildFramesAsText();
     }
 </script>
-<iframe src=""
+<iframe src=""
 

Modified: trunk/LayoutTests/http/tests/preload/link-header-on-subresource-expected.txt (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/link-header-on-subresource-expected.txt	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/link-header-on-subresource-expected.txt	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: Did not parse stylesheet at 'http://127.0.0.1:8000/preload/resources/dummy-preloads-subresource.css.php' because non CSS MIME types are not allowed in strict mode.
+CONSOLE MESSAGE: Did not parse stylesheet at 'http://127.0.0.1:8000/preload/resources/dummy-preloads-subresource.css.py' because non CSS MIME types are not allowed in strict mode.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/http/tests/preload/link-header-on-subresource.html (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/link-header-on-subresource.html	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/link-header-on-subresource.html	2021-03-24 19:42:05 UTC (rev 274962)
@@ -6,7 +6,7 @@
     }
 </script>
 <script src=""
-<link rel=stylesheet href=""
+<link rel=stylesheet href=""
 <script>
     setInterval(function() {
         if (internals.isPreloaded("../resources/dummy.js") && internals.isPreloaded("../resources/dummy.js?media"))

Deleted: trunk/LayoutTests/http/tests/preload/preload-encoding.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/preload-encoding.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/preload-encoding.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,31 +0,0 @@
-<?php
-header("Link: <resources/success.js>; rel=preload; as=script", false);
-?>
-<script src=""
-<script>
-jsTestIsAsync = true;
-
-description("First load a script with a wrong charset then again with the right one. Second attempt should work and 'scriptSuccess' should be set to true. 'successfullyParsed' will be undefined.");
-
-function appendScriptWithCharset(charset, onload)
-{
-    var script = document.createElement("script");
-    script.src = ""
-    script.setAttribute("charset", charset);
-    script._onload_ = onload;
-    script._onerror_ = onload;
-    document.body.appendChild(script);
-}
-
-function test()
-{
-    appendScriptWithCharset("utf-16", function () {
-        appendScriptWithCharset("utf-8", function () {
-            shouldBeTrue("scriptSuccess");
-            finishJSTest();
-        });
-    });
-}
-</script>
-<body _onload_="test()">
-<script src=""

Copied: trunk/LayoutTests/http/tests/preload/preload-encoding.py (from rev 274961, trunk/LayoutTests/http/tests/preload/preload-encoding.php) (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/preload-encoding.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/preload-encoding.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <resources/success.js>; rel=preload; as=script\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+print('''<script src=""
+<script>
+jsTestIsAsync = true;
+
+description("First load a script with a wrong charset then again with the right one. Second attempt should work and 'scriptSuccess' should be set to true. 'successfullyParsed' will be undefined.");
+
+function appendScriptWithCharset(charset, onload)
+{
+    var script = document.createElement("script");
+    script.src = ""
+    script.setAttribute("charset", charset);
+    script._onload_ = onload;
+    script._onerror_ = onload;
+    document.body.appendChild(script);
+}
+
+function test()
+{
+    appendScriptWithCharset("utf-16", function () {
+        appendScriptWithCharset("utf-8", function () {
+            shouldBeTrue("scriptSuccess");
+            finishJSTest();
+        });
+    });
+}
+</script>
+<body _onload_="test()">
+<script src=""
\ No newline at end of file

Property changes: trunk/LayoutTests/http/tests/preload/preload-encoding.py


Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,26 +0,0 @@
-<?php
-header("Link: <../resources/dummy.js>; rel=preload; as=script", false);
-header("LiNk:<../resources/dummy.css>; rel=preload; as=style", false);
-header("Link: <../resources/square.png>;rel=preload;as=image", false);
-header("Link: <../resources/Ahem.ttf>; rel=preload; as=font; crossorigin", false);
-header("Link: <../resources/test.mp4>; rel=preload; as=video", false);
-header("Link: <../resources/test.oga>; rel=preload; as=audio", false);
-header("link: <../security/resources/captions.vtt>; rel=preload; as=track", false);
-header("Link: <../resources/dummy.xml?badvalue>; rel=preload; as=foobar", false);
-header("Link: <../resources/dummy.xml?empty>; rel=preload", false);
-header("Link: <../resources/dummy.xml>; rel=preload;as=fetch", false);
-?>
-<!DOCTYPE html>
-<script src=""
-<script>
-    shouldBeTrue("internals.isPreloaded('../resources/dummy.js');");
-    shouldBeTrue("internals.isPreloaded('../resources/dummy.css');");
-    shouldBeTrue("internals.isPreloaded('../resources/square.png');");
-    shouldBeTrue("internals.isPreloaded('../resources/Ahem.ttf');");
-    shouldBeTrue("internals.isPreloaded('../resources/test.mp4');");
-    shouldBeTrue("internals.isPreloaded('../resources/test.oga');");
-    shouldBeTrue("internals.isPreloaded('../security/resources/captions.vtt');");
-    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
-    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?empty');");
-    shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
-</script>

Added: trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.py (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <../resources/dummy.js>; rel=preload; as=script\r\n'
+    'LiNk:<../resources/dummy.css>; rel=preload; as=style\r\n'
+    'Link: <../resources/square.png>;rel=preload;as=image\r\n'
+    'Link: <../resources/Ahem.ttf>; rel=preload; as=font; crossorigin\r\n'
+    'Link: <../resources/test.mp4>; rel=preload; as=video\r\n'
+    'Link: <../resources/test.oga>; rel=preload; as=audio\r\n'
+    'link: <../security/resources/captions.vtt>; rel=preload; as=track\r\n'
+    'Link: <../resources/dummy.xml?badvalue>; rel=preload; as=foobar\r\n'
+    'Link: <../resources/dummy.xml?empty>; rel=preload\r\n'
+    'Link: <../resources/dummy.xml>; rel=preload;as=fetch\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+print('''<!DOCTYPE html>
+<script src=""
+<script>
+    shouldBeTrue("internals.isPreloaded('../resources/dummy.js');");
+    shouldBeTrue("internals.isPreloaded('../resources/dummy.css');");
+    shouldBeTrue("internals.isPreloaded('../resources/square.png');");
+    shouldBeTrue("internals.isPreloaded('../resources/Ahem.ttf');");
+    shouldBeTrue("internals.isPreloaded('../resources/test.mp4');");
+    shouldBeTrue("internals.isPreloaded('../resources/test.oga');");
+    shouldBeTrue("internals.isPreloaded('../security/resources/captions.vtt');");
+    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?badvalue');");
+    shouldBeFalse("internals.isPreloaded('../resources/dummy.xml?empty');");
+    shouldBeTrue("internals.isPreloaded('../resources/dummy.xml');");
+</script>''')
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/preload/resources/download_resources_from_header.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,6 +0,0 @@
-<?php
-header("Link: <../resources/dummy.js>; rel=preload; as=script", false);
-header("Link: <../resources/dummy.js?media>; rel=preload; as=script; media=all", false);
-?>
-/* This is just a dummy, empty CSS file */
-

Added: trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.py (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <../resources/dummy.js>; rel=preload; as=script\r\n'
+    'Link: <../resources/dummy.js?media>; rel=preload; as=script; media=all\r\n'
+    'Content-Type: text/html\r\n\r\n'
+    '/* This is just a dummy, empty CSS file */\n'
+)
\ No newline at end of file
Property changes on: trunk/LayoutTests/http/tests/preload/resources/dummy-preloads-subresource.css.py
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/preload/single_download_preload_headers.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/single_download_preload_headers.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/single_download_preload_headers.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,63 +0,0 @@
-<?php
-header("Link: <http://127.0.0.1:8000/resources/dummy.js>; rel=preload; as=script", false);
-header("LiNk:<http://127.0.0.1:8000/resources/dummy.css>; rel=preload; as=style", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png>;rel=preload;as=image", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png?background>;rel=preload;as=image", false);
-header("Link: <http://127.0.0.1:8000/resources/Ahem.woff>; rel=preload; as=font; crossorigin", false);
-header("Link: <http://127.0.0.1:8000/resources/test.mp4>; rel=preload; as=video", false);
-header("Link: <http://127.0.0.1:8000/resources/test.oga>; rel=preload; as=audio", false);
-header("link: <http://127.0.0.1:8000/security/resources/captions.vtt>; rel=preload; as=track", false);
-header("Link: <http://127.0.0.1:8000/resources/dummy.xml?foobar>; rel=preload; as=foobar", false);
-header("Link: <http://127.0.0.1:8000/resources/dummy.xml>; as=fetch; crossorigin; rel=preload", false);
-?>
-<!DOCTYPE html>
-<script src=""
-<script src=""
-<script>
-    var t = async_test('Makes sure that preloaded resources are not downloaded again when used');
-</script>
-<script src=""
-<style>
-    #background {
-        width: 200px;
-        height: 200px;
-        background-image: url(http://127.0.0.1:8000/resources/square100.png?background);
-    }
-    @font-face {
-      font-family:ahem;
-      src: url(http://127.0.0.1:8000/resources/Ahem.woff);
-    }
-    span { font-family: ahem, Arial; }
-</style>
-<link rel="stylesheet" href=""
-<script src=""
-<div id="background"></div>
-<img src=""
-<video src=""
-    <track kind=subtitles src="" srclang=en>
-</video>
-<audio src=""
-<script>
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", "http://127.0.0.1:8000/resources/dummy.xml");
-    xhr.send();
-
-    window.addEventListener("load", t.step_func(function() {
-        function verifyDownloadNumber(url, number) {
-            assert_equals(performance.getEntriesByName(url).length, number, url);
-        }
-        setTimeout(t.step_func(function() {
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.js", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.css", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png?background", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/Ahem.woff", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml?foobar", 0);
-            verifyDownloadNumber("http://127.0.0.1:8000/security/resources/captions.vtt", 1);
-            // FIXME: XHR should trigger a single download, but it downloads 2 resources instead.
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml", 2);
-            // FIXME: We should verify for video and audio as well, but they seem to (flakily?) trigger multiple partial requests.
-            t.done();
-            }), 100);
-    }));
-</script>

Copied: trunk/LayoutTests/http/tests/preload/single_download_preload_headers.py (from rev 274961, trunk/LayoutTests/http/tests/preload/single_download_preload_headers.php) (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/single_download_preload_headers.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/single_download_preload_headers.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <http://127.0.0.1:8000/resources/dummy.js>; rel=preload; as=script\r\n'
+    'LiNk:<http://127.0.0.1:8000/resources/dummy.css>; rel=preload; as=style\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png>;rel=preload;as=image\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png?background>;rel=preload;as=image\r\n'
+    'Link: <http://127.0.0.1:8000/resources/Ahem.woff>; rel=preload; as=font; crossorigin\r\n'
+    'Link: <http://127.0.0.1:8000/resources/test.mp4>; rel=preload; as=video\r\n'
+    'Link: <http://127.0.0.1:8000/resources/test.oga>; rel=preload; as=audio\r\n'
+    'link: <http://127.0.0.1:8000/security/resources/captions.vtt>; rel=preload; as=track\r\n'
+    'Link: <http://127.0.0.1:8000/resources/dummy.xml?foobar>; rel=preload; as=foobar\r\n'
+    'Link: <http://127.0.0.1:8000/resources/dummy.xml>; as=fetch; crossorigin; rel=preload\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+print('''<!DOCTYPE html>
+<script src=""
+<script src=""
+<script>
+    var t = async_test('Makes sure that preloaded resources are not downloaded again when used');
+</script>
+<script src=""
+<style>
+    #background {
+        width: 200px;
+        height: 200px;
+        background-image: url(http://127.0.0.1:8000/resources/square100.png?background);
+    }
+    @font-face {
+      font-family:ahem;
+      src: url(http://127.0.0.1:8000/resources/Ahem.woff);
+    }
+    span { font-family: ahem, Arial; }
+</style>
+<link rel="stylesheet" href=""
+<script src=""
+<div id="background"></div>
+<img src=""
+<video src=""
+    <track kind=subtitles src="" srclang=en>
+</video>
+<audio src=""
+<script>
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", "http://127.0.0.1:8000/resources/dummy.xml");
+    xhr.send();
+
+    window.addEventListener("load", t.step_func(function() {
+        function verifyDownloadNumber(url, number) {
+            assert_equals(performance.getEntriesByName(url).length, number, url);
+        }
+        setTimeout(t.step_func(function() {
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.js", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.css", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png?background", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/Ahem.woff", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml?foobar", 0);
+            verifyDownloadNumber("http://127.0.0.1:8000/security/resources/captions.vtt", 1);
+            // FIXME: XHR should trigger a single download, but it downloads 2 resources instead.
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml", 2);
+            // FIXME: We should verify for video and audio as well, but they seem to (flakily?) trigger multiple partial requests.
+            t.done();
+            }), 100);
+    }));
+</script>''')
\ No newline at end of file

Property changes: trunk/LayoutTests/http/tests/preload/single_download_preload_headers.py


Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,64 +0,0 @@
-<?php
-header("Link: <http://127.0.0.1:8000/resources/dummy.js>; rel=preload; as=script", false);
-header("LiNk:<http://127.0.0.1:8000/resources/dummy.css>; rel=preload; as=style", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png>;rel=preload;as=image", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png?background>;rel=preload;as=image", false);
-header("Link: <http://127.0.0.1:8000/resources/Ahem.woff>; rel=preload; as=font; crossorigin", false);
-header("Link: <http://127.0.0.1:8000/resources/test.mp4>; rel=preload; as=video", false);
-header("Link: <http://127.0.0.1:8000/resources/test.oga>; rel=preload; as=audio", false);
-header("link: <http://127.0.0.1:8000/security/resources/captions.vtt>; rel=preload; as=track", false);
-header("Link: <http://127.0.0.1:8000/resources/dummy.xml?foobar>; rel=preload; as=foobar", false);
-header("Link: <http://127.0.0.1:8000/resources/dummy.xml>; crossorigin; rel=preload", false);
-?>
-<!DOCTYPE html>
-<meta charset="utf-8">
-<script src=""
-<script src=""
-<script>
-    var t = async_test('Makes sure that preloaded resources are not downloaded again when used');
-</script>
-<script src=""
-<style>
-    #background {
-        width: 200px;
-        height: 200px;
-        background-image: url(http://127.0.0.1:8000/resources/square100.png?background);
-    }
-    @font-face {
-      font-family:ahem;
-      src: url(http://127.0.0.1:8000/resources/Ahem.woff);
-    }
-    span { font-family: ahem, Arial; }
-</style>
-<link rel="stylesheet" href=""
-<script src=""
-<div id="background"></div>
-<img src=""
-<video src=""
-    <track kind=subtitles src="" srclang=en>
-</video>
-<audio src=""
-<script>
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", "http://127.0.0.1:8000/resources/dummy.xml");
-    xhr.send();
-
-    window.addEventListener("load", t.step_func(function() {
-        function verifyDownloadNumber(url, number) {
-            assert_equals(performance.getEntriesByName(url).length, number, url);
-        }
-        setTimeout(t.step_func(function() {
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.js", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.css", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png?background", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/Ahem.woff", 1);
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml?foobar", 0);
-            verifyDownloadNumber("http://127.0.0.1:8000/security/resources/captions.vtt", 1);
-            // FIXME: XHR should trigger a single download, but it downloads 2 resources instead.
-            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml", 2);
-            // FIXME: We should verify for video and audio as well, but they seem to (flakily?) trigger multiple partial requests.
-            t.done();
-            }), 100);
-    }));
-</script>

Copied: trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.py (from rev 274961, trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.php) (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <http://127.0.0.1:8000/resources/dummy.js>; rel=preload; as=script\r\n'
+    'Link:<http://127.0.0.1:8000/resources/dummy.css>; rel=preload; as=style\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png>;rel=preload;as=image\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png?background>;rel=preload;as=image\r\n'
+    'Link: <http://127.0.0.1:8000/resources/Ahem.woff>; rel=preload; as=font; crossorigin\r\n'
+    'Link: <http://127.0.0.1:8000/resources/test.mp4>; rel=preload; as=video\r\n'
+    'Link: <http://127.0.0.1:8000/resources/test.oga>; rel=preload; as=audio\r\n'
+    'Link: <http://127.0.0.1:8000/security/resources/captions.vtt>; rel=preload; as=track\r\n'
+    'Link: <http://127.0.0.1:8000/resources/dummy.xml?foobar>; rel=preload; as=foobar\r\n'
+    'Link: <http://127.0.0.1:8000/resources/dummy.xml>; crossorigin; rel=preload\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+print('''<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script>
+    var t = async_test('Makes sure that preloaded resources are not downloaded again when used');
+</script>
+<script src=""
+<style>
+    #background {
+        width: 200px;
+        height: 200px;
+        background-image: url(http://127.0.0.1:8000/resources/square100.png?background);
+    }
+    @font-face {
+      font-family:ahem;
+      src: url(http://127.0.0.1:8000/resources/Ahem.woff);
+    }
+    span { font-family: ahem, Arial; }
+</style>
+<link rel="stylesheet" href=""
+<script src=""
+<div id="background"></div>
+<img src=""
+<video src=""
+    <track kind=subtitles src="" srclang=en>
+</video>
+<audio src=""
+<script>
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", "http://127.0.0.1:8000/resources/dummy.xml");
+    xhr.send();
+
+    window.addEventListener("load", t.step_func(function() {
+        function verifyDownloadNumber(url, number) {
+            assert_equals(performance.getEntriesByName(url).length, number, url);
+        }
+        setTimeout(t.step_func(function() {
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.js", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.css", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/square100.png?background", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/Ahem.woff", 1);
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml?foobar", 0);
+            verifyDownloadNumber("http://127.0.0.1:8000/security/resources/captions.vtt", 1);
+            // FIXME: XHR should trigger a single download, but it downloads 2 resources instead.
+            verifyDownloadNumber("http://127.0.0.1:8000/resources/dummy.xml", 2);
+            // FIXME: We should verify for video and audio as well, but they seem to (flakily?) trigger multiple partial requests.
+            t.done();
+            }), 100);
+    }));
+</script>''')
\ No newline at end of file

Property changes: trunk/LayoutTests/http/tests/preload/single_download_preload_headers_charset.py


Added: svn:executable

+* \ No newline at end of property

Deleted: trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.php (274961 => 274962)


--- trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.php	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.php	2021-03-24 19:42:05 UTC (rev 274962)
@@ -1,45 +0,0 @@
-<?php
-header("Link: <http://127.0.0.1:8000/resources/square100.png?timer>;rel=preload;as=image;\"", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png?control>;rel=preload;as=image;\"", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png?large>;rel=preload;as=image;media=\"(min-width: 300px)\"", false);
-header("Link: <http://127.0.0.1:8000/resources/square100.png?small>;rel=preload;as=image;media=\"(max-width: 299px)\"", false);
-?>
-<!DOCTYPE html>
-<meta name="viewport" content="width=160">
-<script src=""
-<script src=""
-<script>
-    var t = async_test('Makes sure that Link headers support the media attribute and respond to <meta content=viewport>');
-    var img = new Image();
-    var counter = 20;
-    var timeout = 50;
-    img.addEventListener("load", t.step_func(function(){
-        var test = function() {
-            var entries = performance.getEntriesByType("resource");
-            var controlLoaded = false;
-            var smallLoaded = false;
-            var largeLoaded = false;
-            for (var i = 0; i < entries.length; ++i) {
-                if (entries[i].name.indexOf("control") != -1)
-                    controlLoaded = true;
-                else if (entries[i].name.indexOf("large") != -1)
-                    largeLoaded = true;
-                else if (entries[i].name.indexOf("small") != -1)
-                    smallLoaded = true;
-            }
-            // It's possible that due to network variance, these resource downloads didn't yet finish.
-            // If so, wait a bit longer (up to 1 second).
-            if (!(controlLoaded || smallLoaded) && counter) {
-                --counter;
-                t.step_timeout(test, timeout);
-            }
-
-            assert_true(controlLoaded, "The control element should be loaded");
-            assert_false(largeLoaded, "The large element should not be loaded");
-            assert_true(smallLoaded, "The small element should be loaded");
-            t.done();
-        };
-        t.step_timeout(test, timeout);
-    }));
-    img.src = ""
-</script>

Copied: trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.py (from rev 274961, trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.php) (0 => 274962)


--- trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.py	                        (rev 0)
+++ trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.py	2021-03-24 19:42:05 UTC (rev 274962)
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+import sys
+
+sys.stdout.write(
+    'Link: <http://127.0.0.1:8000/resources/square100.png?timer>;rel=preload;as=image;\"\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png?control>;rel=preload;as=image;\"\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png?large>;rel=preload;as=image;media=\"(min-width: 300px)\"\r\n'
+    'Link: <http://127.0.0.1:8000/resources/square100.png?small>;rel=preload;as=image;media=\"(max-width: 299px)\"\r\n'
+    'Content-Type: text/html\r\n\r\n'
+)
+
+print('''<!DOCTYPE html>
+<meta name="viewport" content="width=160">
+<script src=""
+<script src=""
+<script>
+    var t = async_test('Makes sure that Link headers support the media attribute and respond to <meta content=viewport>');
+    var img = new Image();
+    var counter = 20;
+    var timeout = 50;
+    img.addEventListener("load", t.step_func(function(){
+        var test = function() {
+            var entries = performance.getEntriesByType("resource");
+            var controlLoaded = false;
+            var smallLoaded = false;
+            var largeLoaded = false;
+            for (var i = 0; i < entries.length; ++i) {
+                if (entries[i].name.indexOf("control") != -1)
+                    controlLoaded = true;
+                else if (entries[i].name.indexOf("large") != -1)
+                    largeLoaded = true;
+                else if (entries[i].name.indexOf("small") != -1)
+                    smallLoaded = true;
+            }
+            // It's possible that due to network variance, these resource downloads didn't yet finish.
+            // If so, wait a bit longer (up to 1 second).
+            if (!(controlLoaded || smallLoaded) && counter) {
+                --counter;
+                t.step_timeout(test, timeout);
+            }
+
+            assert_true(controlLoaded, "The control element should be loaded");
+            assert_false(largeLoaded, "The large element should not be loaded");
+            assert_true(smallLoaded, "The small element should be loaded");
+            t.done();
+        };
+        t.step_timeout(test, timeout);
+    }));
+    img.src = ""
+</script>''')
\ No newline at end of file

Property changes: trunk/LayoutTests/http/tests/preload/viewport/meta-viewport-link-headers.py


Added: svn:executable

+* \ No newline at end of property

Modified: trunk/LayoutTests/platform/ios/TestExpectations (274961 => 274962)


--- trunk/LayoutTests/platform/ios/TestExpectations	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2021-03-24 19:42:05 UTC (rev 274962)
@@ -2819,7 +2819,7 @@
 webkit.org/b/142087 fast/css3-text/css3-text-decoration/no-gap-between-two-rounded-textboxes.html [ ImageOnlyFailure ]
 webkit.org/b/142087 fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-inherit.html [ ImageOnlyFailure ]
 
-webkit.org/b/178029 http/tests/preload/viewport/meta-viewport-link-headers.php [ Pass Failure ]
+webkit.org/b/178029 http/tests/preload/viewport/meta-viewport-link-headers.py [ Pass Failure ]
 
 webkit.org/b/179201 [ Debug ] editing/selection/move-by-word-visually-multi-space.html [ Skip ]
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (274961 => 274962)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-03-24 19:35:51 UTC (rev 274961)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-03-24 19:42:05 UTC (rev 274962)
@@ -3601,7 +3601,7 @@
 fast/events/page-visibility-iframe-move-test.html [ Timeout Pass ]
 fast/events/tabindex-focus-chain.html [ Failure Timeout Pass ]
 http/tests/misc/delete-frame-during-readystatechange-with-gc-after-video-removal.html [ Crash Pass ]
-http/tests/preload/single_download_preload_headers_charset.php [ Crash Failure Pass ]
+http/tests/preload/single_download_preload_headers_charset.py [ Crash Failure Pass ]
 http/tests/security/contentSecurityPolicy/audio-redirect-allowed.html [ Crash Timeout Pass ]
 http/tests/security/contentSecurityPolicy/audio-redirect-blocked.html [ Timeout Failure Crash ]
 http/tests/security/contentSecurityPolicy/block-favicon.html [ Failure Pass ]
@@ -3759,7 +3759,7 @@
 webkit.org/b/177077 imported/blink/fast/events/panScroll-panIcon.html [ Pass ImageOnlyFailure Crash ]
 
 webkit.org/b/176598 http/tests/security/contentSecurityPolicy/audio-redirect-allowed2.html [ Pass Crash ]
-webkit.org/b/176606 http/tests/preload/single_download_preload_headers.php [ Pass Crash ]
+webkit.org/b/176606 http/tests/preload/single_download_preload_headers.py [ Pass Crash ]
 webkit.org/b/176609 http/tests/websocket/tests/hybi/close-code-and-reason.html [ Pass Crash ]
 webkit.org/b/176632 http/tests/websocket/tests/hybi/websocket-pending-activity.html [ Pass Crash ]
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to