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

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

This is a reland of 459e299a

The reland rewrites the "addBreakpoint" function in the
"testTwoBreakpointsResolvedInOneLine" test case by using the new
de-flaked helper for both breakpoints (that are on the same line).

Unfortunately, between revert and reland a change to depot_tools requires
JavaScript to be formatted now, so the reland contains lots of
formatting changes compared to the original CL.

Original change's description:
> 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/+/2030464
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> Commit-Queue: Simon Zünd <szuend@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#737714}

Bug: chromium:1032016
Change-Id: Ibed68e7b8c8494cd3cc6ea0d744ec9c42f7acb5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035375
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: default avatarMathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738097}
parent 19d94ea9
...@@ -10,6 +10,9 @@ Toggle breakpoint ...@@ -10,6 +10,9 @@ Toggle breakpoint
Running: testTwoBreakpointsResolvedInOneLine Running: testTwoBreakpointsResolvedInOneLine
Setting breakpoint Setting breakpoint
breakpoint at 2
inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled
breakpoint at 2 conditional breakpoint at 2 conditional
inline breakpoint at (2, 4) inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled inline breakpoint at (2, 13) disabled
...@@ -25,11 +28,13 @@ breakpoint at 2 ...@@ -25,11 +28,13 @@ breakpoint at 2
inline breakpoint at (2, 4) inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled inline breakpoint at (2, 13) disabled
Adding conditional enabled breakpoint Adding conditional enabled breakpoint
breakpoint at 2 breakpoint at 2 conditional
inline breakpoint at (2, 4) inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled inline breakpoint at (2, 13) disabled
Disable breakpoints 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 Enable breakpoints
breakpoint at 2 conditional breakpoint at 2 conditional
inline breakpoint at (2, 4) inline breakpoint at (2, 4)
......
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
await TestRunner.showPanel('sources'); await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/edit-me-breakpoints.js'); 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(); Bindings.breakpointManager._storage._breakpoints = new Map();
SourcesTestRunner.runDebuggerTestSuite([ SourcesTestRunner.runDebuggerTestSuite([
function testAddRemoveBreakpoint(next) { function testAddRemoveBreakpoint(next) {
...@@ -22,15 +17,24 @@ ...@@ -22,15 +17,24 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) // Breakpoint decoration expectations are pairs of line number plus
.then(() => waitAndDumpDecorations(javaScriptSourceFrame)) // breakpoint decoration counts. We expect line 2 to have 2 decorations.
SourcesTestRunner
.runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, '', true))
.then(removeBreakpoint); .then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); SourcesTestRunner
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [],
() => SourcesTestRunner.toggleBreakpoint(
javaScriptSourceFrame, 2))
.then(next);
} }
}, },
...@@ -38,20 +42,28 @@ ...@@ -38,20 +42,28 @@
var javaScriptSourceFrame; var javaScriptSourceFrame;
SourcesTestRunner.showScriptSource('edit-me-breakpoints.js', addBreakpoint); SourcesTestRunner.showScriptSource('edit-me-breakpoints.js', addBreakpoint);
function addBreakpoint(sourceFrame) { async function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
.then(() => SourcesTestRunner.waitBreakpointSidebarPane(true)) javaScriptSourceFrame, [[2, 2]],
.then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)) () => SourcesTestRunner.createNewBreakpoint(
.then(() => waitAndDumpDecorations(javaScriptSourceFrame)) javaScriptSourceFrame, 2, '', true));
.then(removeBreakpoint); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, 'true', true));
removeBreakpoint();
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); SourcesTestRunner
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [],
() => SourcesTestRunner.toggleBreakpoint(
javaScriptSourceFrame, 2))
.then(next);
} }
}, },
...@@ -62,44 +74,72 @@ ...@@ -62,44 +74,72 @@
function addRegularDisabled(sourceFrame) { function addRegularDisabled(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Adding regular disabled breakpoint'); TestRunner.addResult('Adding regular disabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalDisabled); SourcesTestRunner
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 1]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, '', false))
.then(addConditionalDisabled);
} }
function addConditionalDisabled() { function addConditionalDisabled() {
TestRunner.addResult('Adding conditional disabled breakpoint'); TestRunner.addResult('Adding conditional disabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addRegularEnabled); SourcesTestRunner
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 1]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, 'true', false))
.then(addRegularEnabled);
} }
function addRegularEnabled() { function addRegularEnabled() {
TestRunner.addResult('Adding regular enabled breakpoint'); TestRunner.addResult('Adding regular enabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalEnabled); SourcesTestRunner
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, '', true))
.then(addConditionalEnabled);
} }
function addConditionalEnabled() { function addConditionalEnabled() {
TestRunner.addResult('Adding conditional enabled breakpoint'); TestRunner.addResult('Adding conditional enabled breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(disableAll); SourcesTestRunner
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.createNewBreakpoint(
javaScriptSourceFrame, 2, 'true', true))
.then(disableAll);
} }
function disableAll() { function disableAll() {
TestRunner.addResult('Disable breakpoints'); TestRunner.addResult('Disable breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(enabledAll); SourcesTestRunner
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.toggleBreakpoint(
javaScriptSourceFrame, 2, true))
.then(enabledAll);
} }
function enabledAll() { function enabledAll() {
TestRunner.addResult('Enable breakpoints'); TestRunner.addResult('Enable breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll); SourcesTestRunner
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); .runActionAndWaitForExactBreakpointDecorations(
javaScriptSourceFrame, [[2, 2]],
() => SourcesTestRunner.toggleBreakpoint(
javaScriptSourceFrame, 2, true))
.then(removeAll);
} }
function removeAll() { function removeAll() {
TestRunner.addResult('Remove breakpoints'); TestRunner.addResult('Remove breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(next); SourcesTestRunner
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false); .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