• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test(() => {
2  performance.mark('markName');
3  performance.measure('measureName');
4
5  const entries = performance.getEntries();
6  const performanceEntryKeys = [
7    'name',
8    'entryType',
9    'startTime',
10    'duration'
11  ];
12  for (let i = 0; i < entries.length; ++i) {
13    assert_equals(typeof(entries[i].toJSON), 'function');
14    const json = entries[i].toJSON();
15    assert_equals(typeof(json), 'object');
16    for (const key of performanceEntryKeys) {
17      assert_equals(json[key], entries[i][key],
18        `entries[${i}].toJSON().${key} should match entries[${i}].${key}`);
19    }
20  }
21}, 'Test toJSON() in PerformanceEntry');
22