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
inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled
Adding conditional enabled breakpoint
breakpoint at 2 conditional
breakpoint at 2
inline breakpoint at (2, 4)
inline breakpoint at (2, 13) disabled
Disable breakpoints
breakpoint at 2 disabled conditional
inline breakpoint at (2, 4) disabled
inline breakpoint at (2, 13) disabled
breakpoint at 2 disabled
Enable breakpoints
breakpoint at 2 conditional
inline breakpoint at (2, 4)
......
......@@ -8,11 +8,9 @@
await TestRunner.showPanel('sources');
await TestRunner.addScriptTag('resources/edit-me-breakpoints.js');
async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) {
const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame);
await action();
await waitPromise;
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
function waitAndDumpDecorations(sourceFrame) {
return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame).then(
() => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
}
Bindings.breakpointManager._storage._breakpoints = new Map();
......@@ -24,16 +22,15 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
).then(removeBreakpoint);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame))
.then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
}
},
......@@ -46,16 +43,15 @@
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
.then(() => SourcesTestRunner.waitBreakpointSidebarPane(true))
.then(() => runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)
)).then(removeBreakpoint);
.then(() => SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true))
.then(() => waitAndDumpDecorations(javaScriptSourceFrame))
.then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2)
).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
}
},
......@@ -66,51 +62,44 @@
function addRegularDisabled(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Adding regular disabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false)
).then(addConditionalDisabled);
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalDisabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', false);
}
function addConditionalDisabled() {
TestRunner.addResult('Adding conditional disabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false)
).then(addRegularEnabled);
waitAndDumpDecorations(javaScriptSourceFrame).then(addRegularEnabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', false);
}
async function addRegularEnabled() {
function addRegularEnabled() {
TestRunner.addResult('Adding regular enabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true)
).then(addConditionalEnabled);
waitAndDumpDecorations(javaScriptSourceFrame).then(addConditionalEnabled);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, '', true);
}
function addConditionalEnabled() {
TestRunner.addResult('Adding conditional enabled breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true)
).then(disableAll);
waitAndDumpDecorations(javaScriptSourceFrame).then(disableAll);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 2, 'true', true);
}
function disableAll() {
TestRunner.addResult('Disable breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(enabledAll);
waitAndDumpDecorations(javaScriptSourceFrame).then(enabledAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
}
function enabledAll() {
TestRunner.addResult('Enable breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true)
).then(removeAll);
waitAndDumpDecorations(javaScriptSourceFrame).then(removeAll);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, true);
}
function removeAll() {
TestRunner.addResult('Remove breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false)
).then(next);
waitAndDumpDecorations(javaScriptSourceFrame).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 2, false);
}
}
]);
......
......@@ -30,11 +30,10 @@
//# sourceURL=foo.js
`);
async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) {
const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame);
await action();
await waitPromise;
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
function waitAndDumpDecorations(sourceFrame) {
return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame)
.then(
() => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
}
Bindings.breakpointManager._storage._breakpoints = new Map();
......@@ -46,16 +45,14 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
).then(removeBreakpoint);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11)
).then(next);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11);
}
},
......@@ -66,16 +63,14 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true)
).then(removeBreakpoint);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13)
).then(next);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
}
},
......@@ -86,33 +81,29 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
).then(clickBySecondLocation);
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocation));
}
function clickBySecondLocation() {
TestRunner.addResult('Click by second breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next)
).then(clickByFirstLocation);
waitAndDumpDecorations(javaScriptSourceFrame).then(clickByFirstLocation);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next);
}
function clickByFirstLocation() {
TestRunner.addResult('Click by first breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next)
).then(clickBySecondLocationAgain);
waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocationAgain);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
}
function clickBySecondLocationAgain() {
TestRunner.addResult('Click by second breakpoint');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next)
).then(next);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next);
}
},
......@@ -123,26 +114,23 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint in line 4');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 12, false)
).then(toggleBreakpointInAnotherLine);
SourcesTestRunner.toggleBreakpoint(sourceFrame, 12, false);
waitAndDumpDecorations(javaScriptSourceFrame).then(toggleBreakpointInAnotherLine);
}
function toggleBreakpointInAnotherLine() {
TestRunner.addResult('Setting breakpoint in line 3');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false)
).then(removeBreakpoints);
waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoints);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false);
}
function removeBreakpoints() {
TestRunner.addResult('Click by first inline breakpoints');
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => {
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 12, 0, next);
}).then(next);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 12, 0, next);
}
},
......@@ -150,14 +138,13 @@
let javaScriptSourceFrame = await SourcesTestRunner.showScriptSourcePromise('foo.js');
TestRunner.addResult('Setting breakpoint');
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true)
);
await SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true)
await waitAndDumpDecorations(javaScriptSourceFrame);
TestRunner.addResult('Toggle breakpoint');
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28)
);
let decorationsPromise = waitAndDumpDecorations(javaScriptSourceFrame);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28);
await decorationsPromise;
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