summaryrefslogtreecommitdiffstats
path: root/dom/performance/tests/test_performance_paint_observer_helper.html
blob: ae27c9480dc93cf941e0c0e62ffbcd9181c841df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
  <body>
  </body>
  <script>
    var promise = new Promise(resolve => {
      var observer = new PerformanceObserver(list => resolve(list));
      observer.observe({entryTypes: ["paint"]});
    });

    promise.then(list => {
      var perfEntries = list.getEntries();
      opener.is(list.getEntries().length, 1);
      opener.isDeeply(list.getEntries(),
                performance.getEntriesByType("paint"),
                "Observed 'paint' entries should equal to entries obtained by getEntriesByType.");
      opener.isDeeply(list.getEntries({name: "paint"}),
                performance.getEntriesByName("paint"),
                "getEntries with name filter should return correct results.");
      opener.isDeeply(list.getEntries({entryType: "paint"}),
                performance.getEntriesByType("paint"),
                "getEntries with entryType filter should return correct results.");
      opener.done();
    });

    const img = document.createElement("IMG");
    img.src = "http://example.org/tests/dom/performance/tests/logo.png";
    document.body.appendChild(img);

  </script>
</html>