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/element-timing/observe-empty-attribute.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/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> |