| Nicolas Pena | 5170483 | 2018-04-12 19:56:32 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8" /> |
| 5 | <title>functionality test of window.performance.mark</title> |
| 6 | <link rel="author" title="Intel" href="http://www.intel.com/" /> |
| 7 | <link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/> |
| 8 | <script src="/resources/testharness.js"></script> |
| 9 | <script src="/resources/testharnessreport.js"></script> |
| 10 | <script src="/common/performance-timeline-utils.js"></script> |
| 11 | <script src="resources/webperftestharness.js"></script> |
| 12 | <script src="resources/webperftestharnessextension.js"></script> |
| 13 | <script> |
| 14 | setup({ explicit_done: true }); |
| 15 | |
| 16 | function onload_test() |
| 17 | { |
| 18 | const entrylist_checker = new performance_entrylist_checker('mark'); |
| 19 | const string_mark_names = mark_names.map(function (x) { return String(x)}); |
| 20 | |
| 21 | test_equals(performance.getEntriesByType("mark").length, 0, 'There should be ' + 0 + ' marks'); |
| 22 | mark_names.forEach(performance.mark, performance); |
| 23 | let mark_entrylist = performance.getEntriesByType('mark'); |
| 24 | |
| 25 | entrylist_checker.entrylist_check(mark_entrylist, mark_names.length, string_mark_names, 'Checking all entries.'); |
| 26 | |
| 27 | for (let i = 0; i < mark_entrylist.length; ++i) |
| 28 | { |
| 29 | const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark'); |
| 30 | entrylist_checker.entrylist_check(mark_entrylist_by_name, 1, string_mark_names, |
| 31 | 'First loop: checking entry of name "' + mark_entrylist[i].name + '".'); |
| 32 | } |
| 33 | |
| 34 | mark_names.forEach(performance.mark, performance); |
| 35 | mark_entrylist = performance.getEntriesByType('mark'); |
| 36 | entrylist_checker.entrylist_check(mark_entrylist, mark_names.length * 2, string_mark_names, 'Checking all doubly marked entries.'); |
| 37 | |
| 38 | for (let i = 0; i < mark_entrylist.length; ++i) |
| 39 | { |
| 40 | const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark'); |
| 41 | entrylist_checker.entrylist_check(mark_entrylist_by_name, 2, string_mark_names, |
| 42 | 'Second loop step ' + i + ': checking entries of name "' + mark_entrylist[i].name + '".'); |
| 43 | } |
| 44 | |
| 45 | done(); |
| 46 | } |
| 47 | </script> |
| 48 | </head> |
| 49 | <body onload=onload_test()> |
| 50 | <h1>Description</h1> |
| 51 | <p>This test validates functionality of the interface window.performance.mark.</p> |
| 52 | <div id="log"></div> |
| 53 | </body> |
| 54 | </html> |