49 lines
No EOL
1.5 KiB
HTML
49 lines
No EOL
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
This tests that 'performance.measure' throws exceptions with reasonable messages.
|
|
</head>
|
|
<body>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
window.performance.clearMarks();
|
|
window.performance.clearMeasures();
|
|
|
|
window.performance.mark('mark');
|
|
|
|
const eventMarks = [
|
|
'unloadEventStart',
|
|
'unloadEventEnd',
|
|
'redirectStart',
|
|
'redirectEnd',
|
|
'secureConnectionStart',
|
|
'domInteractive',
|
|
'domContentLoadedEventStart',
|
|
'domContentLoadedEventEnd',
|
|
'domComplete',
|
|
'loadEventStart',
|
|
'loadEventEnd',
|
|
];
|
|
eventMarks.forEach(function(name) {
|
|
test(()=>{
|
|
assert_throws_dom("InvalidAccessError", ()=>{
|
|
window.performance.measure("measuring", name, "mark");
|
|
}, "Should throw");
|
|
}, `Passing '${name}' as a mark to measure API should cause error when the mark is empty.`);
|
|
});
|
|
|
|
const args = [
|
|
51.15, // Verify that number is parsed as string, not number.
|
|
"DoesNotExist", // Non-existant mark name should cause error.
|
|
];
|
|
args.forEach(each => {
|
|
test(()=>{
|
|
assert_throws_dom("SyntaxError", ()=>{
|
|
window.performance.measure("measuring", each, "mark");
|
|
}, "Should throw");
|
|
}, `Passing ${each} as a mark to measure API should cause error.`);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |