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/navigation-id-initial-load.tentative.html | |
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/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..b996f0f117 --- /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_true(!!navigationIdOfNavigationTiming, + '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 |