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

Prepare breakpoint web tests for source map asyncification (1/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.

R=sigurds@chromium.org

Bug: chromium:1032016
Change-Id: Id42223f38ec2a3ea68605948f91b45939a0618eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2027335
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736846}
parent 0143532e
...@@ -7,29 +7,45 @@ ...@@ -7,29 +7,45 @@
await TestRunner.loadModule('sources_test_runner'); await TestRunner.loadModule('sources_test_runner');
await TestRunner.showPanel('sources'); await TestRunner.showPanel('sources');
// Pairs of line number plus breakpoint decoration counts.
// We expected line 1-3 to have one decoration each.
const expectedDecorations = [[1, 1], [2, 1], [3, 1]];
await addWorker('resources/worker.js'); await addWorker('resources/worker.js');
let workerSourceFrame = await SourcesTestRunner.showScriptSourcePromise('worker.js'); let workerSourceFrame = await SourcesTestRunner.showScriptSourcePromise('worker.js');
TestRunner.addResult('Set different breakpoints and dump them'); TestRunner.addResult('Set different breakpoints and dump them');
SourcesTestRunner.toggleBreakpoint(workerSourceFrame, 1, false); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
await SourcesTestRunner.createNewBreakpoint(workerSourceFrame, 2, 'a === 3', true); workerSourceFrame, expectedDecorations, async () => {
await SourcesTestRunner.createNewBreakpoint(workerSourceFrame, 3, '', false); await SourcesTestRunner.toggleBreakpoint(workerSourceFrame, 1, false);
await SourcesTestRunner.waitDebuggerPluginBreakpoints(workerSourceFrame); await SourcesTestRunner.createNewBreakpoint(workerSourceFrame, 2, 'a === 3', true);
SourcesTestRunner.dumpDebuggerPluginBreakpoints(workerSourceFrame); await SourcesTestRunner.createNewBreakpoint(workerSourceFrame, 3, '', false);
});
TestRunner.addResult('Reload page and add script again and dump breakpoints'); TestRunner.addResult('Reload page and add script again and dump breakpoints');
await TestRunner.reloadPagePromise(); await TestRunner.reloadPagePromise();
await addWorker(TestRunner.url('resources/worker.js')); await addWorker(TestRunner.url('resources/worker.js'));
let sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('worker.js'); let sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('worker.js');
await SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrameAfterReload); await SourcesTestRunner.waitForExactBreakpointDecorations(
sourceFrameAfterReload, expectedDecorations, true);
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrameAfterReload); SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrameAfterReload);
TestRunner.addResult('Added two more workers'); TestRunner.addResult('Added two more workers');
await addWorker(TestRunner.url('resources/worker.js')); await addWorker(TestRunner.url('resources/worker.js'));
await addWorker(TestRunner.url('resources/worker.js')); await addWorker(TestRunner.url('resources/worker.js'));
const uiSourceCodes = await waitForNScriptSources('worker.js', 3); const uiSourceCodes = await waitForNScriptSources('worker.js', 3);
// The disabled breakpoint on line 3 is not included in the newly added workers.
const expectedDecorationsArray = [
[[1, 1], [2, 1]],
[[1, 1], [2, 1]],
expectedDecorations
];
let index = 0;
for (const uiSourceCode of uiSourceCodes) { for (const uiSourceCode of uiSourceCodes) {
TestRunner.addResult('Show uiSourceCode and dump breakpoints'); TestRunner.addResult('Show uiSourceCode and dump breakpoints');
const sourceFrame = await SourcesTestRunner.showUISourceCodePromise(uiSourceCode); const sourceFrame = await SourcesTestRunner.showUISourceCodePromise(uiSourceCode);
await SourcesTestRunner.waitForExactBreakpointDecorations(
sourceFrame, expectedDecorationsArray[index++], true);
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame); SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame);
} }
......
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