Automatic update from web-platform-tests [UserTiming] Fix mark-measure-return-null test The test was incorrect per L2 spec: a void method 'returns' an undefined value, not a null object. This CL changes the test to show how to perform feature detection and compares L2 and L3 behavior. Bug: 914441 Change-Id: Id7173b2693d5bd42013dcdd25266d64fa8956e6a -- Merge pull request #14511 from web-platform-tests/chromium-export-cl-1377129 [UserTiming] Fix mark-measure-return-null test -- wpt-commits: 1dd43edb91fa86dbda5af3a9675e3b103c9e8cd0, ca3a8d6d2de5be8dac1daa17126d8f30d1489c95 wpt-pr: 14511
37 lines
1.4 KiB
HTML
37 lines
1.4 KiB
HTML
<!DOCTYPE HTML>
|
|
<meta charset=utf-8>
|
|
<title>User Timing: L2 vs L3 feature detection</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
test(() => {
|
|
// Feature detection for PerformanceMark.
|
|
assert_equals(typeof(PerformanceMark.prototype), "object");
|
|
// Test for UserTiming L3.
|
|
if (PerformanceMark.prototype.hasOwnProperty('detail')) {
|
|
assert_equals(typeof(performance.mark("mark")), "object",
|
|
"performance.mark should return an object in UserTiming L3.");
|
|
}
|
|
// Test for UserTiming L2.
|
|
else {
|
|
assert_equals(typeof(performance.mark("mark")), "undefined",
|
|
"performance.mark should be void in UserTiming L2.");
|
|
}
|
|
}, "Test PerformanceMark existence and feature detection");
|
|
|
|
test(() => {
|
|
// Feature detection for PerformanceMeasure.
|
|
assert_equals(typeof(PerformanceMeasure.prototype), "object");
|
|
// Test for UserTiming L3.
|
|
if (PerformanceMeasure.prototype.hasOwnProperty('detail')) {
|
|
assert_equals(typeof(performance.measure("measure")), "object",
|
|
"performance.measure should return an object in UserTiming L3.");
|
|
}
|
|
// Test for UserTiming L2.
|
|
else {
|
|
assert_equals(typeof(performance.measure("measure")), "undefined",
|
|
"performance.measure should be void in UserTiming L2.");
|
|
}
|
|
}, "Test PerformanceMeasure existence and feature detection");
|
|
</script>
|