| 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 <script src="../sources/debugger/resources/edit-me.js"></script> | 5 <script src="../sources/debugger/resources/edit-me.js"></script> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 function test() | 9 function test() |
| 10 { | 10 { |
| 11 var panel = WebInspector.panels.sources; | 11 var panel = UI.panels.sources; |
| 12 | 12 |
| 13 InspectorTest.showScriptSource("edit-me.js", step1); | 13 InspectorTest.showScriptSource("edit-me.js", step1); |
| 14 | 14 |
| 15 function step1(sourceFrame) | 15 function step1(sourceFrame) |
| 16 { | 16 { |
| 17 sourceFrame._textEditor.setSelection(findString(sourceFrame, "return")); | 17 sourceFrame._textEditor.setSelection(findString(sourceFrame, "return")); |
| 18 setTimeout(step2); | 18 setTimeout(step2); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function step2() | 21 function step2() |
| 22 { | 22 { |
| 23 panel.searchableView().showSearchField(); | 23 panel.searchableView().showSearchField(); |
| 24 InspectorTest.addResult("Search controller: '" + panel.searchableView().
_searchInputElement.value + "'"); | 24 InspectorTest.addResult("Search controller: '" + panel.searchableView().
_searchInputElement.value + "'"); |
| 25 var action = new WebInspector.AdvancedSearchView.ActionDelegate(); | 25 var action = new Sources.AdvancedSearchView.ActionDelegate(); |
| 26 action._showSearch(); | 26 action._showSearch(); |
| 27 var searchView = /** @type {!WebInspector.AdvancedSearchView} */ (self.r
untime.sharedInstance(WebInspector.AdvancedSearchView)); | 27 var searchView = /** @type {!Sources.AdvancedSearchView} */ (self.runtim
e.sharedInstance(Sources.AdvancedSearchView)); |
| 28 InspectorTest.addResult("Advanced search controller: '" + searchView._se
arch.value + "'"); | 28 InspectorTest.addResult("Advanced search controller: '" + searchView._se
arch.value + "'"); |
| 29 InspectorTest.completeTest(); | 29 InspectorTest.completeTest(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 function findString(sourceFrame, string) | 32 function findString(sourceFrame, string) |
| 33 { | 33 { |
| 34 for (var i = 0; i < sourceFrame._textEditor.linesCount; ++i) { | 34 for (var i = 0; i < sourceFrame._textEditor.linesCount; ++i) { |
| 35 var line = sourceFrame._textEditor.line(i); | 35 var line = sourceFrame._textEditor.line(i); |
| 36 var column = line.indexOf(string); | 36 var column = line.indexOf(string); |
| 37 if (column === -1) | 37 if (column === -1) |
| 38 continue; | 38 continue; |
| 39 return new WebInspector.TextRange(i, column, i, column + string.leng
th); | 39 return new Common.TextRange(i, column, i, column + string.length); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 </script> | 43 </script> |
| 44 | 44 |
| 45 </head> | 45 </head> |
| 46 | 46 |
| 47 <body onload="runTest()"> | 47 <body onload="runTest()"> |
| 48 <p>Tests synchronizing the search input field to the editor selection.</p> | 48 <p>Tests synchronizing the search input field to the editor selection.</p> |
| 49 | 49 |
| 50 </body> | 50 </body> |
| 51 </html> | 51 </html> |
| OLD | NEW |