diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/performance-timeline/resources | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/performance-timeline/resources')
13 files changed, 183 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/resources/child-frame.html b/testing/web-platform/tests/performance-timeline/resources/child-frame.html new file mode 100644 index 0000000000..40c8f72688 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/child-frame.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> + +<head></head> +<body></body> +<script> + performance.mark('mark_child_frame'); +</script> diff --git a/testing/web-platform/tests/performance-timeline/resources/empty.html b/testing/web-platform/tests/performance-timeline/resources/empty.html new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/empty.html diff --git a/testing/web-platform/tests/performance-timeline/resources/going-back.html b/testing/web-platform/tests/performance-timeline/resources/going-back.html new file mode 100644 index 0000000000..f4a26669ba --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/going-back.html @@ -0,0 +1,9 @@ +<!doctype html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +onload = (event) => { + history.back(); +}; +</script>
\ No newline at end of file diff --git a/testing/web-platform/tests/performance-timeline/resources/include-frames-helper.js b/testing/web-platform/tests/performance-timeline/resources/include-frames-helper.js new file mode 100644 index 0000000000..a56489baaf --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/include-frames-helper.js @@ -0,0 +1,60 @@ +const verifyEntries = (entries, filterOptions) => { + for (const filterOption of filterOptions) { + let countBeforeFiltering = entries.length; + + // Using negate of the condition so that the next filtering is applied on less entries. + entries = entries.filter( + e => !(e.entryType == filterOption['entryType'] && e.name.includes(filterOption['name']))); + + assert_equals( + countBeforeFiltering - entries.length, filterOption['expectedCount'], filterOption['failureMsg']); + } +} + +const createFilterOption = (name, entryType, expectedCount, msgPrefix, description = '') => { + if (description) { + description = ' ' + description; + } + + let failureMsg = + `${msgPrefix} should have ${expectedCount} ${entryType} entries for name ${name}` + description; + + return { + name: name, + entryType: entryType, + expectedCount: expectedCount, + failureMsg: failureMsg + }; +} + +const loadChildFrame = (src) => { + return new Promise(resolve => { + + const childFrame = document.createElement('iframe'); + + childFrame.addEventListener("load", resolve); + + childFrame.src = src; + + document.body.appendChild(childFrame); + }); +} + +const loadChildFrameAndGrandchildFrame = (src) => { + return new Promise(resolve => { + + const crossOriginChildFrame = document.createElement('iframe'); + + // Wait for the child frame to send a message. The child frame would send a message + // when it loads its child frame. + window.addEventListener('message', e => { + if (e.data == 'Load completed') { + resolve(); + } + }); + + crossOriginChildFrame.src = src; + + document.body.appendChild(crossOriginChildFrame) + }); +} diff --git a/testing/web-platform/tests/performance-timeline/resources/include-frames-subframe.html b/testing/web-platform/tests/performance-timeline/resources/include-frames-subframe.html new file mode 100644 index 0000000000..0d43f418a0 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/include-frames-subframe.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> + +<head> +</head> +<!-- + This html is embedded as a sub-frame in include-frames-originA-B-A.html, + include-frames-originA-B-B.html and include-frames-originA-A-A.html. Once embedded, + this would take a url parameter named origin which is the origin of the child frame + this html is to load in step 3 listed below. + It does, + 1, waits for load. + 2, creates a single mark performance entry. + 3, creates and loads a child frame, and waits for it to load. + 4. verify entries obtained from this frame. +--> + +<body> + <script> + (async () => { + // Wait for load. + await new Promise(resolve => window.addEventListener("load", resolve)); + + // Mark. + performance.mark("mark_subframe"); + + // Create and load an iframe and wait for load. + await new Promise(resolve => { + const childFrame = document.createElement('iframe'); + + childFrame.addEventListener('load', async () => { + window.parent.postMessage('Load completed', "*"); + resolve(); + }); + + childFrame.src = (new URL(document.location)).searchParams.get('origin') + + '/performance-timeline/resources/child-frame.html'; + + document.body.appendChild(childFrame); + } + ); + })(); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/resources/json_resource.json b/testing/web-platform/tests/performance-timeline/resources/json_resource.json new file mode 100644 index 0000000000..68b6ac1d56 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/json_resource.json @@ -0,0 +1,4 @@ +{ + "name": "nav_id_test", + "target": "resource_timing" +}
\ No newline at end of file diff --git a/testing/web-platform/tests/performance-timeline/resources/make_long_task.js b/testing/web-platform/tests/performance-timeline/resources/make_long_task.js new file mode 100644 index 0000000000..a52d6d8392 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/make_long_task.js @@ -0,0 +1,4 @@ +(function () { + let now = window.performance.now(); + while (window.performance.now() < now + 60); +}());
\ No newline at end of file diff --git a/testing/web-platform/tests/performance-timeline/resources/navigation-id-detached-frame-page.html b/testing/web-platform/tests/performance-timeline/resources/navigation-id-detached-frame-page.html new file mode 100644 index 0000000000..02aafbb5c7 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/navigation-id-detached-frame-page.html @@ -0,0 +1,21 @@ +<!DOCTYPE HTML> +<html> + +<head> + <meta charset="utf-8"> + <title>The navigation_id Detached iframe Page.</title> +</head> + +<body> + <script> + window.addEventListener("load", () => { + setTimeout(() => { + const container = window.frameElement; + container.remove(); + }, 10); + performance.mark('mark-window-detached-frame'); + }); + </script> +</body> + +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/performance-timeline/resources/postmessage-entry.html b/testing/web-platform/tests/performance-timeline/resources/postmessage-entry.html new file mode 100644 index 0000000000..ef5be73395 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/postmessage-entry.html @@ -0,0 +1,17 @@ +<!doctype html> +<script> +addEventListener("load", () => { + const entry = performance.getEntriesByType("navigation")[0]; + try { + window.top.postMessage(entry, "*"); + } catch(error) { + if (error.name == "DataCloneError") { + window.top.postMessage("PASS", "*"); + } else { + window.top.postMessage("FAIL - Wrong exception name: " + error.name, "*"); + } + } + window.top.postMessage("FAIL - No exception thrown", "*"); +}); + +</script> diff --git a/testing/web-platform/tests/performance-timeline/resources/square.png b/testing/web-platform/tests/performance-timeline/resources/square.png Binary files differnew file mode 100644 index 0000000000..be211bc377 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/square.png diff --git a/testing/web-platform/tests/performance-timeline/resources/worker-invalid-entries.js b/testing/web-platform/tests/performance-timeline/resources/worker-invalid-entries.js new file mode 100644 index 0000000000..bd7fba2ccf --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/worker-invalid-entries.js @@ -0,0 +1,6 @@ +performance.mark('workerMark'); +postMessage({ + 'invalid' : performance.getEntriesByType('invalid').length, + 'mark' : performance.getEntriesByType('mark').length, + 'measure' : performance.getEntriesByType('measure').length +}); diff --git a/testing/web-platform/tests/performance-timeline/resources/worker-navigation-id.js b/testing/web-platform/tests/performance-timeline/resources/worker-navigation-id.js new file mode 100644 index 0000000000..3a2740d067 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/worker-navigation-id.js @@ -0,0 +1,6 @@ +self.onmessage = () => { + const mark_name = 'user_timig_mark'; + performance.mark(mark_name); + postMessage(performance.getEntriesByName(mark_name)[0].navigationId); + self.close(); +} diff --git a/testing/web-platform/tests/performance-timeline/resources/worker-with-performance-observer.js b/testing/web-platform/tests/performance-timeline/resources/worker-with-performance-observer.js new file mode 100644 index 0000000000..a72fe81c47 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/resources/worker-with-performance-observer.js @@ -0,0 +1,6 @@ +try { + new PerformanceObserver(() => true); + postMessage("SUCCESS"); +} catch (ex) { + postMessage("FAILURE"); +} |