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

Reland "Remove event races in two breakpoint decoration tests (2)"

This CL relands one of the tests in https://crrev.com/c/2000023.
This test is relanded as-is.

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}

Bug: chromium:1030216
Change-Id: I71873e000d0b67dfde630f3175968a87c4a49dcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2022662Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735342}
parent 2da1a1ed
......@@ -30,10 +30,11 @@
//# sourceURL=foo.js
`);
function waitAndDumpDecorations(sourceFrame) {
return SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame)
.then(
() => SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame));
async function runAsyncBreakpointActionAndDumpDecorations(sourceFrame, action) {
const waitPromise = SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrame);
await action();
await waitPromise;
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
}
Bindings.breakpointManager._storage._breakpoints = new Map();
......@@ -45,14 +46,16 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
).then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11)
).then(next);
}
},
......@@ -63,14 +66,16 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoint));
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 13, '', true)
).then(removeBreakpoint);
}
function removeBreakpoint() {
TestRunner.addResult('Toggle breakpoint');
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13);
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 13)
).then(next);
}
},
......@@ -81,29 +86,33 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint');
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
.then(() => waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocation));
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 11, '', true)
).then(clickBySecondLocation);
}
function clickBySecondLocation() {
TestRunner.addResult('Click by second breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(clickByFirstLocation);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next)
).then(clickByFirstLocation);
}
function clickByFirstLocation() {
TestRunner.addResult('Click by first breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(clickBySecondLocationAgain);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next)
).then(clickBySecondLocationAgain);
}
function clickBySecondLocationAgain() {
TestRunner.addResult('Click by second breakpoint');
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 1, next)
).then(next);
}
},
......@@ -114,23 +123,26 @@
function addBreakpoint(sourceFrame) {
javaScriptSourceFrame = sourceFrame;
TestRunner.addResult('Setting breakpoint in line 4');
SourcesTestRunner.toggleBreakpoint(sourceFrame, 12, false);
waitAndDumpDecorations(javaScriptSourceFrame).then(toggleBreakpointInAnotherLine);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 12, false)
).then(toggleBreakpointInAnotherLine);
}
function toggleBreakpointInAnotherLine() {
TestRunner.addResult('Setting breakpoint in line 3');
waitAndDumpDecorations(javaScriptSourceFrame).then(removeBreakpoints);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 11, false)
).then(removeBreakpoints);
}
function removeBreakpoints() {
TestRunner.addResult('Click by first inline breakpoints');
waitAndDumpDecorations(javaScriptSourceFrame).then(() => next());
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 12, 0, next);
runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () => {
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 11, 0, next);
SourcesTestRunner.clickDebuggerPluginBreakpoint(
javaScriptSourceFrame, 12, 0, next);
}).then(next);
}
},
......@@ -138,13 +150,14 @@
let javaScriptSourceFrame = await SourcesTestRunner.showScriptSourcePromise('foo.js');
TestRunner.addResult('Setting breakpoint');
await SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true)
await waitAndDumpDecorations(javaScriptSourceFrame);
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.createNewBreakpoint(javaScriptSourceFrame, 16, '', true)
);
TestRunner.addResult('Toggle breakpoint');
let decorationsPromise = waitAndDumpDecorations(javaScriptSourceFrame);
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28);
await decorationsPromise;
await runAsyncBreakpointActionAndDumpDecorations(javaScriptSourceFrame, () =>
SourcesTestRunner.toggleBreakpoint(javaScriptSourceFrame, 28)
);
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