blob: cda83da17fd266d1fc0813eb4c71125f00da7b27 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script>
function testFunction()
{
var x = Math.sqrt(10);
return x;
}
var test = function()
{
InspectorTest.setQuiet(true);
InspectorTest.startDebuggerTest(step1);
var currentSourceFrame;
var watchExpressionsSection;
function step1()
{
// We need to initialize scripts panel so that watch expressions section is created.
WebInspector.showPanel("scripts");
var watchExpressionsPane = WebInspector.panels.scripts.sidebarPanes.watchExpressions;
watchExpressionsPane.expand();
watchExpressionsSection = watchExpressionsPane.section;
watchExpressionsSection.watchExpressions = [];
watchExpressionsSection.watchExpressions.push("Object(true)");
watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; })");
watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; }).bind({}, 2)");
watchExpressionsSection.update();
var testName = WebInspector.inspectedPageURL;
testName = testName.substring(testName.lastIndexOf('/') + 1);
InspectorTest.showScriptSource(testName, didShowScriptSource);
}
function didShowScriptSource(sourceFrame)
{
currentSourceFrame = sourceFrame;
InspectorTest.addResult("Script source was shown.");
InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated);
InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
}
function didPaused(callFrames)
{
}
function watchExpressionsUpdated()
{
InspectorTest.addResult("Watch expressions updated.");
var treeNodes = watchExpressionsSection.propertiesTreeOutline.children;
for (var i = 0; i < treeNodes.length; i++) {
treeNodes[i].expand();
}
InspectorTest.runAfterPendingDispatches(nodesExpanded);
}
function nodesExpanded()
{
InspectorTest.addResult("Nodes are expanded.");
InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection);
// Clear watch expressions after execution.
watchExpressionsSection.watchExpressions = [];
watchExpressionsSection.update();
InspectorTest.completeDebuggerTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests how debugger presents special properties of closures, bound functions and object wrappers.</p>
</body>
</html>