From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- testing/web-platform/tests/resource-timing/OWNERS | 6 + .../tests/resource-timing/SyntheticResponse.py | 26 ++ .../tests/resource-timing/idlharness.html | 81 ++++ .../resource-timing/iframe-setdomain.sub.html | 14 + .../tests/resource-timing/resource-timing.html | 18 + .../tests/resource-timing/resource-timing.js | 465 +++++++++++++++++++++ .../tests/resource-timing/resources/gzip_xml.py | 17 + .../resources/resource_timing_test0.css | 4 + .../resources/resource_timing_test0.html | 15 + .../resources/resource_timing_test0.js | 3 + .../resources/resource_timing_test0.png | Bin 0 -> 249 bytes .../resources/resource_timing_test0.xml | 6 + .../resources/webperftestharness.js | 145 +++++++ .../resource-timing/test_resource_timing.html | 24 ++ .../tests/resource-timing/test_resource_timing.js | 223 ++++++++++ 15 files changed, 1047 insertions(+) create mode 100644 testing/web-platform/tests/resource-timing/OWNERS create mode 100644 testing/web-platform/tests/resource-timing/SyntheticResponse.py create mode 100644 testing/web-platform/tests/resource-timing/idlharness.html create mode 100644 testing/web-platform/tests/resource-timing/iframe-setdomain.sub.html create mode 100644 testing/web-platform/tests/resource-timing/resource-timing.html create mode 100644 testing/web-platform/tests/resource-timing/resource-timing.js create mode 100644 testing/web-platform/tests/resource-timing/resources/gzip_xml.py create mode 100644 testing/web-platform/tests/resource-timing/resources/resource_timing_test0.css create mode 100644 testing/web-platform/tests/resource-timing/resources/resource_timing_test0.html create mode 100644 testing/web-platform/tests/resource-timing/resources/resource_timing_test0.js create mode 100644 testing/web-platform/tests/resource-timing/resources/resource_timing_test0.png create mode 100644 testing/web-platform/tests/resource-timing/resources/resource_timing_test0.xml create mode 100644 testing/web-platform/tests/resource-timing/resources/webperftestharness.js create mode 100644 testing/web-platform/tests/resource-timing/test_resource_timing.html create mode 100644 testing/web-platform/tests/resource-timing/test_resource_timing.js (limited to 'testing/web-platform/tests/resource-timing') diff --git a/testing/web-platform/tests/resource-timing/OWNERS b/testing/web-platform/tests/resource-timing/OWNERS new file mode 100644 index 000000000..35d5e5b0a --- /dev/null +++ b/testing/web-platform/tests/resource-timing/OWNERS @@ -0,0 +1,6 @@ +@haoxli +@plehegar +@zqzhang +@igrigorik +@toddreifsteck +@yoavweiss diff --git a/testing/web-platform/tests/resource-timing/SyntheticResponse.py b/testing/web-platform/tests/resource-timing/SyntheticResponse.py new file mode 100644 index 000000000..7fbf79e25 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/SyntheticResponse.py @@ -0,0 +1,26 @@ +import urllib +import time + +def main(request, response): + index = request.request_path.index("?") + args = request.request_path[index+1:].split("&") + headersSent = 0 + for arg in args: + if arg.startswith("ignored"): + continue + elif arg.endswith("ms"): + time.sleep(float(arg[0:-2]) / 1E3); + elif arg.startswith("redirect:"): + return (302, "WEBPERF MARKETING"), [("Location", urllib.unquote(arg[9:]))], "TEST" + elif arg.startswith("mime:"): + response.headers.set("Content-Type", urllib.unquote(arg[5:])) + elif arg.startswith("send:"): + text = urllib.unquote(arg[5:]) + if headersSent == 0: + response.write_status_headers() + headersSent = 1 + + response.writer.write(text) +# else: +# error " INVALID ARGUMENT %s" % arg + diff --git a/testing/web-platform/tests/resource-timing/idlharness.html b/testing/web-platform/tests/resource-timing/idlharness.html new file mode 100644 index 000000000..15afd0944 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/idlharness.html @@ -0,0 +1,81 @@ + + + + +Resource Timing IDL tests + + + + + + + + +

Resource Timing IDL tests

