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 ...@@ -25,11 +25,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,18 @@ ...@@ -22,15 +17,18 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
// 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) SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame)) ).then(removeBreakpoint);
.then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
} }
}, },
...@@ -43,15 +41,18 @@ ...@@ -43,15 +41,18 @@
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true) SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => SourcesTestRunner.waitBreakpointSidebarPane(true)) .then(() => SourcesTestRunner.waitBreakpointSidebarPane(true))
.then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)) .then(() => SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
.then(() => waitAndDumpDecorations(javaScriptSourceFrame)) javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)
))
.then(removeBreakpoint); .then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2); SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next()); SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
} }
}, },
...@@ -62,44 +63,51 @@ ...@@ -62,44 +63,51 @@
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.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 1]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false); 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.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 1]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false); 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.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true); 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.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true); 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.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(enabledAll);
} }
function enabledAll() { function enabledAll() {
TestRunner.addResult('Enable breakpoints'); TestRunner.addResult('Enable breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll); SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [[2, 2]], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true); SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(removeAll);
} }
function removeAll() { function removeAll() {
TestRunner.addResult('Remove breakpoints'); TestRunner.addResult('Remove breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(next); SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(javaScriptSourceFrame, [], () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false); 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