blob: c642264a19a89bfa02df83cadd2b5cd2c428d0ce [file] [log] [blame]
Nicolás Peña Morenobb603cc2019-04-04 15:03:431<!DOCTYPE HTML>
2<meta charset=utf-8>
3<title>Element Timing: observe element with background image</title>
4<body>
5<style>
6body {
7 margin: 0;
8}
9#target {
10 width: 100px;
11 height: 50px;
12 background-image: url('/images/black-rectangle.png');
13}
14</style>
15<script src="/resources/testharness.js"></script>
16<script src="/resources/testharnessreport.js"></script>
17<script src="resources/element-timing-helpers.js"></script>
18<script>
19 let beforeRender = performance.now();
20 async_test(function (t) {
James Graham163424c2019-05-17 16:47:0321 if (!window.PerformanceElementTiming) {
22 assert_unreached("PerformanceElementTiming is not implemented");
23 }
Nicolás Peña Morenobb603cc2019-04-04 15:03:4324 const observer = new PerformanceObserver(
25 t.step_func_done(function(entryList) {
26 assert_equals(entryList.getEntries().length, 1);
27 const entry = entryList.getEntries()[0];
28 const index = window.location.href.lastIndexOf('/');
29 const pathname = window.location.href.substring(0, index - 14) +
30 'images/black-rectangle.png';
Nicolás Peña Moreno66bb6b42019-05-01 17:40:5831 checkElement(entry, pathname, 'my_div', 'target', beforeRender,
32 document.getElementById('target'));
Nicolás Peña Morenobb603cc2019-04-04 15:03:4333 checkRect(entry, [0, 100, 0, 50]);
34 checkNaturalSize(entry, 100, 50);
35 })
36 );
37 observer.observe({entryTypes: ['element']});
38 }, 'Element with elementtiming attribute and background image is observable.');
39</script>
40<div id='target' elementtiming='my_div'></div>
41</body>