OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 3 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 4 |
| 5 <script type="application/dart" src="debugger-eval-on-call-frame.DART"></script> |
| 6 |
| 7 <script> |
| 8 |
| 9 function postMessageToDart() |
| 10 { |
| 11 window.postMessage('fromJS', '*'); |
| 12 } |
| 13 |
| 14 function testFunction() { |
| 15 postMessageToDart(); |
| 16 } |
| 17 |
| 18 function test() |
| 19 { |
| 20 var panel = WebInspector.inspectorView.showPanel("sources"); |
| 21 InspectorTest.runDebuggerTestSuite([ |
| 22 function testScopeChain(next) |
| 23 { |
| 24 // Intentionally end this script name with .DART instead of .dart |
| 25 // to verify that breakpoints set by url regex still are treated |
| 26 // as dart even if the regexp and script url do not end in .dart. |
| 27 InspectorTest.showScriptSource('debugger-eval-on-call-frame.DART', d
idShowScriptSource); |
| 28 |
| 29 function didShowScriptSource(sourceFrame) |
| 30 { |
| 31 // Break within the body of the closure method. |
| 32 setBreakpointAndWaitUntilPaused('debugger-eval-on-call-frame.[dD
][aA][rR][tT]', 36, didPauseInDart); |
| 33 InspectorTest.runTestFunction(); |
| 34 } |
| 35 |
| 36 function didPauseInDart(callFrames) |
| 37 { |
| 38 InspectorTest.captureStackTrace(callFrames); |
| 39 |
| 40 function evaluate(expression) |
| 41 { |
| 42 InspectorTest.evaluateInConsole(expression, didEvaluateInCon
sole); |
| 43 function didEvaluateInConsole(result) |
| 44 { |
| 45 // For file urls we leave the file name and line # |
| 46 // information in the url as these file urls are from |
| 47 // the test files themselves so will not be broken by |
| 48 // external changes. |
| 49 result = result.replace(/\(file:[^.)]*(\/[^\/]*[.]dart[0
-9:]*)\)/g, |
| 50 "(FILE_SOURCE_LOCATION$1)"); |
| 51 // For dart: urls we remove all file name and line # |
| 52 // information as the tests shouldn't break when |
| 53 // dart:core changes. |
| 54 result = result.replace(/\(dart:[^)]*\)/g, |
| 55 "(DART_CORE_LIBRARY_SOURCE_LOCAT
ION)"); |
| 56 InspectorTest.addResult(expression + " = " + result); |
| 57 if (expressions.length) |
| 58 evaluate(expressions.shift()); |
| 59 else |
| 60 next(); |
| 61 } |
| 62 } |
| 63 |
| 64 var expressions = [ |
| 65 'staticField', |
| 66 'globalVar', |
| 67 // Should fail as Test is not available in the scope of the |
| 68 // executing closure. |
| 69 'foo', |
| 70 'z', |
| 71 // Command line API |
| 72 'inspect(document.documentElement).tagName', |
| 73 'inspect(document.body).tagName', |
| 74 'inspect(document.body.children.first).tagName', |
| 75 '$0.toString()', |
| 76 '$1.toString()', |
| 77 '$2.toString()', |
| 78 '$1 == document.body', |
| 79 '$1 == document.body', |
| 80 '$2 == document.documentElement', |
| 81 // FIXME(jacobr): we had to remove this as it logs a |
| 82 // message to the console with a line number in the |
| 83 // release build. |
| 84 // dir([1,2,3,4,5])', |
| 85 ]; |
| 86 evaluate(expressions.shift()); |
| 87 } |
| 88 }, |
| 89 ]); |
| 90 |
| 91 function setBreakpointAndWaitUntilPaused(urlRegex, lineNumber, pausedCallbac
k) |
| 92 { |
| 93 var expectedBreakpointId; |
| 94 WebInspector.debuggerModel._agent.setBreakpointByUrl(lineNumber, undefin
ed, urlRegex, 0, "", undefined, "dart", didSetBreakpointInDebugger); |
| 95 |
| 96 function didSetBreakpointInDebugger(callback, breakpointId) |
| 97 { |
| 98 expectedBreakpointId = breakpointId; |
| 99 InspectorTest.waitUntilPaused(didPause); |
| 100 } |
| 101 |
| 102 function didPause(callFrames, reason, breakpointIds) |
| 103 { |
| 104 InspectorTest.assertEquals(breakpointIds.length, 1); |
| 105 InspectorTest.assertEquals(breakpointIds[0], expectedBreakpointId); |
| 106 InspectorTest.assertEquals(reason, "other"); |
| 107 |
| 108 pausedCallback(callFrames); |
| 109 } |
| 110 } |
| 111 }; |
| 112 </script> |
| 113 |
| 114 <body onload="runTest()"> |
| 115 </body> |
| 116 </html> |
OLD | NEW |