Commit 459e299a authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Prepare breakpoint web tests for source map asyncification (4/5)

This CL re-writes a breakpoint web test using a new SourcesTestRunner
helper introduced in https://crrev.com/c/2027427.

This should not only prepare the test for the upcoming source map
asyncification but also reduce the overall flakiness of breakpoint
web tests.

This CL superseeds the current in-flight CL https://crrev.com/c/2022642
which will be abandoned.

R=sigurds@chromium.org

Bug: chromium:1032016
Change-Id: Id5bcd9d3913a2f83c029f52da33e484c61f0c9db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030464Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737714}
parent fcf9267f
......@@ -25,11 +25,13 @@ breakpoint at 2
inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled
Adding conditional enabled breakpoint
breakpoint at 2
breakpoint at 2 conditional
inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled
Disable breakpoints
breakpoint at 2 disabled
breakpoint at 2 disabled conditional
inline breakpoint at (2, 4) disabled
inline breakpoint at (2, 13) disabled
Enable breakpoints
breakpoint at 2 conditional
inline breakpoint at (2, 4)
......
......@@ -8,11 +8,6 @@
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/edit-me-breakpoints.js');
function waitAndDumpDecorations(sourceFrame) {
return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame).then(
() => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
}
Bindings.breakpointManager._storage._breakpoints = new Map();
SourcesTestRunner.runDebuggerTestSuite([
function testAddRemoveBreakpoint(next) {
......@@ -22,15 +17,18 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame))
.then(removeBreakpoint);
// Breakpoint decoration expectations are pairs of line number plus breakpoint decoration counts.
// We expect line 2 to have 2 decorations.
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
).then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
}
},
......@@ -43,15 +41,18 @@
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => SourcesTestRunner.waitBreakpointSidebarPane(true))
.then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true))
.then(() => waitAndDumpDecorations(javaScriptSourceFrame))
.then(() => SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)
))
.then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
}
},
......@@ -62,44 +63,51 @@
function addRegularDisabled(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Adding regular disabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalDisabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 1]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false)
).then(addConditionalDisabled);
}
function addConditionalDisabled() {
TestRunner.addResult('Adding conditional disabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addRegularEnabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 1]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false)
).then(addRegularEnabled);
}
function addRegularEnabled() {
TestRunner.addResult('Adding regular enabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalEnabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
).then(addConditionalEnabled);
}
function addConditionalEnabled() {
TestRunner.addResult('Adding conditional enabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(disableAll);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)
).then(disableAll);
}
function disableAll() {
TestRunner.addResult('Disable breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(enabledAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(enabledAll);
}
function enabledAll() {
TestRunner.addResult('Enable breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(removeAll);
}
function removeAll() {
TestRunner.addResult('Remove breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false);
SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false)
).then(next);
}
}
]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment