| 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/console-test.js"></script> | 4 <script src="../http/tests/inspector/console-test.js"></script> |
| 5 <script src="../http/tests/inspector/workspace-test.js"></script> | 5 <script src="../http/tests/inspector/workspace-test.js"></script> |
| 6 <script src="../http/tests/inspector/debugger-test.js"></script> | 6 <script src="../http/tests/inspector/debugger-test.js"></script> |
| 7 <script src="resources/example-fileset-for-test.js"></script> | 7 <script src="resources/example-fileset-for-test.js"></script> |
| 8 <script src="editor/editor-test.js"></script> | 8 <script src="editor/editor-test.js"></script> |
| 9 <script> | 9 <script> |
| 10 function test() | 10 function test() |
| 11 { | 11 { |
| 12 var panel = WebInspector.panels.sources; | 12 var panel = UI.panels.sources; |
| 13 var sourcesView = panel._sourcesView; | 13 var sourcesView = panel._sourcesView; |
| 14 var historyManager = sourcesView._historyManager; | 14 var historyManager = sourcesView._historyManager; |
| 15 var editorContainer = sourcesView._editorContainer; | 15 var editorContainer = sourcesView._editorContainer; |
| 16 | 16 |
| 17 function rollback() | 17 function rollback() |
| 18 { | 18 { |
| 19 historyManager.rollback(); | 19 historyManager.rollback(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function rollover() | 22 function rollover() |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 eventSender.mouseUp(); | 46 eventSender.mouseUp(); |
| 47 dumpSelection("Mouse click (" + lineNumber + ", " + columnNumber + ")"); | 47 dumpSelection("Mouse click (" + lineNumber + ", " + columnNumber + ")"); |
| 48 } | 48 } |
| 49 | 49 |
| 50 function clickAndDump(editor, lines, columns) | 50 function clickAndDump(editor, lines, columns) |
| 51 { | 51 { |
| 52 for (var i = 0; i < lines.length; ++i) { | 52 for (var i = 0; i < lines.length; ++i) { |
| 53 var lineNumber = lines[i]; | 53 var lineNumber = lines[i]; |
| 54 var columnNumber = columns[i]; | 54 var columnNumber = columns[i]; |
| 55 var originSelection = editor.selection(); | 55 var originSelection = editor.selection(); |
| 56 editor.setSelection(WebInspector.TextRange.createFromLocation(lineNu
mber, columnNumber)); | 56 editor.setSelection(Common.TextRange.createFromLocation(lineNumber,
columnNumber)); |
| 57 editor._reportJump(originSelection, editor.selection()); | 57 editor._reportJump(originSelection, editor.selection()); |
| 58 dumpSelection("Mouse click (" + lineNumber + ", " + columnNumber + "
)"); | 58 dumpSelection("Mouse click (" + lineNumber + ", " + columnNumber + "
)"); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 InspectorTest.runTestSuite([ | 62 InspectorTest.runTestSuite([ |
| 63 function testSimpleMovements(next) | 63 function testSimpleMovements(next) |
| 64 { | 64 { |
| 65 InspectorTest.showScriptSource("example-fileset-for-test.js", onCont
entLoaded); | 65 InspectorTest.showScriptSource("example-fileset-for-test.js", onCont
entLoaded); |
| 66 | 66 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 for (var i = 0; i < jumpsToDo; ++i) { | 107 for (var i = 0; i < jumpsToDo; ++i) { |
| 108 rollover(); | 108 rollover(); |
| 109 dumpSelection("Rolled over"); | 109 dumpSelection("Rolled over"); |
| 110 } | 110 } |
| 111 next(); | 111 next(); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 function testDeletePreviousJumpLocations(next) | 114 function testDeletePreviousJumpLocations(next) |
| 115 { | 115 { |
| 116 var editor = panel.visibleView.textEditor; | 116 var editor = panel.visibleView.textEditor; |
| 117 editor.editRange(new WebInspector.TextRange(9, 0, 15, 0), ""); | 117 editor.editRange(new Common.TextRange(9, 0, 15, 0), ""); |
| 118 dumpSelection("Removed lines from 9 to 15"); | 118 dumpSelection("Removed lines from 9 to 15"); |
| 119 rollback(); | 119 rollback(); |
| 120 dumpSelection("Rolled back"); | 120 dumpSelection("Rolled back"); |
| 121 rollover(); | 121 rollover(); |
| 122 dumpSelection("Rolled over"); | 122 dumpSelection("Rolled over"); |
| 123 next(); | 123 next(); |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 function testDeleteNextJumpLocations(next) | 126 function testDeleteNextJumpLocations(next) |
| 127 { | 127 { |
| 128 var editor = panel.visibleView.textEditor; | 128 var editor = panel.visibleView.textEditor; |
| 129 const jumpsToDo = 4; | 129 const jumpsToDo = 4; |
| 130 clickAndDump(editor, [10, 11, 12, 13], [3, 4, 5, 6]); | 130 clickAndDump(editor, [10, 11, 12, 13], [3, 4, 5, 6]); |
| 131 | 131 |
| 132 for (var i = 0; i < jumpsToDo; ++i) | 132 for (var i = 0; i < jumpsToDo; ++i) |
| 133 rollback(); | 133 rollback(); |
| 134 dumpSelection("Rolled back 4 times"); | 134 dumpSelection("Rolled back 4 times"); |
| 135 editor.editRange(new WebInspector.TextRange(9, 0, 11, 0), ""); | 135 editor.editRange(new Common.TextRange(9, 0, 11, 0), ""); |
| 136 dumpSelection("Removed lines from 9 to 11"); | 136 dumpSelection("Removed lines from 9 to 11"); |
| 137 rollover(); | 137 rollover(); |
| 138 dumpSelection("Rolled over"); | 138 dumpSelection("Rolled over"); |
| 139 next(); | 139 next(); |
| 140 }, | 140 }, |
| 141 | 141 |
| 142 function testCrossFileJump(next) | 142 function testCrossFileJump(next) |
| 143 { | 143 { |
| 144 InspectorTest.showScriptSource("workspace-test.js", onContentLoaded)
; | 144 InspectorTest.showScriptSource("workspace-test.js", onContentLoaded)
; |
| 145 function onContentLoaded() | 145 function onContentLoaded() |
| (...skipping 26 matching lines...) Expand all Loading... |
| 172 rollover(); | 172 rollover(); |
| 173 dumpSelection("Rolled over"); | 173 dumpSelection("Rolled over"); |
| 174 } | 174 } |
| 175 next(); | 175 next(); |
| 176 }, | 176 }, |
| 177 | 177 |
| 178 function testHistoryDepth(next) | 178 function testHistoryDepth(next) |
| 179 { | 179 { |
| 180 var lines = []; | 180 var lines = []; |
| 181 var columns = []; | 181 var columns = []; |
| 182 const jumpsAmount = WebInspector.EditingLocationHistoryManager.Histo
ryDepth; | 182 const jumpsAmount = Sources.EditingLocationHistoryManager.HistoryDep
th; |
| 183 for(var i = 0; i < jumpsAmount; ++i) { | 183 for(var i = 0; i < jumpsAmount; ++i) { |
| 184 lines.push(i + 10); | 184 lines.push(i + 10); |
| 185 columns.push(7); | 185 columns.push(7); |
| 186 } | 186 } |
| 187 var editor = panel.visibleView.textEditor; | 187 var editor = panel.visibleView.textEditor; |
| 188 clickAndDump(editor, lines, columns); | 188 clickAndDump(editor, lines, columns); |
| 189 for (var i = 0; i < jumpsAmount; ++i) { | 189 for (var i = 0; i < jumpsAmount; ++i) { |
| 190 rollback(); | 190 rollback(); |
| 191 dumpSelection("Rolled back"); | 191 dumpSelection("Rolled back"); |
| 192 } | 192 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 213 dumpSelection("Rolled over"); | 213 dumpSelection("Rolled over"); |
| 214 next(); | 214 next(); |
| 215 }, | 215 }, |
| 216 | 216 |
| 217 function testShowAnchorLocation(next) | 217 function testShowAnchorLocation(next) |
| 218 { | 218 { |
| 219 dumpSelection("Before switching to other panel"); | 219 dumpSelection("Before switching to other panel"); |
| 220 InspectorTest.waitForScriptSource("workspace-test.js", onScriptSourc
e); | 220 InspectorTest.waitForScriptSource("workspace-test.js", onScriptSourc
e); |
| 221 function onScriptSource(uiSourceCode) | 221 function onScriptSource(uiSourceCode) |
| 222 { | 222 { |
| 223 var linkifier = new WebInspector.Linkifier(); | 223 var linkifier = new Components.Linkifier(); |
| 224 var anchorURI = uiSourceCode.url(); | 224 var anchorURI = uiSourceCode.url(); |
| 225 var anchor = linkifier.linkifyScriptLocation(WebInspector.target
Manager.mainTarget(), null, anchorURI, 10, 1); | 225 var anchor = linkifier.linkifyScriptLocation(SDK.targetManager.m
ainTarget(), null, anchorURI, 10, 1); |
| 226 WebInspector.Revealer.revealPromise(anchor[WebInspector.Linkifie
r._uiLocationSymbol]).then(function() { | 226 Common.Revealer.revealPromise(anchor[Components.Linkifier._uiLoc
ationSymbol]).then(function() { |
| 227 InspectorTest.addResult("Selection: " + panel.visibleView.te
xtEditor.selection().toString()); | 227 InspectorTest.addResult("Selection: " + panel.visibleView.te
xtEditor.selection().toString()); |
| 228 dumpSelection("Showed anchor in " + anchorURI.split("/").pop
() + " with line 333 column 3"); | 228 dumpSelection("Showed anchor in " + anchorURI.split("/").pop
() + " with line 333 column 3"); |
| 229 rollback(); | 229 rollback(); |
| 230 dumpSelection("Rolled back"); | 230 dumpSelection("Rolled back"); |
| 231 rollover(); | 231 rollover(); |
| 232 dumpSelection("Rolled over"); | 232 dumpSelection("Rolled over"); |
| 233 next(); | 233 next(); |
| 234 }); | 234 }); |
| 235 } | 235 } |
| 236 }, | 236 }, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 ]); | 259 ]); |
| 260 }; | 260 }; |
| 261 </script> | 261 </script> |
| 262 </head> | 262 </head> |
| 263 <body onload="runTest()"> | 263 <body onload="runTest()"> |
| 264 <p>Tests that jumping to previous location works as intended.</p> | 264 <p>Tests that jumping to previous location works as intended.</p> |
| 265 </body> | 265 </body> |
| 266 </html> | 266 </html> |
| OLD | NEW |