11cb0ef41Sopenharmony_ci<!DOCTYPE HTML>
21cb0ef41Sopenharmony_ci<meta charset=utf-8>
31cb0ef41Sopenharmony_ci<title>User Timing: L2 vs L3 feature detection</title>
41cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
51cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
61cb0ef41Sopenharmony_ci<script>
71cb0ef41Sopenharmony_ci  test(() => {
81cb0ef41Sopenharmony_ci    // Feature detection for PerformanceMark.
91cb0ef41Sopenharmony_ci    assert_equals(typeof(PerformanceMark.prototype), "object");
101cb0ef41Sopenharmony_ci    // Test for UserTiming L3.
111cb0ef41Sopenharmony_ci    if (PerformanceMark.prototype.hasOwnProperty('detail')) {
121cb0ef41Sopenharmony_ci      assert_equals(typeof(performance.mark("mark")), "object",
131cb0ef41Sopenharmony_ci        "performance.mark should return an object in UserTiming L3.");
141cb0ef41Sopenharmony_ci    }
151cb0ef41Sopenharmony_ci    // Test for UserTiming L2.
161cb0ef41Sopenharmony_ci    else {
171cb0ef41Sopenharmony_ci      assert_equals(typeof(performance.mark("mark")), "undefined",
181cb0ef41Sopenharmony_ci        "performance.mark should be void in UserTiming L2.");
191cb0ef41Sopenharmony_ci    }
201cb0ef41Sopenharmony_ci  }, "Test PerformanceMark existence and feature detection");
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  test(() => {
231cb0ef41Sopenharmony_ci    // Feature detection for PerformanceMeasure.
241cb0ef41Sopenharmony_ci    assert_equals(typeof(PerformanceMeasure.prototype), "object");
251cb0ef41Sopenharmony_ci    // Test for UserTiming L3.
261cb0ef41Sopenharmony_ci    if (PerformanceMeasure.prototype.hasOwnProperty('detail')) {
271cb0ef41Sopenharmony_ci      assert_equals(typeof(performance.measure("measure")), "object",
281cb0ef41Sopenharmony_ci        "performance.measure should return an object in UserTiming L3.");
291cb0ef41Sopenharmony_ci    }
301cb0ef41Sopenharmony_ci    // Test for UserTiming L2.
311cb0ef41Sopenharmony_ci    else {
321cb0ef41Sopenharmony_ci      assert_equals(typeof(performance.measure("measure")), "undefined",
331cb0ef41Sopenharmony_ci        "performance.measure should be void in UserTiming L2.");
341cb0ef41Sopenharmony_ci    }
351cb0ef41Sopenharmony_ci  }, "Test PerformanceMeasure existence and feature detection");
361cb0ef41Sopenharmony_ci</script>
37