• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
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');
22    mark_names.forEach(function(name) {
23        performance.mark(name);
24    });
25    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
36    mark_names.forEach(function(name) {
37        performance.mark(name);
38    });
39    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>
59