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

Prepare breakpoint web tests for source map asyncification (3/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: Ia038efd4afc044e09d87bed4d6286d50cb88d5c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030167Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737296}
parent 5c61d15d
...@@ -9,22 +9,24 @@ ...@@ -9,22 +9,24 @@
await TestRunner.addScriptTag('resources/a.js'); await TestRunner.addScriptTag('resources/a.js');
// Pairs of line number plus breakpoint decoration counts.
// We expect line 5, 9 and 10 to have decoration each.
const expectedDecorations = [[5, 1], [9, 1], [10, 1]];
let originalSourceFrame = await SourcesTestRunner.showScriptSourcePromise('a.js'); let originalSourceFrame = await SourcesTestRunner.showScriptSourcePromise('a.js');
TestRunner.addResult('Set different breakpoints and dump them'); TestRunner.addResult('Set different breakpoints and dump them');
SourcesTestRunner.toggleBreakpoint(originalSourceFrame, 9, false); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(originalSourceFrame, expectedDecorations, async () => {
await SourcesTestRunner.toggleBreakpoint(originalSourceFrame, 9, false);
await SourcesTestRunner.createNewBreakpoint(originalSourceFrame, 10, 'a === 3', true); await SourcesTestRunner.createNewBreakpoint(originalSourceFrame, 10, 'a === 3', true);
await SourcesTestRunner.createNewBreakpoint(originalSourceFrame, 5, '', false); await SourcesTestRunner.createNewBreakpoint(originalSourceFrame, 5, '', false);
await SourcesTestRunner.waitDebuggerPluginBreakpoints(originalSourceFrame); });
await SourcesTestRunner.waitUntilDebuggerPluginLoaded(originalSourceFrame);
SourcesTestRunner.dumpDebuggerPluginBreakpoints(originalSourceFrame);
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 TestRunner.addScriptTag(TestRunner.url('resources/a.js')); await TestRunner.addScriptTag(TestRunner.url('resources/a.js'));
let sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('a.js'); let sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('a.js');
await SourcesTestRunner.waitDebuggerPluginBreakpoints(sourceFrameAfterReload); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
await SourcesTestRunner.waitUntilDebuggerPluginLoaded(sourceFrameAfterReload); sourceFrameAfterReload, expectedDecorations, () => {}, true);
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrameAfterReload);
// TODO(kozyatinskiy): as soon as we have script with the same url in different frames // TODO(kozyatinskiy): as soon as we have script with the same url in different frames
// everything looks compeltely broken, we should fix it. // everything looks compeltely broken, we should fix it.
...@@ -32,19 +34,23 @@ ...@@ -32,19 +34,23 @@
TestRunner.addIframe(TestRunner.url('resources/frame-with-script.html')); TestRunner.addIframe(TestRunner.url('resources/frame-with-script.html'));
TestRunner.addIframe(TestRunner.url('resources/frame-with-script.html')); TestRunner.addIframe(TestRunner.url('resources/frame-with-script.html'));
const uiSourceCodes = await waitForNScriptSources('a.js', 3); const uiSourceCodes = await waitForNScriptSources('a.js', 3);
// The disabled breakpoint at line 5 is currently not included in the iframes that are added.
const expectedDecorationsArray = [[[9, 1], [10, 1]], [[9, 1], [10, 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.waitUntilDebuggerPluginLoaded(sourceFrame); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrame); sourceFrame, expectedDecorationsArray[index++], () => {}, true);
} }
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 TestRunner.addScriptTag(TestRunner.url('resources/a.js')); await TestRunner.addScriptTag(TestRunner.url('resources/a.js'));
sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('a.js'); sourceFrameAfterReload = await SourcesTestRunner.showScriptSourcePromise('a.js');
await SourcesTestRunner.waitUntilDebuggerPluginLoaded(sourceFrameAfterReload); await SourcesTestRunner.runActionAndWaitForExactBreakpointDecorations(
SourcesTestRunner.dumpDebuggerPluginBreakpoints(sourceFrameAfterReload); sourceFrameAfterReload, expectedDecorations, () => {}, true);
TestRunner.completeTest(); TestRunner.completeTest();
......
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