blob: 23162d5421e93234ba7e0c80eb5ff8f63b800e22 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function triggerAssertions() {
console.assert(true, "Passing assertion");
console.assert(false, "Failing assertion");
}
function test()
{
// Pause on all exceptions should not affect pausing on assertions.
WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
let suite = InspectorTest.createAsyncSuite("Debugger.setPauseOnAssertions");
suite.addTestCase({
name: "Debugger.setPauseOnAssertions.Disabled",
description: "Do not pause on assertions when disabled.",
test(resolve, reject) {
WI.debuggerManager.assertionFailuresBreakpoint.disabled = true;
let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
InspectorTest.fail("Should not have paused.");
reject();
});
InspectorTest.evaluateInPage("triggerAssertions()", () => {
InspectorTest.pass("Should not pause.");
WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, listener);
resolve();
});
}
});
suite.addTestCase({
name: "Debugger.setPauseOnAssertions.Enabled",
description: "Pause on assertions when enabled.",
test(resolve, reject) {
WI.debuggerManager.assertionFailuresBreakpoint.disabled = false;
let didPause = false;
let listener = WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
InspectorTest.pass("Should paused.");
WI.debuggerManager.resume();
didPause = true;
});
InspectorTest.evaluateInPage("triggerAssertions()", () => {
if (!didPause)
InspectorTest.fail("Should have paused.");
resolve();
});
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Debugger.setPauseOnAssertions</p>
</body>
</html>