| Index: LayoutTests/dart/inspector/scope-variables.html
|
| diff --git a/LayoutTests/dart/inspector/scope-variables.html b/LayoutTests/dart/inspector/scope-variables.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..44b6a7c4e63e47f3767502562a3f65be2b62aa41
|
| --- /dev/null
|
| +++ b/LayoutTests/dart/inspector/scope-variables.html
|
| @@ -0,0 +1,125 @@
|
| +<html>
|
| +<script src="../../http/tests/inspector/inspector-test.js"></script>
|
| +<script src="../../http/tests/inspector/debugger-test.js"></script>
|
| +
|
| +<script type="application/dart" src="scope-variables.dart"></script>
|
| +
|
| +<script>
|
| +
|
| +function postMessageToDart()
|
| +{
|
| + window.postMessage('fromJS', '*');
|
| +}
|
| +
|
| +function testFunction() {
|
| + postMessageToDart();
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + var panel = WebInspector.inspectorView.showPanel("sources");
|
| + InspectorTest.runDebuggerTestSuite([
|
| + function testScopeChain(next)
|
| + {
|
| + InspectorTest.showScriptSource('scope-variables.dart', didShowScriptSource);
|
| +
|
| + function didShowScriptSource(sourceFrame)
|
| + {
|
| + setBreakpointAndWaitUntilPaused(sourceFrame, 23, didPauseInDart);
|
| + InspectorTest.runTestFunction();
|
| + }
|
| +
|
| + function didPauseInDart(callFrames)
|
| + {
|
| + InspectorTest.captureStackTrace(callFrames);
|
| + expandScopeChainSections();
|
| + InspectorTest.runAfterPendingDispatches(didExpandScopeChainSections);
|
| + }
|
| +
|
| + function didExpandScopeChainSections()
|
| + {
|
| + dumpScopeChainContents();
|
| + var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
|
| + for (var s = 0; s < sections.length; s++) {
|
| + var section = sections[s];
|
| +
|
| + var properties = section.propertiesForTest;
|
| + for (var i = 0; i < properties.length; ++i) {
|
| + if (properties[i].name == 'a1') {
|
| + var objectId = properties[i].value._objectId;
|
| + RuntimeAgent.callFunctionOn(objectId, "(){return this.toString();}", [], undefined, didCallFunctionOn);
|
| + RuntimeAgent.callFunctionOn(objectId, "function(){return this.toString();}", [], undefined, didCallInvalidFunctionOn);
|
| + break;
|
| + }
|
| + }
|
| + if (!section.expanded)
|
| + InspectorTest.addResult(" <section collapsed>");
|
| + }
|
| + }
|
| +
|
| + function didCallFunctionOn(error, result, wasThrown)
|
| + {
|
| + InspectorTest.addResult("Inspected value toString(): " + result.value);
|
| + InspectorTest.resumeExecution(next);
|
| + }
|
| + function didCallInvalidFunctionOn(error, result, wasThrown)
|
| + {
|
| + InspectorTest.addResult("Result of calling invalid function. value: " + result.value + ". exception thrown: " + wasThrown);
|
| + InspectorTest.resumeExecution(next);
|
| + }
|
| + }
|
| + ]);
|
| +
|
| + function expandScopeChainSections()
|
| + {
|
| + var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
|
| + for (var i = 0; i < sections.length; i++)
|
| + sections[i].expand();
|
| + }
|
| +
|
| + function dumpScopeChainContents()
|
| + {
|
| + var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
|
| + InspectorTest.addResult("");
|
| + InspectorTest.addResult("Dump scope sections:");
|
| + for (var i = 0; i < sections.length; i++) {
|
| + var section = sections[i];
|
| + var properties = section.propertiesForTest;
|
| + var contents = InspectorTest.textContentWithLineBreaks(section.element);
|
| + contents = contents.replace(/(file:\/\/\/\w):/g, "$1");
|
| + contents = contents.replace(/file:\/\/\/?[^: )]*([.]dart|[$]script|[$]trampoline)/g, "(SOURCE_LOCATION)");
|
| + contents = contents.replace(/\(file:\/\/\/?[^)]*\)/g, "(SOURCE_LOCATION)");
|
| + contents = contents.replace(/@\d+/g, "(VM_PRIVATE_MANGLING)");
|
| + contents = contents.replace(/\$main\-[0-9]*/g, "(DEFAULT_ISOLATE_NAME_SUFFIX)");
|
| + InspectorTest.addResult(contents);
|
| + }
|
| + }
|
| +
|
| + function setBreakpointAndWaitUntilPaused(sourceFrame, lineNumber, pausedCallback)
|
| + {
|
| + var expectedBreakpointId;
|
| + InspectorTest.addSniffer(WebInspector.BreakpointManager.TargetBreakpoint.prototype, "_didSetBreakpointInDebugger", didSetBreakpointInDebugger);
|
| + InspectorTest.setBreakpoint(sourceFrame, lineNumber, "", true);
|
| +
|
| + function didSetBreakpointInDebugger(callback, breakpointId)
|
| + {
|
| + expectedBreakpointId = breakpointId;
|
| + InspectorTest.waitUntilPaused(didPause);
|
| + }
|
| +
|
| + function didPause(callFrames, reason, breakpointIds)
|
| + {
|
| + InspectorTest.assertEquals(breakpointIds.length, 1);
|
| + InspectorTest.assertEquals(breakpointIds[0], expectedBreakpointId);
|
| + InspectorTest.assertEquals(reason, "other");
|
| +
|
| + pausedCallback(callFrames);
|
| + }
|
| + }
|
| +};
|
| +</script>
|
| +
|
| +<body onload="runTest()">
|
| + <div id="example_div">Example div</div>
|
| +</body>
|
| +</html>
|
|
|