Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: LayoutTests/inspector/jump-to-previous-editing-location.html

Issue 23474010: DevTools: "Jump between editing locations" experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline this patch Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/inspector/jump-to-previous-editing-location-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/workspace-test.js"></script>
5 <script src="../http/tests/inspector/debugger-test.js"></script>
6 <script src="resources/blink-fs.js"></script>
7 <script src="editor/editor-test.js"></script>
8 <script>
9 function test()
10 {
11 WebInspector.showPanel("sources");
12 var panel = WebInspector.panels.sources;
13
14 function rollback()
15 {
16 panel._historyManager.rollback();
17 }
18
19 function rollover()
20 {
21 panel._historyManager.rollover();
22 }
23
24 function clickAtEditor(editor, lineNumber, columnNumber)
25 {
26 editor.scrollToLine(lineNumber);
27 var coordinates = editor.cursorPositionToCoordinates(lineNumber, columnN umber);
28 eventSender.mouseMoveTo(coordinates.x, coordinates.y);
29 eventSender.mouseDown();
30 eventSender.mouseUp();
31 dumpSelection(editor, "Mouse click (" + lineNumber + ", " + columnNumber + ")");
32 }
33
34 function clickAndDump(editor, callback, lines, columns)
35 {
36 var iterationsAmount = lines.length;
37 function innerClickAndDump(iteration)
38 {
39 if (iteration === iterationsAmount) {
40 callback();
41 return;
42 }
43 clickAtEditor(editor, lines[iteration], columns[iteration]);
44 setTimeout(innerClickAndDump.bind(this, iteration + 1), 0);
45 }
46 innerClickAndDump(0);
47 }
48
49 function dumpLineColumn(line, column)
50 {
51 return "line: " + line + " column: " + column;
52 }
53
54 function dumpSelection(editor, label)
55 {
56 var selection = editor.selection();
57 var label = "<" + label + ">";
58 var fileName = "[" + editor._url.split("/").pop() + "]";
59 var selectionText = "";
60 if (selection.isEmpty())
61 selectionText = "line: " + selection.startLine + " column: " + selec tion.startColumn;
62 else
63 selectionText = "(NOT EMPTY): " + selection.toString();
64 InspectorTest.addResult(label + " " + selectionText + " " + fileName);
65 }
66
67 InspectorTest.runTestSuite([
68 function testSimpleMovements(next)
69 {
70 InspectorTest.showScriptSource("blink-fs.js", onContentLoaded);
71
72 function onContentLoaded()
73 {
74 var editor = panel.visibleView.textEditor;
75 dumpSelection(editor, "Initial position");
76 clickAtEditor(editor, 4, 7);
77
78 InspectorTest.typeIn("\nSome more text here");
79 dumpSelection(editor, "Typed in some text");
80
81 rollback();
82 dumpSelection(editor, "Rolled back");
83 InspectorTest.typeIn("\nSome more text here as well\n");
84 dumpSelection(editor, "Typed in some text");
85
86 rollover();
87 dumpSelection(editor, "Rolled over");
88 next();
89 }
90 },
91
92 function testSequentialJumps(next)
93 {
94 var editor = panel.visibleView.textEditor;
95 const jumpsToDo = 4;
96 clickAndDump(editor, jumpBack, [10, 11, 12, 13], [3, 4, 5, 6]);
97
98 function jumpBack()
99 {
100 for (var i = 0; i < jumpsToDo; ++i) {
101 rollback();
102 dumpSelection(editor, "Rolled back");
103 }
104 for (var i = 0; i < jumpsToDo; ++i) {
105 rollover();
106 dumpSelection(editor, "Rolled over");
107 }
108 next();
109 }
110 },
111
112 function testDeletePreviousJumpLocations(next)
113 {
114 var editor = panel.visibleView.textEditor;
115 editor.editRange(new WebInspector.TextRange(9, 0, 15, 0), "");
116 dumpSelection(editor, "Removed lines from 9 to 15");
117 rollback();
118 dumpSelection(editor, "Rolled back");
119 rollover();
120 dumpSelection(editor, "Rolled over");
121 next();
122 },
123
124 function testDeleteNextJumpLocations(next)
125 {
126 var editor = panel.visibleView.textEditor;
127 const jumpsToDo = 4;
128 clickAndDump(editor, step2, [10, 11, 12, 13], [3, 4, 5, 6]);
129
130 function step2()
131 {
132 for (var i = 0; i < jumpsToDo; ++i)
133 rollback();
134 dumpSelection(editor, "Rolled back 4 times");
135 editor.editRange(new WebInspector.TextRange(9, 0, 11, 0), "");
136 dumpSelection(editor, "Removed lines from 9 to 11");
137 rollover();
138 dumpSelection(editor, "Rolled over");
139 next();
140 }
141 },
142
143 function testCrossFileJump(next)
144 {
145 InspectorTest.showScriptSource("workspace-test.js", onContentLoaded) ;
146 function onContentLoaded()
147 {
148 var editor = panel.visibleView.textEditor;
149 dumpSelection(editor, "Opened workspace-test.js");
150 clickAndDump(editor, step2, [10, 11], [1, 1]);
151 }
152 function step2()
153 {
154 for (var i = 0; i < 4; ++i) {
155 rollback();
156 dumpSelection(panel.visibleView.textEditor, "Rolled back");
157 }
158 for (var i = 0; i < 4; ++i) {
159 rollover();
160 dumpSelection(panel.visibleView.textEditor, "Rolled over");
161 }
162 next();
163 }
164 },
165
166 function testCloseCrossFile(next)
167 {
168 var selectedTab = panel._editorContainer._tabbedPane.selectedTabId;
169 panel._editorContainer._tabbedPane.closeTab(selectedTab);
170 dumpSelection(panel.visibleView.textEditor, "Close active tab");
171 for (var i = 0; i < 1; ++i) {
172 rollback();
173 dumpSelection(panel.visibleView.textEditor, "Rolled back");
174 }
175 for (var i = 0; i < 3; ++i) {
176 rollover();
177 dumpSelection(panel.visibleView.textEditor, "Rolled over");
178 }
179 next();
180 },
181
182 function testHistoryDepth(next)
183 {
184 var lines = [];
185 var columns = [];
186 const jumpsAmount = WebInspector.EditingLocationHistoryManager.Histo ryDepth;
187 for(var i = 0; i < jumpsAmount; ++i) {
188 lines.push(i + 10);
189 columns.push(7);
190 }
191 var editor = panel.visibleView.textEditor;
192 clickAndDump(editor, step2, lines, columns);
193 function step2()
194 {
195 for (var i = 0; i < jumpsAmount; ++i) {
196 rollback();
197 dumpSelection(editor, "Rolled back");
198 }
199 next();
200 }
201 },
202
203 function testInFileSearch(next)
204 {
205 var searchableView = panel.searchableView();
206 searchableView.showSearchField();
207 dumpSelection(panel.visibleView.textEditor, "Before searching");
208 InspectorTest.typeIn("generate_");
209 for (var i = 0; i < 3; ++i)
210 searchableView.handleFindPreviousShortcut();
211 searchableView.closeSearch();
212 dumpSelection(panel.visibleView.textEditor, "After searching");
213 rollback();
214 dumpSelection(panel.visibleView.textEditor, "Rolled back");
215 rollover();
216 dumpSelection(panel.visibleView.textEditor, "Rolled over");
217 next();
218 },
219
220 function testShowAnchorLocation(next)
221 {
222 dumpSelection(panel.visibleView.textEditor, "Before switching to oth er panel");
223 InspectorTest.waitForScriptSource("workspace-test.js", onScriptSourc e);
224 function onScriptSource(uiSourceCode)
225 {
226 var linkifier = new WebInspector.Linkifier();
227 var anchorURI = uiSourceCode.uri();
228 var jumpAnchor = linkifier.linkifyLocation(anchorURI, 10, 1);
229 WebInspector.showPanel("timeline");
230 WebInspector.showAnchorLocation(jumpAnchor);
231 InspectorTest.addResult("Selection: " + panel.visibleView.textEd itor.selection().toString());
232 dumpSelection(panel.visibleView.textEditor, "Showed anchor in " + anchorURI.split("/").pop() + " with line 333 column 3");
233 rollback();
234 dumpSelection(panel.visibleView.textEditor, "Rolled back");
235 rollover();
236 dumpSelection(panel.visibleView.textEditor, "Rolled over");
237 next();
238 }
239 },
240
241 function testShowUISourceCode(next)
242 {
243 dumpSelection(panel.visibleView.textEditor, "Initial state");
244
245 InspectorTest.waitForScriptSource("blink-fs.js", onScriptSourceLoade d);
246 function onScriptSourceLoaded(uiSourceCode)
247 {
248 var jumps = [20, 10, 30];
249 for (var i = 0; i < jumps.length; ++i) {
250 panel.showUISourceCode(uiSourceCode, jumps[i]);
251 dumpSelection(panel.visibleView.textEditor, "jump to line " + jumps[i]);
252 }
253 panel.highlightPosition(40, 10);
254 dumpSelection(panel.visibleView.textEditor, "highlight line 40") ;
255 for (var i = 0; i < jumps.length + 1; ++i) {
256 rollback();
257 dumpSelection(panel.visibleView.textEditor, "rollback");
258 }
259 next();
260 }
261 }
262 ]);
263 };
264 </script>
265 </head>
266 <body onload="runTest()">
267 <p>Tests that jumping to previous location works as intended.</p>
268 </body>
269 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/jump-to-previous-editing-location-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698