Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / debugger-change-variable.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>
6
7 function slave(x)
8 {
9     var y = 20;
10     debugger;
11 }
12
13 function testFunction()
14 {
15     var localObject = { a: 310 };
16     slave(4000);
17 }
18
19 var test = function()
20 {
21     InspectorTest.startDebuggerTest(step1);
22
23     function step1()
24     {
25         InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
26     }
27
28     function step2(callFrames)
29     {
30         var pane = WebInspector.panels.sources.sidebarPanes.callstack;
31         pane._placardSelected(pane.placards[1]);
32         InspectorTest.runAfterPendingDispatches(step3);
33     }
34
35     function step3()
36     {
37         InspectorTest.evaluateInConsole("localObject.a", step4);
38     }
39
40     function step4(result)
41     {
42         InspectorTest.addResult("Evaluated script on the calling frame: " + result);
43
44         var pane = WebInspector.panels.sources.sidebarPanes.scopechain;
45         var localsSection = pane._sections[0];
46         localsSection.object.setPropertyValue("localObject", "({ a: -290})", step5);
47     }
48
49     function step5(error)
50     {
51         if (error)
52             InspectorTest.addResult("Set property value error: " + error);
53
54         InspectorTest.evaluateInConsole("localObject.a", step6);
55     }
56
57     function step6(result)
58     {
59         InspectorTest.addResult("Evaluated script on the calling frame (after value modification): " + result);
60         InspectorTest.completeDebuggerTest();
61     }
62 }
63
64 </script>
65 </head>
66
67 <body onload="runTest()">
68 <p>
69 Tests that modifying local variables works fine.
70 </p>
71
72 </body>
73 </html>