https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 345e24e70785b4c57a646f0182a6d13fba8fa076 authored by Geoffrey Sneddon on 16 March 2018, 16:55:00 UTC
Get rid of hardcoded web-platform.test in wpt/run.py
Tip revision: 345e24e
performanceentry-tojson.html
<!doctype html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>

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');
</script>
</body>
</html>
back to top