https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 058920768c261da7597d8bba4c0737caef82f501 authored by Anne van Kesteren on 15 October 2018, 14:50:01 UTC
HTTP: message parsing with CR
Tip revision: 0589207
performanceentry-tojson.any.js
test(() => {
  performance.mark('markName');
  performance.measure('measureName');

  const entries = performance.getEntries();
  const performanceEntryKeys = [
    'name',
    'entryType',
    'startTime',
    'duration'
  ];
  for (let i = 0; i < entries.length; ++i) {
    assert_equals(typeof(entries[i].toJSON), 'function');
    const json = entries[i].toJSON();
    assert_equals(typeof(json), 'object');
    for (const key of performanceEntryKeys) {
      assert_equals(json[key], entries[i][key],
        `entries[${i}].toJSON().${key} should match entries[${i}].${key}`);
    }
  }
}, 'Test toJSON() in PerformanceEntry');
back to top