| OLD | NEW |
| 1 var initialize_SourcesTest = function() { | 1 var initialize_SourcesTest = function() { |
| 2 | 2 |
| 3 InspectorTest.preloadPanel("sources"); | 3 InspectorTest.preloadPanel("sources"); |
| 4 | 4 |
| 5 function testSourceMapping(text1, text2, mapping, testToken) | 5 function testSourceMapping(text1, text2, mapping, testToken) |
| 6 { | 6 { |
| 7 var originalPosition = text1.indexOf(testToken); | 7 var originalPosition = text1.indexOf(testToken); |
| 8 InspectorTest.assertTrue(originalPosition !== -1); | 8 InspectorTest.assertTrue(originalPosition !== -1); |
| 9 var originalLocation = WebInspector.Formatter.positionToLocation(text1.compu
teLineEndings(), originalPosition); | 9 var originalLocation = Sources.Formatter.positionToLocation(text1.computeLin
eEndings(), originalPosition); |
| 10 var formattedLocation = mapping.originalToFormatted(originalLocation[0], ori
ginalLocation[1]); | 10 var formattedLocation = mapping.originalToFormatted(originalLocation[0], ori
ginalLocation[1]); |
| 11 var formattedPosition = WebInspector.Formatter.locationToPosition(text2.comp
uteLineEndings(), formattedLocation[0], formattedLocation[1]); | 11 var formattedPosition = Sources.Formatter.locationToPosition(text2.computeLi
neEndings(), formattedLocation[0], formattedLocation[1]); |
| 12 var expectedFormattedPosition = text2.indexOf(testToken); | 12 var expectedFormattedPosition = text2.indexOf(testToken); |
| 13 if (expectedFormattedPosition === formattedPosition) | 13 if (expectedFormattedPosition === formattedPosition) |
| 14 InspectorTest.addResult(String.sprintf("Correct mapping for <%s>", testT
oken)); | 14 InspectorTest.addResult(String.sprintf("Correct mapping for <%s>", testT
oken)); |
| 15 else | 15 else |
| 16 InspectorTest.addResult(String.sprintf("ERROR: Wrong mapping for <%s>",
testToken)); | 16 InspectorTest.addResult(String.sprintf("ERROR: Wrong mapping for <%s>",
testToken)); |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 InspectorTest.testPrettyPrint = function(mimeType, text, mappingQueries, next) | 19 InspectorTest.testPrettyPrint = function(mimeType, text, mappingQueries, next) |
| 20 { | 20 { |
| 21 new WebInspector.ScriptFormatter(mimeType, text, didFormatContent); | 21 new Sources.ScriptFormatter(mimeType, text, didFormatContent); |
| 22 | 22 |
| 23 function didFormatContent(formattedSource, mapping) | 23 function didFormatContent(formattedSource, mapping) |
| 24 { | 24 { |
| 25 InspectorTest.addResult("====== 8< ------"); | 25 InspectorTest.addResult("====== 8< ------"); |
| 26 InspectorTest.addResult(formattedSource); | 26 InspectorTest.addResult(formattedSource); |
| 27 InspectorTest.addResult("------ >8 ======"); | 27 InspectorTest.addResult("------ >8 ======"); |
| 28 while (mappingQueries && mappingQueries.length) | 28 while (mappingQueries && mappingQueries.length) |
| 29 testSourceMapping(text, formattedSource, mapping, mappingQueries.shi
ft()); | 29 testSourceMapping(text, formattedSource, mapping, mappingQueries.shi
ft()); |
| 30 | 30 |
| 31 next(); | 31 next(); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 InspectorTest.dumpSwatchPositions = function(sourceFrame, bookmarkType) | 35 InspectorTest.dumpSwatchPositions = function(sourceFrame, bookmarkType) |
| 36 { | 36 { |
| 37 var textEditor = sourceFrame.textEditor; | 37 var textEditor = sourceFrame.textEditor; |
| 38 var markers = textEditor.bookmarks(textEditor.fullRange(), bookmarkType); | 38 var markers = textEditor.bookmarks(textEditor.fullRange(), bookmarkType); |
| 39 for (var i = 0; i < markers.length; i++) { | 39 for (var i = 0; i < markers.length; i++) { |
| 40 var position = markers[i].position(); | 40 var position = markers[i].position(); |
| 41 var text = markers[i]._marker.widgetNode.firstChild.textContent; | 41 var text = markers[i]._marker.widgetNode.firstChild.textContent; |
| 42 InspectorTest.addResult("Line " + position.startLine + ", Column " + pos
ition.startColumn + ": " + text); | 42 InspectorTest.addResult("Line " + position.startLine + ", Column " + pos
ition.startColumn + ": " + text); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 }; | 46 }; |
| OLD | NEW |