Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / watch-expressions-panel-switch.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/elements-test.js"></script>
6 <script>
7 function testFunction()
8 {
9     var x = Math.sqrt(10);
10     return x;
11 }
12
13 var test = function()
14 {
15     InspectorTest.setQuiet(true);
16     InspectorTest.startDebuggerTest(step1);
17
18     var currentSourceFrame;
19     var watchExpressionsSection;
20
21     function step1()
22     {
23         // We need to initialize sources panel so that watch expressions section is created.
24         WebInspector.showPanel("sources");
25
26         var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
27         watchExpressionsPane.expand();
28
29         watchExpressionsSection = watchExpressionsPane.section;
30         watchExpressionsSection.watchExpressions = [];
31         watchExpressionsSection.watchExpressions.push("window.document");
32         watchExpressionsSection.watchExpressions.push("windowa.document");
33         watchExpressionsSection.update();
34
35         var testName = WebInspector.inspectedPageURL;
36         testName = testName.substring(testName.lastIndexOf('/') + 1);
37         InspectorTest.showScriptSource(testName, didShowScriptSource);
38     }
39
40     function didShowScriptSource(sourceFrame)
41     {
42         currentSourceFrame = sourceFrame;
43         InspectorTest.addResult("Script source was shown.");
44         InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
45         InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated);
46         // Switch to another panel to test how watch expressions evaluation together with panel switching.
47         WebInspector.showPanel("network");
48         InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
49     }
50
51     function didPaused(callFrames)
52     {
53     }
54
55     function watchExpressionsUpdated()
56     {
57         InspectorTest.addResult("Watch expressions updated.");
58         InspectorTest.dumpObjectPropertySection(watchExpressionsSection, {});
59
60         // Clear watch expressions after execution.
61         watchExpressionsSection.watchExpressions = [];
62         watchExpressionsSection.update();
63
64         InspectorTest.completeDebuggerTest();
65     }
66 }
67
68 </script>
69 </head>
70 <body onload="runTest()">
71 <p>Tests debugger does not fail when stopped while a panel other than scripts was opened. Both valid and invalid expressions are added to watch expressions.</p>
72 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a>
73 </body>
74 </html>