Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / live-edit-no-reveal.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="../../../http/tests/inspector/live-edit-test.js"></script>
6 <script src="resources/edit-me-when-paused-no-reveal.js"></script>
7
8 <script>
9
10 function test()
11 {
12     var panel = WebInspector.inspectorView.showPanel("sources");
13     var sourceFrame;
14
15     InspectorTest.runDebuggerTestSuite([
16         function testLiveEditWhenPausedDoesNotCauseCursorMove(next)
17         {
18             InspectorTest.showScriptSource("edit-me-when-paused-no-reveal.js", didShowScriptSource);
19
20             function didShowScriptSource(sourceFrame)
21             {
22                 InspectorTest.waitUntilPaused(paused);
23                 InspectorTest.evaluateInPage("f1()", didEvaluateInPage);
24             }
25
26             function paused(callFrames)
27             {
28                 sourceFrame = panel.visibleView;
29                 InspectorTest.addSniffer(WebInspector.debuggerModel, "_didEditScriptSource", didEditScriptSource);
30                 InspectorTest.replaceInSource(sourceFrame, "return 1;", "return 2;\n\n\n\n");
31                 InspectorTest.addResult("Moving cursor to (0, 0).");
32                 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(0, 0));
33                 InspectorTest.addResult("Committing live edit.");
34                 InspectorTest.commitSource(sourceFrame);
35             }
36
37             function didEditScriptSource()
38             {
39                 InspectorTest.resumeExecution();
40             }
41
42             function didEvaluateInPage(result)
43             {
44                 var selection = sourceFrame.textEditor.selection();
45                 InspectorTest.addResult("Cursor position is: (" + selection.startLine + ", " +selection.startColumn + ").");
46                 InspectorTest.assertEquals(sourceFrame, panel.visibleView, "Another file editor is open.");
47                 next();
48             }
49         }
50     ]);
51 };
52
53 </script>
54
55 </head>
56
57 <body onload="runTest()">
58 <p>Tests live edit feature.</p>
59
60 </body>
61 </html>