v8/test/inspector/debugger/break-on-exception-and-step.js
Alexey Kozyatinskiy 954829b037 [inspector] added missing tests
Added tests that I forgot to commit with big debug.js removal.

TBR=dgozman@chromium.org

Bug: none
Change-Id: I518dd254af116d391a2af96a6f6c11da457129a1
Reviewed-on: https://chromium-review.googlesource.com/1086375
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53507}
2018-06-05 01:43:33 +00:00

70 lines
2.5 KiB
JavaScript

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
let {session, contextGroup, Protocol} = InspectorTest.start(
'Tests for break on exception and stepping.');
session.setupScriptMap();
Protocol.Debugger.enable();
Protocol.Debugger.setBlackboxPatterns({patterns: ['expr\.js']});
Protocol.Debugger.onPaused(async ({params:{callFrames:[topFrame], data}}) => {
if (data) {
InspectorTest.log('paused on exception:');
InspectorTest.logMessage(data);
}
await session.logSourceLocation(topFrame.location);
Protocol.Debugger.stepInto();
});
contextGroup.addScript(`
function a() { n(); };
function b() { c(); };
function c() { n(); };
function d() { x = 1; try { e(); } catch(x) { x = 2; } };
function e() { n(); };
function f() { x = 1; try { g(); } catch(x) { x = 2; } };
function g() { h(); };
function h() { x = 1; throw 1; };
`);
InspectorTest.runAsyncTestSuite([
async function testStepThrougA() {
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'a()\n//# sourceURL=expr.js'});
},
async function testStepThrougB() {
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'b()\n//# sourceURL=expr.js'});
},
async function testStepThrougD() {
await Protocol.Debugger.setPauseOnExceptions({state: 'uncaught'});
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'd()\n//# sourceURL=expr.js'});
await Protocol.Debugger.setPauseOnExceptions({state: 'none'});
},
async function testStepThrougDWithBreakOnAllExceptions() {
await Protocol.Debugger.setPauseOnExceptions({state: 'all'});
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'd()\n//# sourceURL=expr.js'});
await Protocol.Debugger.setPauseOnExceptions({state: 'none'});
},
async function testStepThrougF() {
await Protocol.Debugger.setPauseOnExceptions({state: 'uncaught'});
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'f()\n//# sourceURL=expr.js'});
await Protocol.Debugger.setPauseOnExceptions({state: 'none'});
},
async function testStepThrougFWithBreakOnAllExceptions() {
await Protocol.Debugger.setPauseOnExceptions({state: 'all'});
Protocol.Debugger.pause();
await Protocol.Runtime.evaluate({expression: 'f()\n//# sourceURL=expr.js'});
await Protocol.Debugger.setPauseOnExceptions({state: 'none'});
}
]);