11cb0ef41Sopenharmony_ci<!DOCTYPE html>
21cb0ef41Sopenharmony_ci<html>
31cb0ef41Sopenharmony_ci<head>
41cb0ef41Sopenharmony_ci<meta charset="utf-8" />
51cb0ef41Sopenharmony_ci<title>functionality test of window.performance.mark</title>
61cb0ef41Sopenharmony_ci<link rel="author" title="Intel" href="http://www.intel.com/" />
71cb0ef41Sopenharmony_ci<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
81cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
91cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
101cb0ef41Sopenharmony_ci<script src="/common/performance-timeline-utils.js"></script>
111cb0ef41Sopenharmony_ci<script src="resources/webperftestharness.js"></script>
121cb0ef41Sopenharmony_ci<script src="resources/webperftestharnessextension.js"></script>
131cb0ef41Sopenharmony_ci<script>
141cb0ef41Sopenharmony_cisetup({ explicit_done: true });
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cifunction onload_test()
171cb0ef41Sopenharmony_ci{
181cb0ef41Sopenharmony_ci    const entrylist_checker = new performance_entrylist_checker('mark');
191cb0ef41Sopenharmony_ci    const string_mark_names = mark_names.map(function (x) { return String(x)});
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci    test_equals(performance.getEntriesByType("mark").length, 0, 'There should be ' + 0 + ' marks');
221cb0ef41Sopenharmony_ci    mark_names.forEach(function(name) {
231cb0ef41Sopenharmony_ci        performance.mark(name);
241cb0ef41Sopenharmony_ci    });
251cb0ef41Sopenharmony_ci    let mark_entrylist = performance.getEntriesByType('mark');
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci    entrylist_checker.entrylist_check(mark_entrylist, mark_names.length, string_mark_names, 'Checking all entries.');
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci    for (let i = 0; i < mark_entrylist.length; ++i)
301cb0ef41Sopenharmony_ci    {
311cb0ef41Sopenharmony_ci        const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark');
321cb0ef41Sopenharmony_ci        entrylist_checker.entrylist_check(mark_entrylist_by_name, 1, string_mark_names,
331cb0ef41Sopenharmony_ci            'First loop: checking entry of name "' + mark_entrylist[i].name + '".');
341cb0ef41Sopenharmony_ci    }
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci    mark_names.forEach(function(name) {
371cb0ef41Sopenharmony_ci        performance.mark(name);
381cb0ef41Sopenharmony_ci    });
391cb0ef41Sopenharmony_ci    mark_entrylist = performance.getEntriesByType('mark');
401cb0ef41Sopenharmony_ci    entrylist_checker.entrylist_check(mark_entrylist, mark_names.length * 2, string_mark_names, 'Checking all doubly marked entries.');
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci    for (let i = 0; i < mark_entrylist.length; ++i)
431cb0ef41Sopenharmony_ci    {
441cb0ef41Sopenharmony_ci        const mark_entrylist_by_name = performance.getEntriesByName(mark_entrylist[i].name, 'mark');
451cb0ef41Sopenharmony_ci        entrylist_checker.entrylist_check(mark_entrylist_by_name, 2, string_mark_names,
461cb0ef41Sopenharmony_ci            'Second loop step ' + i + ': checking entries of name "' + mark_entrylist[i].name + '".');
471cb0ef41Sopenharmony_ci    }
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci    done();
501cb0ef41Sopenharmony_ci}
511cb0ef41Sopenharmony_ci</script>
521cb0ef41Sopenharmony_ci</head>
531cb0ef41Sopenharmony_ci<body onload=onload_test()>
541cb0ef41Sopenharmony_ci    <h1>Description</h1>
551cb0ef41Sopenharmony_ci    <p>This test validates functionality of the interface window.performance.mark.</p>
561cb0ef41Sopenharmony_ci    <div id="log"></div>
571cb0ef41Sopenharmony_ci</body>
581cb0ef41Sopenharmony_ci</html>
59