blob: 5dc44ef15dc1143449d8623fa7bbc2ca7f9cf2a3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="../resources/log-pause-location.js"></script>
<script>
function a() {
return 1;
}
function b() {
return 2;
}
class Base {
constructor()
{
this._base = true;
}
baseMethod()
{
a();
}
method()
{
a();
}
}
class Child extends Base {
constructor()
{
super();
this._child = true;
}
childMethod()
{
b();
}
method()
{
super.method();
b();
}
get name() { return this._name; }
set name(x) { this._name = x; }
}
class Child2 extends Base {};
function entryClassBasic() {
debugger;
let o = new Child;
o.baseMethod();
o.childMethod();
o.method();
}
function entryClassDefaultConstructor() {
debugger;
let o = new Child2;
}
function entryClassGetterSetter() {
let o = new Child;
debugger;
var name = o.name;
o.name = "Name";
}
// ---------
function test()
{
let suite = InspectorTest.createAsyncSuite("Debugger.stepping.classes");
window.initializeSteppingTestSuite(suite);
addSteppingTestCase({
name: "Debugger.stepping.ClassBasicStepOver",
description: "Should be able to step through class constructors and methods.",
expression: "setTimeout(entryClassBasic)",
steps: [
"over",
"over", // complete: let o = new Child
"over", // complete: o.baseMethod()
"over", // complete: o.childMethod()
"over", // complete: o.method()
"resume",
]
});
addSteppingTestCase({
name: "Debugger.stepping.ClassBasicStepIn",
description: "Should be able to step through class constructors and methods.",
expression: "setTimeout(entryClassBasic)",
steps: [
"over",
"in", // into Child constructor - before super()
"in", // into Base constructor
"out", // out of Base constructor - before this._child
"over", // complete: this._child
"over", // leaving Child constructor
"in", // into Base.prototype.baseMethod
"out", // out of Base.prototype.baseMethod - before childMethod()
"in", // into Child.prototype.childMethod
"out", // out of Child.prototype.childMethod - before method()
"in", // into Child.prototype.method
"in", // into Base.prototype.method
"out", // out of Base.prototype.method - before b()
"out", // out of Child.prototype.method - leaving entry
"resume",
]
});
addSteppingTestCase({
name: "Debugger.stepping.ClassDefaultConstructor",
description: "Should be able to step through class default constructor to base constructor.",
expression: "setTimeout(entryClassDefaultConstructor)",
steps: [
"over",
// FIXME: Autogenerated constructor file is unexpected, jump to class definition? Skip this?
"in", // into autogenerated Child constructor
"in", // into Base constructor
"out", // out of Base constructor
"out", // out of autogenerated Child constructor - leaving entry
"resume",
]
});
addSteppingTestCase({
name: "Debugger.stepping.ClassGetterSetter",
description: "Should be able to step through class getter and setter.",
expression: "setTimeout(entryClassGetterSetter)",
steps: [
"over",
"in", // into getter
"out", // out of getter
"in", // into setter
"out", // out of setter
"resume",
]
});
loadMainPageContent().then(() => {
suite.runTestCasesAndFinish();
});
}
</script>
</head>
<body onload="runTest()">
<p>Checking pause locations when stepping in, out, and over class constructors and methods.</p>
</body>
</html>