| Index: third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html b/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html
|
| index ac861453edf8d1f7852e899560648a5e53ef6890..7e2397fa8e36ba4617cc3ce12d2681662eb76845 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/stylesheet-source-mapping.html
|
| @@ -2,79 +2,60 @@
|
| <head>
|
| <script src="inspector-test.js"></script>
|
| <script src="debugger-test.js"></script>
|
| -<script src="workspace-test.js"></script>
|
|
|
| <script>
|
| +function addStyleSheet()
|
| +{
|
| + var style = document.createElement("link");
|
| + style.setAttribute("rel", "stylesheet");
|
| + style.setAttribute("type", "text/css");
|
| + style.setAttribute("href", "http://127.0.0.1:8000/inspector/resources/example.css");
|
| + document.head.appendChild(style);
|
| +}
|
| +
|
| function test()
|
| {
|
| var contentReceived;
|
| var finalMappedLocation;
|
| - var target = InspectorTest.createWorkspaceWithTarget();
|
| + var target = InspectorTest.mainTarget;
|
| var cssModel = SDK.CSSModel.fromTarget(target);
|
| - Bindings.cssWorkspaceBinding = InspectorTest.testCSSWorkspaceBinding;
|
|
|
| - InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded);
|
| - const styleSheetURL = "http://localhost:8000/inspector/resources/example.css";
|
| - const sourceMapURL = "example.css.map";
|
| - const styleSheetId = "1";
|
| + const styleSheetURL = "http://127.0.0.1:8000/inspector/resources/example.css";
|
| + const sourceURL = "http://127.0.0.1:8000/inspector/resources/example.scss";
|
| + var styleSheetId;
|
|
|
| - InspectorTest.addSniffer(Bindings.CSSWorkspaceBinding.TargetInfo.prototype, "_updateLocations", locationsUpdated, true);
|
| - cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMapURL));
|
| + InspectorTest.waitForUISourceCode(cssUISourceCodeAdded, styleSheetURL);
|
| + InspectorTest.evaluateInPage("addStyleSheet()");
|
|
|
| function locationsUpdated()
|
| {
|
| var header = cssModel.styleSheetHeaderForId(styleSheetId);
|
| - var uiLocation = InspectorTest.testCSSWorkspaceBinding.rawLocationToUILocation(new SDK.CSSLocation(header, 2, 3));
|
| + var uiLocation = Bindings.cssWorkspaceBinding.rawLocationToUILocation(new SDK.CSSLocation(header, 2, 3));
|
| if (uiLocation.uiSourceCode.url().indexOf(".scss") === -1)
|
| return;
|
| finalMappedLocation = uiLocation.uiSourceCode.url() + ":" + uiLocation.lineNumber + ":" + uiLocation.columnNumber;
|
| join();
|
| }
|
|
|
| - function createMockStyleSheetHeader(url, sourceMapURL)
|
| - {
|
| - const frame = InspectorTest.resourceTreeModel.mainFrame;
|
| - return {
|
| - styleSheetId: styleSheetId,
|
| - frameId: frame.id,
|
| - sourceURL: url,
|
| - sourceMapURL: sourceMapURL,
|
| - origin: "regular",
|
| - title: "",
|
| - disabled: false
|
| - };
|
| - }
|
| -
|
| - function createMockStyleSheetResource(url, mimeType, content)
|
| - {
|
| - const documentURL = "http://localhost:8000/inspector/stylesheet-source-mapping.html";
|
| - const frame = InspectorTest.resourceTreeModel.mainFrame;
|
| - var resource = new SDK.Resource(target, null, url, documentURL, frame.id, frame.loaderId, Common.resourceTypes.Stylesheet, mimeType);
|
| - resource.requestContent = function()
|
| - {
|
| - return Promise.resolve(content);
|
| - }
|
| - return resource;
|
| - }
|
| -
|
| -
|
| function cssUISourceCodeAdded(uiSourceCode)
|
| {
|
| + styleSheetId = cssModel.styleSheetIdsForURL(styleSheetURL)[0];
|
| + InspectorTest.addSniffer(Bindings.CSSWorkspaceBinding.TargetInfo.prototype, "_updateLocations", locationsUpdated, true);
|
| InspectorTest.addResult("Added CSS uiSourceCode: " + uiSourceCode.url());
|
| - InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(scssUISourceCodeAdded);
|
| + InspectorTest.waitForUISourceCode(scssUISourceCodeAdded, sourceURL);
|
| }
|
|
|
| function rawLocationToUILocation(line, column)
|
| {
|
| var header = cssModel.styleSheetHeaderForId(styleSheetId);
|
| - return InspectorTest.testCSSWorkspaceBinding.rawLocationToUILocation(new SDK.CSSLocation(header, line, column));
|
| + return Bindings.cssWorkspaceBinding.rawLocationToUILocation(new SDK.CSSLocation(header, line, column));
|
| }
|
|
|
| function scssUISourceCodeAdded(uiSourceCode)
|
| {
|
| InspectorTest.addResult("Added SCSS uiSourceCode: " + uiSourceCode.url());
|
| - var cssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL(styleSheetURL);
|
| - var scssUISourceCode = InspectorTest.testWorkspace.uiSourceCodeForURL("http://localhost:8000/inspector/resources/example.scss");
|
| + var cssUISourceCode = Workspace.workspace.uiSourceCodeForURL(styleSheetURL);
|
| + var scssUISourceCode = Workspace.workspace.uiSourceCodeForURL(sourceURL);
|
|
|
| InspectorTest.checkUILocation(cssUISourceCode, 0, 3, rawLocationToUILocation(0, 3));
|
| InspectorTest.checkUILocation(scssUISourceCode, 1, 0, rawLocationToUILocation(1, 0));
|
|
|