Skip to content

Commit

Permalink
[UserTimingL3] Fix meature, mark API feature detection
Browse files Browse the repository at this point in the history
UserTimingL3 uses returned value for feature detection. If measure and mark
API returns null, the APIs are L2 API; If the APIs return an entry, the APIs are
L3 API. However, in the current implementation, when L3 API is enabled, the
APIs do not always return the created entry.

This CL is to fix this bug, and add layout tests to verify it.

Change-Id: I9854f0abd0d64a3334701e09d6ce0fc245fcca3e
Reviewed-on: https://chromium-review.googlesource.com/c/1338225
Commit-Queue: Liquan (Max) Gǔ <maxlg@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608552}
  • Loading branch information
maxlgu authored and chromium-wpt-export-bot committed Nov 15, 2018
1 parent a2fb878 commit d38540d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions user-timing/mark-measure-return-null.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>User Timing: L2 APIs return null</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<p>User Timing: L2 APIs return null</p>
<div id="log"></div>
<script>
async_test(function (t) {
self.performance.clearMeasures();
const measure = self.performance.measure("measure1");
assert_equals(measure, null);
t.done();
}, "L2: performance.measure(name) should return null.");

async_test(function (t) {
self.performance.clearMeasures();
self.performance.mark("1");
const measure = self.performance.measure("measure2", 1);
assert_equals(measure, null);
t.done();
}, "L2: performance.measure(name, param1) should return null.");

async_test(function (t) {
self.performance.clearMeasures();
self.performance.mark("1");
self.performance.mark("2");
const measure = self.performance.measure("measure3", 1, 2);
assert_equals(measure, null);
t.done();
}, "L2: performance.measure(name, param1, param2) should return null.");

async_test(function (t) {
self.performance.clearMarks();
const mark = self.performance.mark("mark1");
assert_equals(mark, null);
t.done();
}, "L2: performance.mark(name) should return null.");

async_test(function (t) {
self.performance.clearMarks();
const mark = self.performance.mark("mark2", { startTime: 34 });
assert_equals(mark, null);
t.done();
}, "L2: performance.mark(name, param) should return null.");
</script>

0 comments on commit d38540d

Please sign in to comment.