servo/tests/wpt/web-platform-tests/user-timing/mark-entry-constructor.html

50 lines
No EOL
2.1 KiB
HTML

<!DOCTYPE HTML>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/user-timing-helper.js"></script>
<title>User Timing L3: create mark entry by constructor</title>
<h1>User Timing L3: create mark entry by constructor</h1>
<p>
User Timing L3: Mark entry can be created by using constructor."
</p>
<script>
test(()=>{
const entry = new PerformanceMark("name");
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark"});
}, "Mark entry can be created by 'new PerformanceMark(string)'.");
test(()=>{
const entry = new PerformanceMark("name", {});
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark"});
}, "Mark entry can be created by 'new PerformanceMark(string, {})'.");
test(()=>{
const entry = new PerformanceMark("name", {startTime: 1});
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark", startTime: 1});
}, "Mark entry can be created by 'new PerformanceMark(string, {startTime})'.");
test(()=>{
const entry = new PerformanceMark("name", {detail: {info: "abc"}});
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark", detail: {info: "abc"}});
}, "Mark entry can be created by 'new PerformanceMark(string, {detail})'.");
test(()=>{
const entry =
new PerformanceMark("name", {startTime: 1, detail: {info: "abc"}});
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark", startTime: 1, detail: {info: "abc"}});
}, "Mark entry can be created by " +
"'new PerformanceMark(string, {startTime, detail})'.");
test(()=>{
const entry = new PerformanceMark("name");
assert_true(entry instanceof PerformanceMark);
checkEntry(entry, {name: "name", entryType: "mark"});
assert_equals(performance.getEntriesByName("name").length, 0);
}, "Using new PerformanceMark() shouldn't add the entry to performance timeline.");
</script>