11cb0ef41Sopenharmony_ci
21cb0ef41Sopenharmony_ci<!DOCTYPE html>
31cb0ef41Sopenharmony_ci<html>
41cb0ef41Sopenharmony_ci    <head>
51cb0ef41Sopenharmony_ci        <meta charset="UTF-8" />
61cb0ef41Sopenharmony_ci        <title>window.performance User Timing measure() method is working properly</title>
71cb0ef41Sopenharmony_ci        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
81cb0ef41Sopenharmony_ci        <link rel="help" href="https://w3c.github.io/user-timing/#dom-performance-measure"/>
91cb0ef41Sopenharmony_ci        <script src="/resources/testharness.js"></script>
101cb0ef41Sopenharmony_ci        <script src="/resources/testharnessreport.js"></script>
111cb0ef41Sopenharmony_ci        <script src="/common/performance-timeline-utils.js"></script>
121cb0ef41Sopenharmony_ci        <script src="resources/webperftestharness.js"></script>
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci    <script>
151cb0ef41Sopenharmony_ci        // test data
161cb0ef41Sopenharmony_ci        var startMarkName = "mark_start";
171cb0ef41Sopenharmony_ci        var startMarkValue;
181cb0ef41Sopenharmony_ci        var endMarkName = "mark_end";
191cb0ef41Sopenharmony_ci        var endMarkValue;
201cb0ef41Sopenharmony_ci        var measures;
211cb0ef41Sopenharmony_ci        var testThreshold = 20;
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci        // test measures
241cb0ef41Sopenharmony_ci        var measureTestDelay = 200;
251cb0ef41Sopenharmony_ci        var TEST_MEASURES =
261cb0ef41Sopenharmony_ci        [
271cb0ef41Sopenharmony_ci            {
281cb0ef41Sopenharmony_ci                name:                   "measure_no_start_no_end",
291cb0ef41Sopenharmony_ci                startMark:              undefined,
301cb0ef41Sopenharmony_ci                endMark:                undefined,
311cb0ef41Sopenharmony_ci                startTime:              undefined,
321cb0ef41Sopenharmony_ci                duration:               undefined,
331cb0ef41Sopenharmony_ci                entryType:              "measure",
341cb0ef41Sopenharmony_ci                entryMatch:             undefined,
351cb0ef41Sopenharmony_ci                order:                  undefined,
361cb0ef41Sopenharmony_ci                found:                  false
371cb0ef41Sopenharmony_ci            },
381cb0ef41Sopenharmony_ci            {
391cb0ef41Sopenharmony_ci                name:                   "measure_start_no_end",
401cb0ef41Sopenharmony_ci                startMark:              "mark_start",
411cb0ef41Sopenharmony_ci                endMark:                undefined,
421cb0ef41Sopenharmony_ci                startTime:              undefined,
431cb0ef41Sopenharmony_ci                duration:               undefined,
441cb0ef41Sopenharmony_ci                entryType:              "measure",
451cb0ef41Sopenharmony_ci                entryMatch:             undefined,
461cb0ef41Sopenharmony_ci                order:                  undefined,
471cb0ef41Sopenharmony_ci                found:                  false
481cb0ef41Sopenharmony_ci            },
491cb0ef41Sopenharmony_ci            {
501cb0ef41Sopenharmony_ci                name:                   "measure_start_end",
511cb0ef41Sopenharmony_ci                startMark:              "mark_start",
521cb0ef41Sopenharmony_ci                endMark:                "mark_end",
531cb0ef41Sopenharmony_ci                startTime:              undefined,
541cb0ef41Sopenharmony_ci                duration:               undefined,
551cb0ef41Sopenharmony_ci                entryType:              "measure",
561cb0ef41Sopenharmony_ci                entryMatch:             undefined,
571cb0ef41Sopenharmony_ci                order:                  undefined,
581cb0ef41Sopenharmony_ci                found:                  false
591cb0ef41Sopenharmony_ci            },
601cb0ef41Sopenharmony_ci            {
611cb0ef41Sopenharmony_ci                name:                   "measure_no_start_end",
621cb0ef41Sopenharmony_ci                startMark:              undefined,
631cb0ef41Sopenharmony_ci                endMark:                "mark_end",
641cb0ef41Sopenharmony_ci                startTime:              undefined,
651cb0ef41Sopenharmony_ci                duration:               undefined,
661cb0ef41Sopenharmony_ci                entryType:              "measure",
671cb0ef41Sopenharmony_ci                entryMatch:             undefined,
681cb0ef41Sopenharmony_ci                order:                  undefined,
691cb0ef41Sopenharmony_ci                found:                  false
701cb0ef41Sopenharmony_ci            },
711cb0ef41Sopenharmony_ci            // intentional duplicate of the first measure, used to confirm names can be re-used
721cb0ef41Sopenharmony_ci            {
731cb0ef41Sopenharmony_ci                name:                   "measure_no_start_no_end",
741cb0ef41Sopenharmony_ci                startMark:              undefined,
751cb0ef41Sopenharmony_ci                endMark:                undefined,
761cb0ef41Sopenharmony_ci                startTime:              undefined,
771cb0ef41Sopenharmony_ci                duration:               undefined,
781cb0ef41Sopenharmony_ci                entryType:              "measure",
791cb0ef41Sopenharmony_ci                entryMatch:             undefined,
801cb0ef41Sopenharmony_ci                order:                  undefined,
811cb0ef41Sopenharmony_ci                found:                  false
821cb0ef41Sopenharmony_ci            }
831cb0ef41Sopenharmony_ci        ];
841cb0ef41Sopenharmony_ci        // the index of the duplicate "measure_no_start_no_end"
851cb0ef41Sopenharmony_ci        const duplicate_index = TEST_MEASURES.map(m=>m.name).lastIndexOf('measure_no_start_no_end');
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ci        setup({explicit_done: true});
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci        test_namespace();
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ci        function onload_test()
921cb0ef41Sopenharmony_ci        {
931cb0ef41Sopenharmony_ci            // test for existence of User Timing and Performance Timeline interface
941cb0ef41Sopenharmony_ci            if (!has_required_interfaces())
951cb0ef41Sopenharmony_ci            {
961cb0ef41Sopenharmony_ci                test_true(false,
971cb0ef41Sopenharmony_ci                          "The User Timing and Performance Timeline interfaces, which are required for this test, " +
981cb0ef41Sopenharmony_ci                          "are defined.");
991cb0ef41Sopenharmony_ci
1001cb0ef41Sopenharmony_ci                done();
1011cb0ef41Sopenharmony_ci            }
1021cb0ef41Sopenharmony_ci            else
1031cb0ef41Sopenharmony_ci            {
1041cb0ef41Sopenharmony_ci                // create the start mark for the test measures
1051cb0ef41Sopenharmony_ci                window.performance.mark(startMarkName);
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ci                // get the start mark's value
1081cb0ef41Sopenharmony_ci                startMarkValue = window.performance.getEntriesByName(startMarkName)[0].startTime;
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci                // create the test end mark using the test delay; this will allow for a significant difference between
1111cb0ef41Sopenharmony_ci                // the mark values that should be represented in the duration of measures using these marks
1121cb0ef41Sopenharmony_ci                step_timeout(measure_test_cb, measureTestDelay);
1131cb0ef41Sopenharmony_ci            }
1141cb0ef41Sopenharmony_ci        }
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ci        function measure_test_cb()
1171cb0ef41Sopenharmony_ci        {
1181cb0ef41Sopenharmony_ci            // create the end mark for the test measures
1191cb0ef41Sopenharmony_ci            window.performance.mark(endMarkName);
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ci            // get the end mark's value
1221cb0ef41Sopenharmony_ci            endMarkValue = window.performance.getEntriesByName(endMarkName)[0].startTime;
1231cb0ef41Sopenharmony_ci
1241cb0ef41Sopenharmony_ci            // loop through all measure scenarios and create the corresponding measures
1251cb0ef41Sopenharmony_ci            for (var i in TEST_MEASURES)
1261cb0ef41Sopenharmony_ci            {
1271cb0ef41Sopenharmony_ci                var scenario = TEST_MEASURES[i];
1281cb0ef41Sopenharmony_ci
1291cb0ef41Sopenharmony_ci                if (scenario.startMark == undefined && scenario.endMark == undefined)
1301cb0ef41Sopenharmony_ci                {
1311cb0ef41Sopenharmony_ci                    // both startMark and endMark are undefined, don't provide either parameters
1321cb0ef41Sopenharmony_ci                    window.performance.measure(scenario.name);
1331cb0ef41Sopenharmony_ci
1341cb0ef41Sopenharmony_ci                    // when startMark isn't provided to the measure() call, a DOMHighResTimeStamp corresponding
1351cb0ef41Sopenharmony_ci                    // to the navigationStart attribute with a timebase of the same attribute is used; this is
1361cb0ef41Sopenharmony_ci                    // equivalent to 0
1371cb0ef41Sopenharmony_ci                    scenario.startTime = 0;
1381cb0ef41Sopenharmony_ci
1391cb0ef41Sopenharmony_ci                    // when endMark isn't provided to the measure() call, a DOMHighResTimeStamp corresponding to
1401cb0ef41Sopenharmony_ci                    // the current time with a timebase of the navigationStart attribute is used
1411cb0ef41Sopenharmony_ci                    scenario.duration = (new Date()) - window.performance.timing.navigationStart;
1421cb0ef41Sopenharmony_ci                }
1431cb0ef41Sopenharmony_ci                else if (scenario.startMark != undefined && scenario.endMark == undefined)
1441cb0ef41Sopenharmony_ci                {
1451cb0ef41Sopenharmony_ci                    // only startMark is defined, provide startMark and don't provide endMark
1461cb0ef41Sopenharmony_ci                    window.performance.measure(scenario.name, scenario.startMark);
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci                    // when startMark is provided to the measure() call, the value of the mark whose name is
1491cb0ef41Sopenharmony_ci                    // provided is used for the startMark
1501cb0ef41Sopenharmony_ci                    scenario.startTime = startMarkValue;
1511cb0ef41Sopenharmony_ci
1521cb0ef41Sopenharmony_ci                    // when endMark isn't provided to the measure() call, a DOMHighResTimeStamp corresponding to
1531cb0ef41Sopenharmony_ci                    // the current time with a timebase of the navigationStart attribute is used
1541cb0ef41Sopenharmony_ci                    scenario.duration = window.performance.now() -
1551cb0ef41Sopenharmony_ci                                                startMarkValue;
1561cb0ef41Sopenharmony_ci                }
1571cb0ef41Sopenharmony_ci                else if (scenario.startMark != undefined && scenario.endMark != undefined)
1581cb0ef41Sopenharmony_ci                {
1591cb0ef41Sopenharmony_ci                    // both startMark and endMark are defined, provide both parameters
1601cb0ef41Sopenharmony_ci                    window.performance.measure(scenario.name, scenario.startMark, scenario.endMark);
1611cb0ef41Sopenharmony_ci
1621cb0ef41Sopenharmony_ci                    // when startMark is provided to the measure() call, the value of the mark whose name is
1631cb0ef41Sopenharmony_ci                    // provided is used for the startMark
1641cb0ef41Sopenharmony_ci                    scenario.startTime = startMarkValue;
1651cb0ef41Sopenharmony_ci
1661cb0ef41Sopenharmony_ci                    // when endMark is provided to the measure() call, the value of the mark whose name is
1671cb0ef41Sopenharmony_ci                    // provided is used for the endMark
1681cb0ef41Sopenharmony_ci                    scenario.duration = endMarkValue - startMarkValue;
1691cb0ef41Sopenharmony_ci                }
1701cb0ef41Sopenharmony_ci                else if (scenario.startMark == undefined && scenario.endMark != undefined)
1711cb0ef41Sopenharmony_ci                {
1721cb0ef41Sopenharmony_ci                    // endMark is defined but startMark is undefined, provide both parameters
1731cb0ef41Sopenharmony_ci                    window.performance.measure(scenario.name, scenario.startMark, scenario.endMark);
1741cb0ef41Sopenharmony_ci
1751cb0ef41Sopenharmony_ci                    // when startMark isn't provided to the measure() call, a DOMHighResTimeStamp corresponding
1761cb0ef41Sopenharmony_ci                    // to the navigationStart attribute with a timebase of the same attribute is used; this is
1771cb0ef41Sopenharmony_ci                    // equivalent to 0
1781cb0ef41Sopenharmony_ci                    scenario.startTime = 0;
1791cb0ef41Sopenharmony_ci
1801cb0ef41Sopenharmony_ci                    // when endMark is provided to the measure() call, the value of the mark whose name is
1811cb0ef41Sopenharmony_ci                    // provided is used for the endMark
1821cb0ef41Sopenharmony_ci                    scenario.duration = endMarkValue;
1831cb0ef41Sopenharmony_ci                } else
1841cb0ef41Sopenharmony_ci                {
1851cb0ef41Sopenharmony_ci                    test_true(false, 'Test measure scenario unhandled');
1861cb0ef41Sopenharmony_ci                }
1871cb0ef41Sopenharmony_ci            }
1881cb0ef41Sopenharmony_ci
1891cb0ef41Sopenharmony_ci            // test that expected measures are returned by getEntriesByName
1901cb0ef41Sopenharmony_ci            for (var i in TEST_MEASURES)
1911cb0ef41Sopenharmony_ci            {
1921cb0ef41Sopenharmony_ci                entries = window.performance.getEntriesByName(TEST_MEASURES[i].name);
1931cb0ef41Sopenharmony_ci                // for all test measures, the test will be validate the test measure against the first entry returned
1941cb0ef41Sopenharmony_ci                // by getEntriesByName(), except for the last measure, where since it is a duplicate measure, the test
1951cb0ef41Sopenharmony_ci                // will validate it against the second entry returned by getEntriesByName()
1961cb0ef41Sopenharmony_ci                test_measure(entries[(i == duplicate_index ? 1 : 0)],
1971cb0ef41Sopenharmony_ci                            "window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name + "\")[" +
1981cb0ef41Sopenharmony_ci                            (i == duplicate_index ? 1 : 0) + "]",
1991cb0ef41Sopenharmony_ci                            TEST_MEASURES[i].name,
2001cb0ef41Sopenharmony_ci                            TEST_MEASURES[i].startTime,
2011cb0ef41Sopenharmony_ci                            TEST_MEASURES[i].duration);
2021cb0ef41Sopenharmony_ci                TEST_MEASURES[i].entryMatch = entries[(i == duplicate_index ? 1 : 0)];
2031cb0ef41Sopenharmony_ci            }
2041cb0ef41Sopenharmony_ci
2051cb0ef41Sopenharmony_ci            // test that expected measures are returned by getEntriesByName with the entryType parameter provided
2061cb0ef41Sopenharmony_ci            for (var i in TEST_MEASURES)
2071cb0ef41Sopenharmony_ci            {
2081cb0ef41Sopenharmony_ci                entries = window.performance.getEntriesByName(TEST_MEASURES[i].name, "measure");
2091cb0ef41Sopenharmony_ci
2101cb0ef41Sopenharmony_ci                test_true(match_entries(entries[(i == duplicate_index ? 1 : 0)], TEST_MEASURES[i].entryMatch),
2111cb0ef41Sopenharmony_ci                          "window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name + "\", \"measure\")[" +
2121cb0ef41Sopenharmony_ci                          (i == duplicate_index ? 1 : 0) + "] returns an object containing the \"" + TEST_MEASURES[i].name +
2131cb0ef41Sopenharmony_ci                          "\" measure in the correct order, and its value matches the \"" + TEST_MEASURES[i].name +
2141cb0ef41Sopenharmony_ci                          "\" measure returned by window.performance.getEntriesByName(\"" + TEST_MEASURES[i].name +
2151cb0ef41Sopenharmony_ci                          "\")");
2161cb0ef41Sopenharmony_ci            }
2171cb0ef41Sopenharmony_ci
2181cb0ef41Sopenharmony_ci            // test that expected measures are returned by getEntries
2191cb0ef41Sopenharmony_ci            entries = get_test_entries(window.performance.getEntries(), "measure");
2201cb0ef41Sopenharmony_ci
2211cb0ef41Sopenharmony_ci            test_measure_list(entries, "window.performance.getEntries()", TEST_MEASURES);
2221cb0ef41Sopenharmony_ci
2231cb0ef41Sopenharmony_ci            // test that expected measures are returned by getEntriesByType
2241cb0ef41Sopenharmony_ci            entries = window.performance.getEntriesByType("measure");
2251cb0ef41Sopenharmony_ci
2261cb0ef41Sopenharmony_ci            test_measure_list(entries, "window.performance.getEntriesByType(\"measure\")", TEST_MEASURES);
2271cb0ef41Sopenharmony_ci
2281cb0ef41Sopenharmony_ci            done();
2291cb0ef41Sopenharmony_ci        }
2301cb0ef41Sopenharmony_ci
2311cb0ef41Sopenharmony_ci        function match_entries(entry1, entry2, threshold)
2321cb0ef41Sopenharmony_ci        {
2331cb0ef41Sopenharmony_ci            if (threshold == undefined)
2341cb0ef41Sopenharmony_ci            {
2351cb0ef41Sopenharmony_ci                threshold = 0;
2361cb0ef41Sopenharmony_ci            }
2371cb0ef41Sopenharmony_ci
2381cb0ef41Sopenharmony_ci            var pass = true;
2391cb0ef41Sopenharmony_ci
2401cb0ef41Sopenharmony_ci            // match name
2411cb0ef41Sopenharmony_ci            pass = pass && (entry1.name == entry2.name);
2421cb0ef41Sopenharmony_ci
2431cb0ef41Sopenharmony_ci            // match startTime
2441cb0ef41Sopenharmony_ci            pass = pass && (Math.abs(entry1.startTime - entry2.startTime) <= testThreshold);
2451cb0ef41Sopenharmony_ci
2461cb0ef41Sopenharmony_ci            // match entryType
2471cb0ef41Sopenharmony_ci            pass = pass && (entry1.entryType == entry2.entryType);
2481cb0ef41Sopenharmony_ci
2491cb0ef41Sopenharmony_ci            // match duration
2501cb0ef41Sopenharmony_ci            pass = pass && (Math.abs(entry1.duration - entry2.duration) <= testThreshold);
2511cb0ef41Sopenharmony_ci
2521cb0ef41Sopenharmony_ci            return pass;
2531cb0ef41Sopenharmony_ci        }
2541cb0ef41Sopenharmony_ci
2551cb0ef41Sopenharmony_ci        function test_measure(measureEntry, measureEntryCommand, expectedName, expectedStartTime, expectedDuration)
2561cb0ef41Sopenharmony_ci        {
2571cb0ef41Sopenharmony_ci            // test name
2581cb0ef41Sopenharmony_ci            test_true(measureEntry.name == expectedName, measureEntryCommand + ".name == \"" + expectedName + "\"");
2591cb0ef41Sopenharmony_ci
2601cb0ef41Sopenharmony_ci            // test startTime; since for a mark, the startTime is always equal to a mark's value or the value of a
2611cb0ef41Sopenharmony_ci            // navigation timing attribute, the actual startTime should match the expected value exactly
2621cb0ef41Sopenharmony_ci            test_true(Math.abs(measureEntry.startTime - expectedStartTime) == 0,
2631cb0ef41Sopenharmony_ci                      measureEntryCommand + ".startTime is correct");
2641cb0ef41Sopenharmony_ci
2651cb0ef41Sopenharmony_ci            // test entryType
2661cb0ef41Sopenharmony_ci            test_true(measureEntry.entryType == "measure", measureEntryCommand + ".entryType == \"measure\"");
2671cb0ef41Sopenharmony_ci
2681cb0ef41Sopenharmony_ci            // test duration, allow for an acceptable threshold in the difference between the actual duration and the
2691cb0ef41Sopenharmony_ci            // expected value for the duration
2701cb0ef41Sopenharmony_ci            test_true(Math.abs(measureEntry.duration - expectedDuration) <= testThreshold, measureEntryCommand +
2711cb0ef41Sopenharmony_ci                      ".duration is approximately correct (up to " + testThreshold + "ms difference allowed)");
2721cb0ef41Sopenharmony_ci        }
2731cb0ef41Sopenharmony_ci
2741cb0ef41Sopenharmony_ci        function test_measure_list(measureEntryList, measureEntryListCommand, measureScenarios)
2751cb0ef41Sopenharmony_ci        {
2761cb0ef41Sopenharmony_ci            // give all entries a "found" property that can be set to ensure it isn't tested twice
2771cb0ef41Sopenharmony_ci            for (var i in measureEntryList)
2781cb0ef41Sopenharmony_ci            {
2791cb0ef41Sopenharmony_ci                measureEntryList[i].found = false;
2801cb0ef41Sopenharmony_ci            }
2811cb0ef41Sopenharmony_ci
2821cb0ef41Sopenharmony_ci            for (var i in measureScenarios)
2831cb0ef41Sopenharmony_ci            {
2841cb0ef41Sopenharmony_ci                measureScenarios[i].found = false;
2851cb0ef41Sopenharmony_ci
2861cb0ef41Sopenharmony_ci                for (var j in measureEntryList)
2871cb0ef41Sopenharmony_ci                {
2881cb0ef41Sopenharmony_ci                    if (match_entries(measureEntryList[j], measureScenarios[i]) && !measureEntryList[j].found)
2891cb0ef41Sopenharmony_ci                    {
2901cb0ef41Sopenharmony_ci                        test_true(match_entries(measureEntryList[j], measureScenarios[i].entryMatch),
2911cb0ef41Sopenharmony_ci                                  measureEntryListCommand + " returns an object containing the \"" +
2921cb0ef41Sopenharmony_ci                                  measureScenarios[i].name + "\" measure, and it's value matches the measure " +
2931cb0ef41Sopenharmony_ci                                  "returned by window.performance.getEntriesByName(\"" + measureScenarios[i].name +
2941cb0ef41Sopenharmony_ci                                  "\")[" + (i == duplicate_index ? 1 : 0) + "].");
2951cb0ef41Sopenharmony_ci
2961cb0ef41Sopenharmony_ci                        measureEntryList[j].found = true;
2971cb0ef41Sopenharmony_ci                        measureScenarios[i].found = true;
2981cb0ef41Sopenharmony_ci                        break;
2991cb0ef41Sopenharmony_ci                    }
3001cb0ef41Sopenharmony_ci                }
3011cb0ef41Sopenharmony_ci
3021cb0ef41Sopenharmony_ci                if (!measureScenarios[i].found)
3031cb0ef41Sopenharmony_ci                {
3041cb0ef41Sopenharmony_ci                    test_true(false,
3051cb0ef41Sopenharmony_ci                              measureEntryListCommand + " returns an object containing the \"" +
3061cb0ef41Sopenharmony_ci                              measureScenarios[i].name + "\" measure.");
3071cb0ef41Sopenharmony_ci                }
3081cb0ef41Sopenharmony_ci            }
3091cb0ef41Sopenharmony_ci
3101cb0ef41Sopenharmony_ci            // verify order of output of getEntriesByType
3111cb0ef41Sopenharmony_ci            var startTimeCurr = 0;
3121cb0ef41Sopenharmony_ci            var pass = true;
3131cb0ef41Sopenharmony_ci            for (var i in measureEntryList)
3141cb0ef41Sopenharmony_ci            {
3151cb0ef41Sopenharmony_ci                if (measureEntryList[i].startTime < startTimeCurr)
3161cb0ef41Sopenharmony_ci                {
3171cb0ef41Sopenharmony_ci                    pass = false;
3181cb0ef41Sopenharmony_ci                }
3191cb0ef41Sopenharmony_ci                startTimeCurr = measureEntryList[i].startTime;
3201cb0ef41Sopenharmony_ci            }
3211cb0ef41Sopenharmony_ci            test_true(pass,
3221cb0ef41Sopenharmony_ci                      measureEntryListCommand + " returns an object containing all test " +
3231cb0ef41Sopenharmony_ci                      "measures in order.");
3241cb0ef41Sopenharmony_ci        }
3251cb0ef41Sopenharmony_ci
3261cb0ef41Sopenharmony_ci        function get_test_entries(entryList, entryType)
3271cb0ef41Sopenharmony_ci        {
3281cb0ef41Sopenharmony_ci            var testEntries = new Array();
3291cb0ef41Sopenharmony_ci
3301cb0ef41Sopenharmony_ci            // filter entryList
3311cb0ef41Sopenharmony_ci            for (var i in entryList)
3321cb0ef41Sopenharmony_ci            {
3331cb0ef41Sopenharmony_ci                if (entryList[i].entryType == entryType)
3341cb0ef41Sopenharmony_ci                {
3351cb0ef41Sopenharmony_ci                    testEntries.push(entryList[i]);
3361cb0ef41Sopenharmony_ci                }
3371cb0ef41Sopenharmony_ci            }
3381cb0ef41Sopenharmony_ci
3391cb0ef41Sopenharmony_ci            return testEntries;
3401cb0ef41Sopenharmony_ci        }
3411cb0ef41Sopenharmony_ci    </script>
3421cb0ef41Sopenharmony_ci    </head>
3431cb0ef41Sopenharmony_ci    <body onload="onload_test();">
3441cb0ef41Sopenharmony_ci        <h1>Description</h1>
3451cb0ef41Sopenharmony_ci        <p>This test validates that the performance.measure() method is working properly. This test creates the
3461cb0ef41Sopenharmony_ci           following measures to test this method:
3471cb0ef41Sopenharmony_ci            <ul>
3481cb0ef41Sopenharmony_ci                <li>"measure_no_start_no_end": created using a measure() call without a startMark or endMark
3491cb0ef41Sopenharmony_ci                    provided</li>
3501cb0ef41Sopenharmony_ci                <li>"measure_start_no_end": created using a measure() call with only the startMark provided</li>
3511cb0ef41Sopenharmony_ci                <li>"measure_start_end": created using a measure() call with both a startMark or endMark provided</li>
3521cb0ef41Sopenharmony_ci                <li>"measure_no_start_end": created using a measure() call with only the endMark provided</li>
3531cb0ef41Sopenharmony_ci                <li>"measure_no_start_no_end": duplicate of the first measure, used to confirm names can be re-used</li>
3541cb0ef41Sopenharmony_ci            </ul>
3551cb0ef41Sopenharmony_ci           After creating each measure, the existence of these measures is validated by calling
3561cb0ef41Sopenharmony_ci           performance.getEntriesByName() (both with and without the entryType parameter provided),
3571cb0ef41Sopenharmony_ci           performance.getEntriesByType(), and performance.getEntries()
3581cb0ef41Sopenharmony_ci        </p>
3591cb0ef41Sopenharmony_ci
3601cb0ef41Sopenharmony_ci        <div id="log"></div>
3611cb0ef41Sopenharmony_ci    </body>
3621cb0ef41Sopenharmony_ci</html>
363