Commit 304d1058 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

Make test more robust

The layout test
third_party/blink/web_tests/http/tests/devtools/sources/
debugger-breakpoints/
restore-locations-for-breakpoint-with-broken-source-map.js

Uses a source map URL and expects to intercept the source map load
to arrive at ResourceLoader.load, which it intercepts. This CL changes
the source map URL to a data URL, as an upcoming devtools front-end
CL will handle http and https scheme source maps differently and
bypass ResourceLoader.load.

TBR=caseq@chromium.org

Bug: chromium:1069378
Change-Id: I5c90d9f8ce8be98b774e5fd4795d37b05fa3fcad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429345Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810422}
parent 326c48fc
......@@ -7,10 +7,13 @@
await TestRunner.loadModule('sources_test_runner');
await TestRunner.showPanel('sources');
const brokenSourceMap = {"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA;IACE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC","sourcesContent":["function foo() {\n console.log(42);\n}\n"]};
const sourceMapURL = 'data:application/json;base64,' + btoa(JSON.stringify(brokenSourceMap)+'\n');
TestRunner.evaluateInPageAnonymously(`function foo() {
console.log(42);
}
//# sourceMappingURL=${TestRunner.url('../resources/a.js.map')}
//# sourceMappingURL=${sourceMapURL}
//# sourceURL=foo.js`);
let sourceFrame = await new Promise(resolve => SourcesTestRunner.showScriptSource('a.ts', resolve));
......@@ -25,7 +28,7 @@
let sourceMapRequested;
let sourceMapRequest = new Promise(resolve => sourceMapRequested = resolve);
Host.ResourceLoader.setLoadForTest(function(url, headers, callback){
if (url.endsWith('a.js.map')) {
if (url === sourceMapURL) {
stopRequest = () => callback(false, [], "", {message:"<error message>"});
sourceMapRequested();
return;
......@@ -36,7 +39,7 @@
await TestRunner.evaluateInPageAnonymously(`function foo() {
console.log(42);
}
//# sourceMappingURL=${TestRunner.url('../resources/a.js.map')}
//# sourceMappingURL=${sourceMapURL}
//# sourceURL=foo.js`);
await Promise.all([SourcesTestRunner.waitBreakpointSidebarPane(true), sourceMapRequest]);
......
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