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