Commit 4110ad9c authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

Revert "Remove event races in two breakpoint decoration tests"

This reverts commit 61f91381.

Reason for revert: Likely causing flakiness in source-frame-breakpoint-decorations.js: https://crbug.com/1043146

Original change's description:
> Remove event races in two breakpoint decoration tests
> 
> This CL changes two layout tests to follow the pattern of:
>   1. Install an instrumentation promise
>   2. Run and await an async action
>   3. Await that the instrumentation is called
>   4. Dump breakpoint information
> 
> This CL is also in preparation for asyncification of source mapping,
> hence making the "action" async.
> 
> Drive-by: Re-baseline one of the layout tests that seems to be fixed
> now.
> 
> Bug: chromium:1032016
> Change-Id: Ibad4160fe9ab32aa3f818cdd4937112c3f4e6f08
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000023
> Commit-Queue: Simon Zünd <szuend@chromium.org>
> Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#731171}

TBR=sigurds@chromium.org,szuend@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1032016
Change-Id: I05e46d646d6cbf1516c8d9a2c1eab46cd8d05377
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007810Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732905}
parent 4df2cd8f
...@@ -25,13 +25,11 @@ breakpoint at 2 ...@@ -25,13 +25,11 @@ 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 conditional 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
Disable breakpoints Disable breakpoints
breakpoint at 2 disabled conditional breakpoint at 2 disabled
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,9 @@ ...@@ -8,11 +8,9 @@
await TestRunner.showPanel('sources'); await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/edit-me-breakpoints.js'); await TestRunner.addScriptTag('resources/edit-me-breakpoints.js');
async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) { function waitAndDumpDecorations(sourceFrame) {
const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame); return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame).then(
await action(); () => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
await waitPromise;
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
} }
Bindings.breakpointManager._storage._breakpoints = new Map(); Bindings.breakpointManager._storage._breakpoints = new Map();
...@@ -24,16 +22,15 @@ ...@@ -24,16 +22,15 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => 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');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2) waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
).then(next);
} }
}, },
...@@ -46,16 +43,15 @@ ...@@ -46,16 +43,15 @@
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(() => runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => .then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true))
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true) .then(() => waitAndDumpDecorations(javaScriptSourceFrame))
)).then(removeBreakpoint); .then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2) waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
).then(next);
} }
}, },
...@@ -66,51 +62,44 @@ ...@@ -66,51 +62,44 @@
function addRegularDisabled(sourceFrame) { function addRegularDisabled(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Adding regular disabled breakpoint'); TestRunner.addResult('Adding regular disabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalDisabled);
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');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(addRegularEnabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false) SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false);
).then(addRegularEnabled);
} }
async function addRegularEnabled() { function addRegularEnabled() {
TestRunner.addResult('Adding regular enabled breakpoint'); TestRunner.addResult('Adding regular enabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalEnabled);
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');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(disableAll);
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');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(enabledAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
).then(enabledAll);
} }
function enabledAll() { function enabledAll() {
TestRunner.addResult('Enable breakpoints'); TestRunner.addResult('Enable breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
).then(removeAll);
} }
function removeAll() { function removeAll() {
TestRunner.addResult('Remove breakpoints'); TestRunner.addResult('Remove breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false);
).then(next);
} }
} }
]); ]);
......
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
//# sourceURL=foo.js //# sourceURL=foo.js
`); `);
async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) { function waitAndDumpDecorations(sourceFrame) {
const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame); return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame)
await action(); .then(
await waitPromise; () => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
} }
Bindings.breakpointManager._storage._breakpoints = new Map(); Bindings.breakpointManager._storage._breakpoints = new Map();
...@@ -46,16 +45,14 @@ ...@@ -46,16 +45,14 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
).then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11);
).then(next);
} }
}, },
...@@ -66,16 +63,14 @@ ...@@ -66,16 +63,14 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true)
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true) .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
).then(removeBreakpoint);
} }
function removeBreakpoint() { function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13) waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
).then(next);
} }
}, },
...@@ -86,33 +81,29 @@ ...@@ -86,33 +81,29 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true) .then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocation));
).then(clickBySecondLocation);
} }
function clickBySecondLocation() { function clickBySecondLocation() {
TestRunner.addResult('Click by second breakpoint'); TestRunner.addResult('Click by second breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(clickByFirstLocation);
SourcesTestRunner.clickDebuggerPluginBreakpoint( SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next) javaScriptSourceFrame, 11, 1, next);
).then(clickByFirstLocation);
} }
function clickByFirstLocation() { function clickByFirstLocation() {
TestRunner.addResult('Click by first breakpoint'); TestRunner.addResult('Click by first breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocationAgain);
SourcesTestRunner.clickDebuggerPluginBreakpoint( SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next) javaScriptSourceFrame, 11, 0, next);
).then(clickBySecondLocationAgain);
} }
function clickBySecondLocationAgain() { function clickBySecondLocationAgain() {
TestRunner.addResult('Click by second breakpoint'); TestRunner.addResult('Click by second breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint( SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next) javaScriptSourceFrame, 11, 1, next);
).then(next);
} }
}, },
...@@ -123,26 +114,23 @@ ...@@ -123,26 +114,23 @@
function addBreakpoint(sourceFrame) { function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame; javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint in line 4'); TestRunner.addResult('Setting breakpoint in line 4');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => SourcesTestRunner.toggleBreakpoint(sourceFrame, 12, false);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 12, false) waitAndDumpDecorations(javaScriptSourceFrame).then(toggleBreakpointInAnotherLine);
).then(toggleBreakpointInAnotherLine);
} }
function toggleBreakpointInAnotherLine() { function toggleBreakpointInAnotherLine() {
TestRunner.addResult('Setting breakpoint in line 3'); TestRunner.addResult('Setting breakpoint in line 3');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoints);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false);
).then(removeBreakpoints);
} }
function removeBreakpoints() { function removeBreakpoints() {
TestRunner.addResult('Click by first inline breakpoints'); TestRunner.addResult('Click by first inline breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => { waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint( SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next); javaScriptSourceFrame, 11, 0, next);
SourcesTestRunner.clickDebuggerPluginBreakpoint( SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 12, 0, next); javaScriptSourceFrame, 12, 0, next);
}).then(next);
} }
}, },
...@@ -150,14 +138,13 @@ ...@@ -150,14 +138,13 @@
let javaScriptSourceFrame = await SourcesTestRunner.showScriptSourcePromise('foo.js'); let javaScriptSourceFrame = await SourcesTestRunner.showScriptSourcePromise('foo.js');
TestRunner.addResult('Setting breakpoint'); TestRunner.addResult('Setting breakpoint');
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => await SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true)
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true) await waitAndDumpDecorations(javaScriptSourceFrame);
);
TestRunner.addResult('Toggle breakpoint'); TestRunner.addResult('Toggle breakpoint');
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => let decorationsPromise = waitAndDumpDecorations(javaScriptSourceFrame);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28) SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28);
); await decorationsPromise;
next(); 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