| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 5 <link rel="stylesheet" href="resources/style-formatter-obfuscated.css"> | 5 <link rel="stylesheet" href="resources/style-formatter-obfuscated.css"> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 async function test() | 8 async function test() |
| 9 { | 9 { |
| 10 var uiSourceCode = await InspectorTest.waitForUISourceCode("style-formatter-
obfuscated.css"); | 10 var uiSourceCode = await InspectorTest.waitForUISourceCode("style-formatter-
obfuscated.css"); |
| 11 var formatData = await Sources.sourceFormatter.format(uiSourceCode); | 11 var formatData = await Sources.sourceFormatter.format(uiSourceCode); |
| 12 var targetContent = await formatData.formattedSourceCode.requestContent(); | 12 var targetContent = await formatData.formattedSourceCode.requestContent(); |
| 13 | 13 |
| 14 InspectorTest.addResult(`Formatted:\n${targetContent}`); | 14 InspectorTest.addResult(`Formatted:\n${targetContent}`); |
| 15 | 15 |
| 16 var originalContent = await uiSourceCode.requestContent(); | 16 var originalContent = await uiSourceCode.requestContent(); |
| 17 var styleHeader = Bindings.NetworkProject.styleHeaderForUISourceCode(uiSourc
eCode); | 17 var styleHeader = Bindings.cssWorkspaceBinding.uiLocationToRawLocations(uiSo
urceCode.uiLocation(0, 0))[0].header(); |
| 18 var text = new TextUtils.Text(originalContent); | 18 var text = new TextUtils.Text(originalContent); |
| 19 var liveLocationsPool = new Bindings.LiveLocationPool(); | 19 var liveLocationsPool = new Bindings.LiveLocationPool(); |
| 20 var locationUpdateCount = 0; | 20 var locationUpdateCount = 0; |
| 21 var rawLocations = []; | 21 var rawLocations = []; |
| 22 var liveLocations = []; | 22 var liveLocations = []; |
| 23 for (var offset = originalContent.indexOf("{"); offset >= 0; offset = origin
alContent.indexOf("{", offset + 1)) { | 23 for (var offset = originalContent.indexOf("{"); offset >= 0; offset = origin
alContent.indexOf("{", offset + 1)) { |
| 24 var position = text.positionFromOffset(offset); | 24 var position = text.positionFromOffset(offset); |
| 25 var rawLocation = new SDK.CSSLocation(styleHeader, position.lineNumber, po
sition.columnNumber); | 25 var rawLocation = new SDK.CSSLocation(styleHeader, position.lineNumber, po
sition.columnNumber); |
| 26 rawLocations.push(rawLocation); | 26 rawLocations.push(rawLocation); |
| 27 liveLocations.push(Bindings.cssWorkspaceBinding.createLiveLocation(rawLoca
tion, () => { locationUpdateCount++; }, liveLocationsPool)); | 27 liveLocations.push(Bindings.cssWorkspaceBinding.createLiveLocation(rawLoca
tion, () => { locationUpdateCount++; }, liveLocationsPool)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 </script> | 55 </script> |
| 56 | 56 |
| 57 </head> | 57 </head> |
| 58 <body onload="runTest()"> | 58 <body onload="runTest()"> |
| 59 <p>Tests how SourceFormatter handles CSS sources</p> | 59 <p>Tests how SourceFormatter handles CSS sources</p> |
| 60 </body> | 60 </body> |
| 61 </html> | 61 </html> |
| OLD | NEW |