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

Side by Side Diff: LayoutTests/inspector/editor/text-editor-search-switch-editor.html

Issue 669043002: DevTools: Fix the way search works when switching between editor tabs. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Comments addressed Created 6 years, 2 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../debugger/resources/edit-me.js"></script>
6 <script src="resources/search-me.js"></script>
7 <script>
8
9 function test()
10 {
11 var textEditor;
12 var searchString = "FINDME";
13 var searchableView = WebInspector.panels.sources.searchableView();
14 var sourceFrame;
15 InspectorTest.showScriptSource("search-me.js", didShowScriptSource);
16
17 function didShowScriptSource(shownSourceFrame)
18 {
19 sourceFrame = shownSourceFrame;
20 textEditor = sourceFrame._textEditor;
21 // We are probably still updating the editor in current callstack, so po stponing the test execution.
22 setImmediate(textEditorUpdated);
23 }
24
25 function textEditorUpdated(sourceFrame)
26 {
27 searchableView.showSearchField();
28
29 InspectorTest.addResult("Performing search...");
30 searchableView._searchInputElement.value = searchString;
31 searchableView._performSearch(true, true);
32 InspectorTest.addResult("Recording editor viewport after searching...");
33
34 var originalViewport = { from: textEditor.firstVisibleLine(), to: textEd itor.lastVisibleLine() };
35 var originalSelectionRange = textEditor.selection();
36
37 InspectorTest.showScriptSource("edit-me.js", didShowAnotherSource);
38
39 function didShowAnotherSource(anotherSourceFrame)
40 {
41 InspectorTest.showScriptSource("search-me.js", didShowScriptSourceAg ain);
42 }
43
44 function didShowScriptSourceAgain(sourceFrame)
45 {
46 InspectorTest.addResult("Recording editor viewport after switching t abs...");
47 var newViewport = { from: textEditor.firstVisibleLine(), to: textEdi tor.lastVisibleLine() };
48 var newSelectionRange = textEditor.selection();
49 InspectorTest.addResult("Comparing viewports...");
50 if (originalViewport.from === newViewport.from && originalViewport.t o === newViewport.to)
51 InspectorTest.addResult(" viewports match, SUCCESS");
52 else
53 InspectorTest.addResult(" viewports do not match, FAIL");
54 InspectorTest.addResult("Comparing selection ranges...");
55 InspectorTest.addResult(" original selection range: " + originalSel ectionRange.toString());
56 InspectorTest.addResult(" current selection range: " + newSelection Range.toString());
57 InspectorTest.completeTest();
58 }
59 }
60 };
61 </script>
62 </head>
63 <body onload="runTest()">
64 <p>Tests that switching editor tabs after searching does not affect editor selec tion and viewport.</p>
65 </body>
66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698