+
+ + + +
+[Exposed=(Window)]
+interface PerformanceResourceTiming : PerformanceEntry {
+    readonly attribute DOMString           initiatorType;
+    readonly attribute DOMHighResTimeStamp redirectStart;
+    readonly attribute DOMHighResTimeStamp redirectEnd;
+    readonly attribute DOMHighResTimeStamp fetchStart;
+    readonly attribute DOMHighResTimeStamp domainLookupStart;
+    readonly attribute DOMHighResTimeStamp domainLookupEnd;
+    readonly attribute DOMHighResTimeStamp connectStart;
+    readonly attribute DOMHighResTimeStamp connectEnd;
+    readonly attribute DOMHighResTimeStamp secureConnectionStart;
+    readonly attribute DOMHighResTimeStamp requestStart;
+    readonly attribute DOMHighResTimeStamp responseStart;
+    readonly attribute DOMHighResTimeStamp responseEnd;
+    serializer = {inherit, attribute};
+};
+partial interface Performance {
+    void clearResourceTimings();
+    void setResourceTimingBufferSize(unsigned long maxSize);
+    attribute EventHandler onresourcetimingbufferfull;
+};
+
+ + + + diff --git a/testing/web-platform/tests/resource-timing/iframe-setdomain.sub.html b/testing/web-platform/tests/resource-timing/iframe-setdomain.sub.html new file mode 100644 index 000000000..944ee10c4 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/iframe-setdomain.sub.html @@ -0,0 +1,14 @@ + + + + domain: {{domains[www]}} + + + + The resource-timings.html test loads this document into an IFrame to vet that setting + 'document.domain' does not effect the timing allowed. + + diff --git a/testing/web-platform/tests/resource-timing/resource-timing.html b/testing/web-platform/tests/resource-timing/resource-timing.html new file mode 100644 index 000000000..9f899f7ac --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resource-timing.html @@ -0,0 +1,18 @@ + + + + Resource-Timing Level 1 + + + + + + + + +
+

+  
+
+
diff --git a/testing/web-platform/tests/resource-timing/resource-timing.js b/testing/web-platform/tests/resource-timing/resource-timing.js
new file mode 100644
index 000000000..a1b801a74
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resource-timing.js
@@ -0,0 +1,465 @@
+"use strict";
+
+window.onload =
+    function () {
+        setup({ explicit_timeout: true });
+
+        /** Number of milliseconds to delay when the server injects pauses into the response.
+
+            This should be large enough that we can distinguish it from noise with high confidence,
+            but small enough that tests complete quickly. */
+        var serverStepDelay = 250;
+
+        var mimeHtml    = "text/html";
+        var mimeText    = "text/plain";
+        var mimePng     = "image/png";
+        var mimeScript  = "application/javascript";
+        var mimeCss     = "text/css";
+
+        /** Hex encoding of a a 150x50px green PNG. */
+        var greenPng = "0x89504E470D0A1A0A0000000D494844520000006400000032010300000090FBECFD00000003504C544500FF00345EC0A80000000F49444154281563601805A36068020002BC00011BDDE3900000000049454E44AE426082";
+
+        /** Array containing test cases to run.  Initially, it contains the one-off 'about:blank" test,
+            but additional cases are pushed below by expanding templates. */
+        var testCases = [
+            {
+                description: "No timeline entry for about:blank",
+                test:
+                    function (test) {
+                        // Insert an empty IFrame.
+                        var frame = document.createElement("iframe");
+
+                        // Wait for the IFrame to load and ensure there is no resource entry for it on the timeline.
+                        //
+                        // We use the 'createOnloadCallbackFn()' helper which is normally invoked by 'initiateFetch()'
+                        // to avoid setting the IFrame's src.  It registers a test step for us, finds our entry on the
+                        // resource timeline, and wraps our callback function to automatically vet invariants.
+                        frame.onload = createOnloadCallbackFn(test, frame, "about:blank",
+                            function (initiator, entry) {
+                                assert_equals(entry, undefined, "Inserting an IFrame with a src of 'about:blank' must not add an entry to the timeline.");
+                                assertInvariants(
+                                    test,
+                                    function () {
+                                        test.done();
+                                    });
+                            });
+
+                        document.body.appendChild(frame);
+
+                        // Paranoid check that the new IFrame has loaded about:blank.
+                        assert_equals(
+                            frame.contentWindow.location.href,
+                            "about:blank",
+                            "'Src' of new