xref: /third_party/node/test/fixtures/wpt/performance-timeline/performanceentry-tojson.any.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/performance-timeline/
11cb0ef41Sopenharmony_citest(() => {
21cb0ef41Sopenharmony_ci  performance.mark('markName');
31cb0ef41Sopenharmony_ci  performance.measure('measureName');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci  const entries = performance.getEntries();
61cb0ef41Sopenharmony_ci  const performanceEntryKeys = [
71cb0ef41Sopenharmony_ci    'name',
81cb0ef41Sopenharmony_ci    'entryType',
91cb0ef41Sopenharmony_ci    'startTime',
101cb0ef41Sopenharmony_ci    'duration'
111cb0ef41Sopenharmony_ci  ];
121cb0ef41Sopenharmony_ci  for (let i = 0; i < entries.length; ++i) {
131cb0ef41Sopenharmony_ci    assert_equals(typeof(entries[i].toJSON), 'function');
141cb0ef41Sopenharmony_ci    const json = entries[i].toJSON();
151cb0ef41Sopenharmony_ci    assert_equals(typeof(json), 'object');
161cb0ef41Sopenharmony_ci    for (const key of performanceEntryKeys) {
171cb0ef41Sopenharmony_ci      assert_equals(json[key], entries[i][key],
181cb0ef41Sopenharmony_ci        `entries[${i}].toJSON().${key} should match entries[${i}].${key}`);
191cb0ef41Sopenharmony_ci    }
201cb0ef41Sopenharmony_ci  }
211cb0ef41Sopenharmony_ci}, 'Test toJSON() in PerformanceEntry');
22

Indexes created Thu Nov 07 10:32:03 CST 2024