diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/element-timing/observe-empty-attribute.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/element-timing/observe-empty-attribute.html')
-rw-r--r-- | testing/web-platform/tests/element-timing/observe-empty-attribute.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/testing/web-platform/tests/element-timing/observe-empty-attribute.html b/testing/web-platform/tests/element-timing/observe-empty-attribute.html new file mode 100644 index 0000000000..baec6ee48d --- /dev/null +++ b/testing/web-platform/tests/element-timing/observe-empty-attribute.html @@ -0,0 +1,38 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Element Timing: observe with empty elementtiming attribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/element-timing-helpers.js"></script> +<script> +let beforeRender; +async_test(function (t) { + assert_implements(window.PerformanceElementTiming, "PerformanceElementTiming is not implemented"); + let observedImage = false; + let observedText = false; + const observer = new PerformanceObserver( + t.step_func(function(entryList) { + entryList.getEntries().forEach(entry => { + if (entry.name === 'image-paint') { + assert_false(observedImage, 'Image should only be observed once.'); + const pathname = window.location.origin + '/element-timing/resources/square20.png'; + checkElement(entry, pathname, '', 'square', beforeRender, + document.getElementById('square')); + checkNaturalSize(entry, 20, 20); + observedImage = true; + } else { + assert_false(observedText, 'Text should only be observed once.'); + checkTextElement(entry, '', 'text', beforeRender, document.getElementById('text')); + observedText = true; + } + }); + if (observedImage && observedText) + t.done(); + }) + ); + observer.observe({type: 'element', buffered: true}); + beforeRender = performance.now(); +}, "Able to observe image and text with empty elementtiming attribute."); +</script> +<img id='square' src='resources/square20.png' elementtiming/> +<p id='text' elementtiming>Text!</p> |