diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html')
-rw-r--r-- | testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html b/testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html new file mode 100644 index 0000000000..3228e12778 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html @@ -0,0 +1,43 @@ +<!DOCTYPE HTML> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<!-- +Navigation timing, LCP and paint timing entries are only emitted during initial +load, not after a bfcache navigation. Therefore we only verify the existence of +navigation id, not the increment. +--> + +<body> + <p>This text is to trigger a LCP entry emission.</p> + <script> + async function NavigationIdsFromLCP() { + return new Promise(resolve => { + new PerformanceObserver((entryList) => { + resolve(entryList.getEntries()); + }).observe({ type: 'largest-contentful-paint', buffered: true }); + }) + } + + promise_test(async t => { + // Assert navigation id exists in LCP entries and is the default value 1. + const navigationIds = await NavigationIdsFromLCP(); + assert_true(navigationIds.every(e => e.navigationId == 1), 'Navigation Id\ + of LCP entries should be default value 1 at initial navigations'); + + // Assert navigation id exists in a NavigationTiming entry and is the + // default value 1. + const navigationId = performance.getEntriesByType('navigation')[0].navigationId; + assert_equals(navigationId, 1, 'Navigation Id of an navigation timing\ + entry should be default value 1 at initial navigations'); + + // Assert navigation id exists in PaintTiming entries and is the default + // value 1. + assert_true(performance.getEntriesByType('paint').every(e => + e.navigationId == 1), + 'Navigation Id of PaintTiming entries should be default value 1 at\ + initial navigations.'); + + }, 'Navigation Id should be 1 at initial navigations.'); + </script> +</body> |