Index: LayoutTests/dart/inspector/debugger-eval-on-call-frame.html |
diff --git a/LayoutTests/dart/inspector/debugger-eval-on-call-frame.html b/LayoutTests/dart/inspector/debugger-eval-on-call-frame.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fe7c1b66efd649979327e3174c726bef8c4eca33 |
--- /dev/null |
+++ b/LayoutTests/dart/inspector/debugger-eval-on-call-frame.html |
@@ -0,0 +1,116 @@ |
+<html> |
+<script src="../../http/tests/inspector/inspector-test.js"></script> |
+<script src="../../http/tests/inspector/debugger-test.js"></script> |
+ |
+<script type="application/dart" src="debugger-eval-on-call-frame.DART"></script> |
+ |
+<script> |
+ |
+function postMessageToDart() |
+{ |
+ window.postMessage('fromJS', '*'); |
+} |
+ |
+function testFunction() { |
+ postMessageToDart(); |
+} |
+ |
+function test() |
+{ |
+ var panel = WebInspector.inspectorView.showPanel("sources"); |
+ InspectorTest.runDebuggerTestSuite([ |
+ function testScopeChain(next) |
+ { |
+ // Intentionally end this script name with .DART instead of .dart |
+ // to verify that breakpoints set by url regex still are treated |
+ // as dart even if the regexp and script url do not end in .dart. |
+ InspectorTest.showScriptSource('debugger-eval-on-call-frame.DART', didShowScriptSource); |
+ |
+ function didShowScriptSource(sourceFrame) |
+ { |
+ // Break within the body of the closure method. |
+ setBreakpointAndWaitUntilPaused('debugger-eval-on-call-frame.[dD][aA][rR][tT]', 36, didPauseInDart); |
+ InspectorTest.runTestFunction(); |
+ } |
+ |
+ function didPauseInDart(callFrames) |
+ { |
+ InspectorTest.captureStackTrace(callFrames); |
+ |
+ function evaluate(expression) |
+ { |
+ InspectorTest.evaluateInConsole(expression, didEvaluateInConsole); |
+ function didEvaluateInConsole(result) |
+ { |
+ // For file urls we leave the file name and line # |
+ // information in the url as these file urls are from |
+ // the test files themselves so will not be broken by |
+ // external changes. |
+ result = result.replace(/\(file:[^.)]*(\/[^\/]*[.]dart[0-9:]*)\)/g, |
+ "(FILE_SOURCE_LOCATION$1)"); |
+ // For dart: urls we remove all file name and line # |
+ // information as the tests shouldn't break when |
+ // dart:core changes. |
+ result = result.replace(/\(dart:[^)]*\)/g, |
+ "(DART_CORE_LIBRARY_SOURCE_LOCATION)"); |
+ InspectorTest.addResult(expression + " = " + result); |
+ if (expressions.length) |
+ evaluate(expressions.shift()); |
+ else |
+ next(); |
+ } |
+ } |
+ |
+ var expressions = [ |
+ 'staticField', |
+ 'globalVar', |
+ // Should fail as Test is not available in the scope of the |
+ // executing closure. |
+ 'foo', |
+ 'z', |
+ // Command line API |
+ 'inspect(document.documentElement).tagName', |
+ 'inspect(document.body).tagName', |
+ 'inspect(document.body.children.first).tagName', |
+ '$0.toString()', |
+ '$1.toString()', |
+ '$2.toString()', |
+ '$1 == document.body', |
+ '$1 == document.body', |
+ '$2 == document.documentElement', |
+ // FIXME(jacobr): we had to remove this as it logs a |
+ // message to the console with a line number in the |
+ // release build. |
+ // dir([1,2,3,4,5])', |
+ ]; |
+ evaluate(expressions.shift()); |
+ } |
+ }, |
+ ]); |
+ |
+ function setBreakpointAndWaitUntilPaused(urlRegex, lineNumber, pausedCallback) |
+ { |
+ var expectedBreakpointId; |
+ WebInspector.debuggerModel._agent.setBreakpointByUrl(lineNumber, undefined, urlRegex, 0, "", undefined, "dart", didSetBreakpointInDebugger); |
+ |
+ 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()"> |
+</body> |
+</html> |