blob: e03e9e6247adabb186783e06a493dcc3a7ecb464 [file] [log] [blame]
Nicolas Pena51704832018-04-12 19:56:321<!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>
14setup({ explicit_done: true });
15
16function 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');
Liquan(Max) Gud8a50252019-04-26 18:47:3222 mark_names.forEach(function(name) {
23 performance.mark(name);
24 });
Nicolas Pena51704832018-04-12 19:56:3225 let mark_entrylist = performance.getEntriesByType('mark');
26
27 entrylist_checker.entrylist_check(mark_entrylist, mark_names.length, string_mark_names, 'Checking all entries.');
28
29 for (let i = 0; i < mark_entrylist.length; ++i)
30 {
31 const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark');
32 entrylist_checker.entrylist_check(mark_entrylist_by_name, 1, string_mark_names,
33 'First loop: checking entry of name "' + mark_entrylist[i].name + '".');
34 }
35
Liquan(Max) Gud8a50252019-04-26 18:47:3236 mark_names.forEach(function(name) {
37 performance.mark(name);
38 });
Nicolas Pena51704832018-04-12 19:56:3239 mark_entrylist = performance.getEntriesByType('mark');
40 entrylist_checker.entrylist_check(mark_entrylist, mark_names.length * 2, string_mark_names, 'Checking all doubly marked entries.');
41
42 for (let i = 0; i < mark_entrylist.length; ++i)
43 {
44 const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark');
45 entrylist_checker.entrylist_check(mark_entrylist_by_name, 2, string_mark_names,
46 'Second loop step ' + i + ': checking entries of name "' + mark_entrylist[i].name + '".');
47 }
48
49 done();
50}
51</script>
52</head>
53<body onload=onload_test()>
54 <h1>Description</h1>
55 <p>This test validates functionality of the interface window.performance.mark.</p>
56 <div id="log"></div>
57</body>
58</html>