| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="inspector-test.js"></script> | 3 <script src="inspector-test.js"></script> |
| 4 <script src="debugger-test.js"></script> | 4 <script src="debugger-test.js"></script> |
| 5 <script src="workspace-test.js"></script> | 5 <script src="workspace-test.js"></script> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 function test() | 8 function test() |
| 9 { | 9 { |
| 10 var contentReceived; | 10 var contentReceived; |
| 11 var finalMappedLocation; | 11 var finalMappedLocation; |
| 12 var target = InspectorTest.createWorkspaceWithTarget(); | 12 var target = InspectorTest.createWorkspaceWithTarget(); |
| 13 var cssModel = WebInspector.CSSModel.fromTarget(target); | 13 var cssModel = WebInspector.CSSModel.fromTarget(target); |
| 14 WebInspector.cssWorkspaceBinding = InspectorTest.testCSSWorkspaceBinding; | 14 WebInspector.cssWorkspaceBinding = InspectorTest.testCSSWorkspaceBinding; |
| 15 | 15 |
| 16 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded); | 16 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(cssUISourceCodeAdded); |
| 17 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css
"; | 17 const styleSheetURL = "http://localhost:8000/inspector/resources/example.css
"; |
| 18 const sourceMapURL = "example.css.map"; | 18 const sourceMapURL = "example.css.map"; |
| 19 const styleSheetId = "1"; | 19 const styleSheetId = "1"; |
| 20 | 20 |
| 21 InspectorTest.addSniffer(WebInspector.CSSWorkspaceBinding.TargetInfo.prototy
pe, "_updateLocations", locationsUpdated, true); | 21 InspectorTest.addSniffer(WebInspector.CSSWorkspaceBinding.TargetInfo.prototy
pe, "_updateLocations", locationsUpdated, true); |
| 22 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa
pURL)); | 22 cssModel._styleSheetAdded(createMockStyleSheetHeader(styleSheetURL, sourceMa
pURL)); |
| 23 | 23 |
| 24 function locationsUpdated() | 24 function locationsUpdated() |
| 25 { | 25 { |
| 26 var header = cssModel.styleSheetHeaderForId(styleSheetId); | 26 var header = cssModel.styleSheetHeaderForId(styleSheetId); |
| 27 var uiLocation = InspectorTest.testCSSWorkspaceBinding.rawLocationToUILo
cation(new WebInspector.CSSLocation(header, 2, 3)); | 27 var uiLocation = InspectorTest.testCSSWorkspaceBinding.rawLocationToUILo
cation(new WebInspector.CSSLocation(header, 2, 3)); |
| 28 var networkURL = InspectorTest.testNetworkMapping.networkURL(uiLocation.
uiSourceCode); | 28 if (uiLocation.uiSourceCode.url().indexOf(".scss") === -1) |
| 29 if (networkURL.indexOf(".scss") === -1) | |
| 30 return; | 29 return; |
| 31 finalMappedLocation = networkURL + ":" + uiLocation.lineNumber + ":" + u
iLocation.columnNumber; | 30 finalMappedLocation = uiLocation.uiSourceCode.url() + ":" + uiLocation.l
ineNumber + ":" + uiLocation.columnNumber; |
| 32 join(); | 31 join(); |
| 33 } | 32 } |
| 34 | 33 |
| 35 function createMockStyleSheetHeader(url, sourceMapURL) | 34 function createMockStyleSheetHeader(url, sourceMapURL) |
| 36 { | 35 { |
| 37 const frame = InspectorTest.resourceTreeModel.mainFrame; | 36 const frame = InspectorTest.resourceTreeModel.mainFrame; |
| 38 return { | 37 return { |
| 39 styleSheetId: styleSheetId, | 38 styleSheetId: styleSheetId, |
| 40 frameId: frame.id, | 39 frameId: frame.id, |
| 41 sourceURL: url, | 40 sourceURL: url, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 107 } |
| 109 | 108 |
| 110 </script> | 109 </script> |
| 111 | 110 |
| 112 </head> | 111 </head> |
| 113 | 112 |
| 114 <body onload="runTest()"> | 113 <body onload="runTest()"> |
| 115 <p>Tests SourceMap and StyleSheetMapping.</p> | 114 <p>Tests SourceMap and StyleSheetMapping.</p> |
| 116 </body> | 115 </body> |
| 117 </html> | 116 </html> |
| OLD | NEW |