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/tentative | |
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/tentative')
10 files changed, 561 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html b/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html new file mode 100644 index 0000000000..70019223a6 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<head> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +</body> +<script> +promise_test(async () => { + performance.clearResourceTimings() + + // Create child iframe. + const childFrame = document.createElement('iframe') + childFrame.src = "../resources/child-frame.html" + document.body.appendChild(childFrame) + + // wait until the child frame's onload event fired + await new Promise(r => childFrame.addEventListener("load", r)); + + const childWindow = childFrame.contentWindow; + // Detach the child frame + document.body.removeChild(childFrame); + + const entries = childWindow.performance.getEntries({ includeChildFrames: true }); + const parent_entries = performance.getEntries({ includeChildFrames: true }); +}, "GetEntries of a detached parent frame does not crash"); +</script> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A-A.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A-A.html new file mode 100644 index 0000000000..57623e5b33 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A-A.html @@ -0,0 +1,93 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/common/get-host-info.sub.js></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries, description = '') => { + let filterOptions = [ + createFilterOption('include-frames-originA-A-A', 'navigation', 1, 'Main Frame', description), + createFilterOption('include-frames-subframe', 'resource', 1, 'Main Frame', description), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyChildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-subframe', 'navigation', 1, 'Child Frame'), + createFilterOption('child-frame.html', 'resource', 1, 'Child Frame'), + createFilterOption('mark_subframe', 'mark', 1, 'Child frame') + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyGrandchildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('child-frame.html', 'navigation', 1, 'Grandchild Frame'), + createFilterOption('mark_child_frame', 'mark', 1, 'Grandchild frame') + ]; + + verifyEntries(entries, filterOptions); + } + + promise_test(async () => { + performance.clearResourceTimings(); + + // Load a child frame. The child frame upon loading would load a child frame of its own. + await loadChildFrameAndGrandchildFrame( + '../resources/include-frames-subframe.html?origin=' + get_host_info().ORIGIN); + + // Verify entries retrieved from main frame. + const entries = performance.getEntries({ includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + verifyChildFrameEntries(entries); + + verifyGrandchildFrameEntries(entries); + + // 1 entry for parent, 1 for child, 1 for grandchild. + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + assert_equals(navigationEntries.length, 3, 'Navigation entries should be 3.'); + + const markedChildFrameEntries = performance.getEntries( + { name: 'mark_subframe', includeChildFrames: true }); + assert_equals(markedChildFrameEntries.length, 1, 'Child frame mark entries should be 1.'); + + const markedGrandchildFrameEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + assert_equals(markedGrandchildFrameEntries.length, 1, 'Grand child frame mark entries should be 1.'); + + // Test cases where includeChildFrames is false. + const entriesWithNoFitlerOptions = performance.getEntries(); + + const entriesWithoutIncludingChildFrames = performance.getEntries({ includeChildFrames: false }); + + const navigationEntriesWithoutIncludingChildFrames = performance.getEntries({ entryType: "navigation", includeChildFrames: false }); + + const markedEntriesWithoutIncludingChildFrames = performance.getEntries( + { name: 'entry-name', includeChildFrames: false }); + + verifyMainFrameEntries(entriesWithNoFitlerOptions, 'with no filter options.'); + + verifyMainFrameEntries(entriesWithoutIncludingChildFrames, 'with includingChildFrames being false.') + + // 1 entry for main frame. + assert_equals(navigationEntriesWithoutIncludingChildFrames.length, 1, + 'Navigation entries with includeChildFrame being false should be 1.'); + + // 0 entry since grandchild frame is not included. + assert_equals(markedEntriesWithoutIncludingChildFrames.length, 0, + 'Mark entries with includeChildFrame being false should be 0.'); + + }, 'GetEntries of a document of origin A, its child frame of origin B and \ + its grandchild frame of origin A.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A.html new file mode 100644 index 0000000000..bcb9a81657 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-A.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries, description = '') => { + let filterOptions = [ + createFilterOption('include-frames-originA-A', 'navigation', 1, 'Main Frame', description), + createFilterOption('child-frame.html', 'resource', 1, 'Main Frame', description), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyChildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('child-frame.html', 'navigation', 1, 'Child Frame'), + createFilterOption('mark_child_frame', 'mark', 1, 'Child Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + promise_test(async () => { + performance.clearResourceTimings(); + + // Load a child frame. + await loadChildFrame('../resources/child-frame.html'); + + const entries = performance.getEntries({ includeChildFrames: true }); + + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + + const markedEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + verifyChildFrameEntries(entries); + + // 1 entry for main frame, 1 for child frame. + assert_equals(navigationEntries.length, 2, 'Navigation entries should be 2.'); + + // 1 entry for child frame. + assert_equals(markedEntries.length, 1, 'Mark entries should be 1.'); + + // Test cases where includeChildFrames is false. + const entriesWithNoFitlerOptions = performance.getEntries(); + + const entriesWithoutIncludingChildFrames = performance.getEntries({ includeChildFrames: false }); + + const navigationEntriesWithoutIncludingChildFrames = performance.getEntries({ entryType: "navigation", includeChildFrames: false }); + + const markedEntriesWithoutIncludingChildFrames = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: false }); + + verifyMainFrameEntries(entriesWithNoFitlerOptions, 'with no filter options.'); + + verifyMainFrameEntries(entriesWithoutIncludingChildFrames, 'with includeChildFrame being false.'); + + // 1 entry for main frame. + assert_equals(navigationEntriesWithoutIncludingChildFrames.length, 1, + 'Navigation entries with includeChildFrame being false should be 1.'); + + // 0 entry for child frame. + assert_equals(markedEntriesWithoutIncludingChildFrames.length, 0, + 'Mark entries with includeChildFrame being false should be 0.'); + + }, 'GetEntries of a document of origin A and its child frame of origin A.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AA.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AA.html new file mode 100644 index 0000000000..cccbf4100d --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AA.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-originA-AA', 'navigation', 1, 'Main Frame'), + createFilterOption('child-frame.html', 'navigation', 2, 'Child Frames'), + createFilterOption('child-frame.html', 'resource', 2, 'Main Frame'), + createFilterOption('mark_child_frame', 'mark', 2, 'Child frames') + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyPerformanceEntries = () => { + const entries = performance.getEntries({ includeChildFrames: true }); + + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + + const markedEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + // 1 entry for main frame, 1 for each child frame. + assert_equals(navigationEntries.length, 3, 'Navigation entries should be 3.'); + + // 1 entry for each child frame. + assert_equals(markedEntries.length, 2, 'Mark entries should be 2.'); + } + + promise_test(async () => { + performance.clearResourceTimings(); + + // Load first child iframe. + const promise1 = loadChildFrame('../resources/child-frame.html'); + + // Load second child iframe. + const promise2 = loadChildFrame('../resources/child-frame.html'); + + return Promise.all([promise1, promise2]).then(verifyPerformanceEntries); + }, 'GetEntries of a document of origin A and its two child frames both of origin A.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AB.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AB.html new file mode 100644 index 0000000000..d630665b65 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-AB.html @@ -0,0 +1,53 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/common/get-host-info.sub.js></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-originA-AB', 'navigation', 1, 'Main Frame'), + createFilterOption('child-frame.html', 'navigation', 1, 'Child Frames'), + createFilterOption('child-frame.html', 'resource', 2, 'Main Frame'), + createFilterOption('mark_child_frame', 'mark', 1, 'Child frames') + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyPerformanceEntries = () => { + const entries = performance.getEntries({ includeChildFrames: true }); + + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + + const markedEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + // 1 entry for main frame, 1 for local child frame. + assert_equals(navigationEntries.length, 2, 'Navigation entries should be 2.'); + + // 1 entry for local child frame. + assert_equals(markedEntries.length, 1, 'Mark entries should be 1.'); + } + + promise_test(() => { + performance.clearResourceTimings(); + + // Load first child iframe. + sameOriginPromise = loadChildFrame('../resources/child-frame.html'); + + // Create second child iframe. + crossOriginPromise = loadChildFrame( + get_host_info().HTTP_REMOTE_ORIGIN + '/resources/child-frame.html'); + + return Promise.all([sameOriginPromise, crossOriginPromise]).then(verifyPerformanceEntries); + }, 'GetEntries of a document of origin A and its two child frames of origin A and B respectively.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-A.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-A.html new file mode 100644 index 0000000000..58cad40fab --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-A.html @@ -0,0 +1,91 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/common/get-host-info.sub.js></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries, description = '') => { + let filterOptions = [ + createFilterOption('include-frames-originA-B-A', 'navigation', 1, 'Main Frame', description), + createFilterOption('include-frames-subframe', 'resource', 1, 'Main Frame', description), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyChildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-subframe', 'navigation', 0, 'Child Frame'), + createFilterOption('child-frame.html', 'resource', 0, 'Child Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyGrandchildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('child-frame.html', 'navigation', 1, 'Grandchild Frame'), + createFilterOption('mark_child_frame', 'mark', 1, 'Grandchild frame') + ]; + + verifyEntries(entries, filterOptions); + } + + promise_test(async () => { + + performance.clearResourceTimings(); + + // Load a child frame. The child frame upon loading would load a child frame of its own. + await loadChildFrameAndGrandchildFrame(get_host_info().REMOTE_ORIGIN + + '/performance-timeline/resources/include-frames-subframe.html?origin=' + get_host_info().ORIGIN); + + const entries = performance.getEntries({ includeChildFrames: true }); + + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + + const markedEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + verifyChildFrameEntries(entries); + + verifyGrandchildFrameEntries(entries); + + // 1 entry for main frame, 1 for grandchild frame. + assert_equals(navigationEntries.length, 2, 'Navigation entries should be 2.'); + + // 1 entry for grandchild frame. + assert_equals(markedEntries.length, 1, 'Mark entries should be 1.'); + + // Test cases where includeChildFrames is false. + const entriesWithNoFitlerOptions = performance.getEntries(); + + const entriesWithoutIncludingChildFrames = performance.getEntries({ includeChildFrames: false }); + + const navigationEntriesWithoutIncludingChildFrames = performance.getEntries({ entryType: "navigation", includeChildFrames: false }); + + const markedEntriesWithoutIncludingChildFrames = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: false }); + + verifyMainFrameEntries(entriesWithNoFitlerOptions, 'with no filter options.'); + + verifyMainFrameEntries(entriesWithoutIncludingChildFrames, 'with includeChildFrame being false.'); + + // 1 entry for main frame. + assert_equals(navigationEntriesWithoutIncludingChildFrames.length, 1, + 'Navigation entries with includeChildFrame being false should be 1.'); + + // 0 entry since grandchild frame is not included. + assert_equals(markedEntriesWithoutIncludingChildFrames.length, 0, + 'Mark entries with includeChildFrame being false should be 0.'); + + }, 'GetEntries of a document of origin A, its child frame of origin B and \ + its grandchild frame of origin A.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-B.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-B.html new file mode 100644 index 0000000000..2368a8e881 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B-B.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/common/get-host-info.sub.js></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-originA-B-B', 'navigation', 1, 'Main Frame'), + createFilterOption('include-frames-subframe', 'resource', 1, 'Main Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyChildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-subframe', 'navigation', 0, 'Child Frame'), + createFilterOption('child-frame.html', 'resource', 0, 'Child Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyGrandchildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('child-frame.html', 'navigation', 0, 'Grandchild Frame'), + createFilterOption('mark_child_frame', 'mark', 0, 'Grandchild frame') + ]; + + verifyEntries(entries, filterOptions); + } + + promise_test(async () => { + performance.clearResourceTimings(); + + // Load a origin child frame. The child frame upon loading would load a child frame of its own. + await loadChildFrameAndGrandchildFrame(get_host_info().REMOTE_ORIGIN + + '/performance-timeline/resources/include-frames-subframe.html?origin=' + + get_host_info().REMOTE_ORIGIN); + + const entries = performance.getEntries({ includeChildFrames: true }); + + verifyMainFrameEntries(entries); + + verifyChildFrameEntries(entries); + + verifyGrandchildFrameEntries(entries); + }, 'GetEntries of a document of origin A, its child frame of origin B and \ + its grandchild frame of origin B.'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B.html new file mode 100644 index 0000000000..b823d6edaa --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-originA-B.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/common/get-host-info.sub.js></script> + <script src="../resources/include-frames-helper.js"></script> +</head> + +<body> + <script> + const verifyMainFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('include-frames-originA-B', 'navigation', 1, 'Main Frame'), + createFilterOption('child-frame.html', 'resource', 1, 'Main Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + const verifyChildFrameEntries = (entries) => { + let filterOptions = [ + createFilterOption('child-frame.html', 'navigation', 0, 'Child Frame'), + createFilterOption('mark_child_frame', 'mark', 0, 'Child Frame'), + ]; + + verifyEntries(entries, filterOptions); + } + + promise_test(async () => { + performance.clearResourceTimings(); + + await loadChildFrame( + get_host_info().HTTP_REMOTE_ORIGIN + '/performance_timeline/resources/child-frame.html'); + + const entries = performance.getEntries({ includeChildFrames: true }); + + const navigationEntries = performance.getEntries({ entryType: "navigation", includeChildFrames: true }); + + const markedEntries = performance.getEntries( + { name: 'mark_subframe', includeChildFrames: true }); + + // 1 entry for main frame. + assert_equals(navigationEntries.length, 1, 'Navigation entries should 1.'); + + // 0 entry since child frame is cross origin. + assert_equals(markedEntries.length, 0, 'Mark entries should 0.'); + }, 'GetEntries of a parent Frame of origin A and its child frame of origin B'); + </script> +</body> diff --git a/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html b/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html new file mode 100644 index 0000000000..d10d3c5ed5 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> + +<body> +</body> +<script> + promise_test(() => { + return new Promise(resolve => { + const navigationEntries = performance.getEntries({ type: 'navigation' }) + const parentEntry = navigationEntries[0] + + // Parent NavigationTiming source is current window. + assert_equals(parentEntry.source, window) + + // Create child iframe. + const childFrame = document.createElement('iframe') + childFrame.src = "../resources/child-frame.html" + document.body.appendChild(childFrame) + + childFrame.addEventListener('load', () => { + const markedEntries = performance.getEntries( + { name: 'mark_child_frame', includeChildFrames: true }); + + const childEntry = markedEntries[0] + + // Child PerformanceMark source is the child's Window. + assert_equals(childEntry.source, childFrame.contentWindow) + + resolve() + }) + }) + }, "PerformanceEntry source is equal to its respective Window") +</script> diff --git a/testing/web-platform/tests/performance-timeline/tentative/with-filter-options-originA.html b/testing/web-platform/tests/performance-timeline/tentative/with-filter-options-originA.html new file mode 100644 index 0000000000..6c6643df75 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/tentative/with-filter-options-originA.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> + +<body> + <script> + promise_test(async () => { + performance.clearResourceTimings(); + + performance.mark('entry-name'); + + const navigationEntries = performance.getEntries({ entryType: 'navigation' }); + + const markedEntries = performance.getEntries( + { name: 'entry-name', entryType: 'mark' }); + + assert_equals(navigationEntries.length, 1, 'navigationEntries should be 1.'); + + assert_equals(markedEntries.length, 1, 'markedEntries should be 1.'); + + }, 'GetEntries with filter options.'); + </script> +</body> |