summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/server-timing/idlharness.https.any.js
blob: 44bffcf59e6bf6e03389352e5da76ee0b48e34b8 (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
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: timeout=long

'use strict';

// https://w3c.github.io/server-timing/

idl_test(
  ['resource-timing', 'server-timing'],
  ['performance-timeline', 'hr-time', 'dom'],
  idl_array => new Promise((resolve, reject) => {
    new PerformanceObserver(entries => {
      entries.getEntries().forEach(e => {
        if (!e.name.endsWith('blue.png'))
          return;

        self.resource = e;
        self.server = e.serverTiming[0];
        idl_array.add_objects({
          PerformanceResourceTiming: ['resource'],
          PerformanceServerTiming: ['server']
        });
        resolve();
      })
    }).observe({entryTypes: ['resource']});
    fetch('resources/blue.png');
  })
);