Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / watch-expressions-panel-switch.html
blobdcfd0082f2516a2f5e2cc37c119b4c8decbb4a33
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()
10 var x = Math.sqrt(10);
11 return x;
14 var test = function()
16 InspectorTest.setQuiet(true);
17 InspectorTest.startDebuggerTest(step1);
19 var currentSourceFrame;
20 var watchExpressionsPane;
21 //callback per each watchExpression called twice: in constructor and when actual evaluation result is available
22 var updateCount = 4;
24 function step1()
26 watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
27 watchExpressionsPane.expand();
28 watchExpressionsPane.addExpression("window.document");
29 watchExpressionsPane.addExpression("windowa.document");
31 var testName = InspectorTest.resourceTreeModel.inspectedPageURL();
32 testName = testName.substring(testName.lastIndexOf('/') + 1);
33 InspectorTest.showScriptSource(testName, didShowScriptSource);
36 function didShowScriptSource(sourceFrame)
38 currentSourceFrame = sourceFrame;
39 InspectorTest.addResult("Script source was shown.");
40 InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
41 InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_createWatchExpression", watchExpressionsUpdated, true);
42 // Switch to another panel to test how watch expressions evaluation together with panel switching.
43 WebInspector.NetworkPanel.show();
44 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
47 function didPause(callFrames)
51 function watchExpressionsUpdated()
53 updateCount--;
54 if (updateCount)
55 return;
57 InspectorTest.addResult("Watch expressions updated.");
59 for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++) {
60 var watch = watchExpressionsPane._watchExpressions[i];
61 var nameElement = watch._objectPresentationElement.querySelector(".name");
62 var valueElement = watch._objectPresentationElement.querySelector(".value");
63 InspectorTest.addResult("'" + nameElement.textContent + "'" + " => " + "'" + valueElement.textContent + "'");
66 watchExpressionsPane._deleteAllButtonClicked();
67 InspectorTest.completeDebuggerTest();
71 </script>
72 </head>
73 <body onload="runTest()">
74 <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>
75 <a href="https://bugs.webkit.org/show_bug.cgi?id=70718">Bug 70718</a>
76 </body>
77 </html>