| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="/w3c/resources/testharness.js"></script> | 2 <script src="/w3c/resources/testharness.js"></script> |
| 3 <script src="/w3c/resources/testharnessreport.js"></script> | 3 <script src="/w3c/resources/testharnessreport.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 test(function() { | 6 test(function() { |
| 7 window.performance.mark('mark1'); | 7 window.performance.mark('mark1'); |
| 8 window.performance.mark('mark2'); | 8 window.performance.mark('mark2'); |
| 9 window.performance.measure('measure1', 'mark1', 'mark2'); | 9 window.performance.measure('measure1', 'mark1', 'mark2'); |
| 10 | 10 |
| 11 var entries = window.performance.getEntries(); | 11 var entries = window.performance.getEntries(); |
| 12 for (var i = 0; i < entries.length; i++) { | 12 for (var i = 0; i < entries.length; i++) { |
| 13 var entry = entries[i]; | 13 var entry = entries[i]; |
| 14 var serialized = JSON.parse(JSON.stringify(entry)); | 14 var serialized = JSON.parse(JSON.stringify(entry)); |
| 15 for (var attr in entry) { | 15 for (var attr in entry) { |
| 16 if (typeof entry[attr] != 'function') { | 16 if (typeof entry[attr] != 'function') { |
| 17 assert_equals(serialized[attr], entry[attr], entry.constructor.n
ame + '.' + attr); | 17 var assertMethod = assert_equals |
| 18 if (Array.isArray(serialized[attr]) && Array.isArray(entry[attr]
)) { |
| 19 assertMethod = assert_array_equals |
| 20 } |
| 21 assertMethod(serialized[attr], entry[attr], entry.constructor.na
me + '.' + attr); |
| 18 } | 22 } |
| 19 } | 23 } |
| 20 } | 24 } |
| 21 }, 'PerformanceEntry subclasses should serialize all attributes'); | 25 }, 'PerformanceEntry subclasses should serialize all attributes'); |
| 22 | 26 |
| 23 </script> | 27 </script> |
| OLD | NEW |