diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
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 | 49 |
1 files changed, 49 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..93ddcff062 --- /dev/null +++ b/testing/web-platform/tests/performance-timeline/navigation-id-initial-load.tentative.html @@ -0,0 +1,49 @@ +<!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 and are all the same. + const navigationIdsOfLCP = (await NavigationIdsFromLCP()).map(e => e.navigationId); + assert_true(navigationIdsOfLCP.every(e => e == navigationIdsOfLCP[0]), + 'Navigation Ids of LCP entries should be the same at initial navigation'); + + // Assert navigation id exists in a NavigationTiming entry. + const navigationIdOfNavigationTiming = + performance.getEntriesByType('navigation')[0].navigationId; + assert_not_equals(navigationIdOfNavigationTiming, null, + 'Navigation Id of a navigation timing entry should exist at initial navigation'); + + // Assert navigation id exists in PaintTiming entries and are all the same. + const navigationIdsOfPaintTiming = + performance.getEntriesByType('paint').map(e => e.navigationId); + assert_true(navigationIdsOfPaintTiming.every(e => + e == navigationIdsOfPaintTiming[0]), + 'Navigation Id of PaintTiming entries should be the same as the initial navigation.'); + + // Assert navigation ids are all the same. + const navigationIdsOfAll = + navigationIdsOfLCP.concat(navigationIdsOfPaintTiming, navigationIdOfNavigationTiming); + assert_true(navigationIdsOfAll.every(e => e == navigationIdsOfAll[0]), + 'Navigation Id of all entries should be the same as the initial navigation.'); + + }, 'Navigation Ids should exist and are all the same as the initial navigation.'); + </script> +</body>
\ No newline at end of file |