Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / editor / text-editor-selection-to-search.html
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="../sources/debugger/resources/edit-me.js"></script>
6
7 <script>
8
9 function test()
10 {
11     var panel = WebInspector.panels.sources;
12
13     InspectorTest.showScriptSource("edit-me.js", step1);
14
15     function step1(sourceFrame)
16     {
17         sourceFrame._textEditor.setSelection(findString(sourceFrame, "return"));
18         setTimeout(step2);
19     }
20
21     function step2()
22     {
23         panel.searchableView().showSearchField();
24         InspectorTest.addResult("Search controller: '" + panel.searchableView()._searchInputElement.value + "'");
25         new WebInspector.AdvancedSearchView.ToggleDrawerViewActionDelegate().handleAction();
26         Promise.resolve().then(function() {
27             InspectorTest.addResult("Advanced search controller: '" + WebInspector.AdvancedSearchView._instance._search.value + "'");
28             InspectorTest.completeTest();
29         });
30     }
31
32     function findString(sourceFrame, string)
33     {
34         for (var i = 0; i < sourceFrame._textEditor.linesCount; ++i) {
35             var line = sourceFrame._textEditor.line(i);
36             var column = line.indexOf(string);
37             if (column === -1)
38                 continue;
39             return new WebInspector.TextRange(i, column, i, column + string.length);
40         }
41     }
42 }
43 </script>
44
45 </head>
46
47 <body onload="runTest()">
48 <p>Tests synchronizing the search input field to the editor selection.</p>
49
50 </body>
51 </html>