3 <title>Event Timing: toJSON
</title>
5 <script src=/resources/testharness.js
></script>
6 <script src=/resources/testharnessreport.js
></script>
7 <script src=/resources/testdriver.js
></script>
8 <script src=/resources/testdriver-vendor.js
></script>
9 <script src=resources/event-timing-test-utils.js
></script>
10 <button id='button'
>Generate a 'click' event
</button>
12 async_test(function (t
) {
13 assert_implements(window
.PerformanceEventTiming
, 'Event Timing is not supported.');
14 const observer
= new PerformanceObserver(
15 t
.step_func_done(function(entryList
) {
16 const entry
= entryList
.getEntries()[0];
17 assert_equals(typeof(entry
.toJSON
), 'function');
18 const json
= entry
.toJSON();
19 assert_equals(typeof(json
), 'object');
26 // PerformanceEventTiming
31 for (const key
of keys
) {
32 assert_equals(json
[key
], entry
[key
],
33 'PerformanceEventTiming ${key} entry does not match its toJSON value');
35 assert_equals(json
['target'], undefined, 'toJSON should not include target');
38 observer
.observe({type
: 'event'});
39 clickAndBlockMain('button');
40 }, 'Test toJSON() in PerformanceEventTiming.');