| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <script src="../../http/tests/inspector/inspector-test.js"></script> | 2 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 3 <script src="../../http/tests/inspector/debugger-test.js"></script> | 3 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 4 | 5 |
| 5 <script type="application/dart" src="debugger-eval-on-call-frame.DART"></script> | 6 <script type="application/dart" src="debugger-eval-on-call-frame.DART"></script> |
| 6 | 7 |
| 7 <script> | 8 <script> |
| 8 | 9 |
| 9 function postMessageToDart() | 10 function postMessageToDart() |
| 10 { | 11 { |
| 11 window.postMessage('fromJS', '*'); | 12 window.postMessage('fromJS', '*'); |
| 12 } | 13 } |
| 13 | 14 |
| 14 function testFunction() { | 15 function testFunction() { |
| 15 postMessageToDart(); | 16 postMessageToDart(); |
| 16 } | 17 } |
| 17 | 18 |
| 18 function test() | 19 function test() |
| 19 { | 20 { |
| 21 // Inject name mangling for Dart more deeply in the existing JS test |
| 22 // framework to reduce the amount of code that we need to duplicate from |
| 23 // the JS side. |
| 24 realAddResult = InspectorTest.addResult; |
| 25 InspectorTest.addResult = function(text) { |
| 26 text = text.replace(/(file:\/\/\/\w):/g, "$1"); |
| 27 text = text.replace(/file:\/\/\/?[^: )]*([.]dart|[$]script|[$]trampoline
)/g, "(SOURCE_LOCATION)"); |
| 28 text = text.replace(/\(file:\/\/\/?[^)]*\)/g, "(SOURCE_LOCATION)"); |
| 29 text = text.replace(/@\d+/g, "(VM_PRIVATE_MANGLING)"); |
| 30 text = text.replace(/\$main\-[0-9]*/g, "(DEFAULT_ISOLATE_NAME_SUFFIX)"); |
| 31 text = text.replace(/:\d\d\d+/g, ":xxxx"); |
| 32 return realAddResult.call(this, text); |
| 33 }; |
| 34 |
| 20 var panel = WebInspector.inspectorView.showPanel("sources"); | 35 var panel = WebInspector.inspectorView.showPanel("sources"); |
| 21 InspectorTest.runDebuggerTestSuite([ | 36 InspectorTest.runDebuggerTestSuite([ |
| 22 function testScopeChain(next) | 37 function testScopeChain(next) |
| 23 { | 38 { |
| 24 // Intentionally end this script name with .DART instead of .dart | 39 // Intentionally end this script name with .DART instead of .dart |
| 25 // to verify that breakpoints set by url regex still are treated | 40 // 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. | 41 // 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); | 42 InspectorTest.showScriptSource('debugger-eval-on-call-frame.DART', d
idShowScriptSource); |
| 28 | 43 |
| 29 function didShowScriptSource(sourceFrame) | 44 function didShowScriptSource(sourceFrame) |
| 30 { | 45 { |
| 31 // Break within the body of the closure method. | 46 // Break within the body of the closure method. |
| 32 setBreakpointAndWaitUntilPaused('debugger-eval-on-call-frame.[dD
][aA][rR][tT]', 36, didPauseInDart); | 47 setBreakpointAndWaitUntilPaused('debugger-eval-on-call-frame.DAR
T', 36, didPauseInDart); |
| 33 InspectorTest.runTestFunction(); | 48 |
| 49 //setBreakpointAndWaitUntilPaused('debugger-eval-on-call-frame.[
dD][aA][rR][tT]', 36, didPauseInDart); |
| 34 } | 50 } |
| 35 | 51 |
| 36 function didPauseInDart(callFrames) | 52 function didPauseInDart(callFrames) |
| 37 { | 53 { |
| 38 InspectorTest.captureStackTrace(callFrames); | 54 InspectorTest.captureStackTrace(callFrames); |
| 39 | 55 |
| 40 function evaluate(expression) | 56 function evaluate(expression) |
| 41 { | 57 { |
| 42 InspectorTest.evaluateInConsole(expression, didEvaluateInCon
sole); | 58 InspectorTest.evaluateInConsole(expression, didEvaluateInCon
sole); |
| 43 function didEvaluateInConsole(result) | 59 function didEvaluateInConsole(result) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 'staticField', | 81 'staticField', |
| 66 'globalVar', | 82 'globalVar', |
| 67 // Should fail as Test is not available in the scope of the | 83 // Should fail as Test is not available in the scope of the |
| 68 // executing closure. | 84 // executing closure. |
| 69 'foo', | 85 'foo', |
| 70 'z', | 86 'z', |
| 71 // Command line API | 87 // Command line API |
| 72 'inspect(document.documentElement).tagName', | 88 'inspect(document.documentElement).tagName', |
| 73 'inspect(document.body).tagName', | 89 'inspect(document.body).tagName', |
| 74 'inspect(document.body.children.first).tagName', | 90 'inspect(document.body.children.first).tagName', |
| 91 '$4', // should fail as $4 is not defined yet |
| 75 '$0.toString()', | 92 '$0.toString()', |
| 76 '$1.toString()', | 93 '$1.toString()', |
| 77 '$2.toString()', | 94 '$2.toString()', |
| 78 '$1 == document.body', | 95 '$0 == document.body.children.first', |
| 79 '$1 == document.body', | 96 '$1 != document.body', |
| 80 '$2 == document.documentElement', | 97 '$2 == document.documentElement', |
| 81 // FIXME(jacobr): we had to remove this as it logs a | 98 // FIXME(jacobr): we had to remove this as it logs a |
| 82 // message to the console with a line number in the | 99 // message to the console with a line number in the |
| 83 // release build. | 100 // release build. |
| 84 // dir([1,2,3,4,5])', | 101 // dir([1,2,3,4,5])', |
| 85 ]; | 102 ]; |
| 86 evaluate(expressions.shift()); | 103 evaluate(expressions.shift()); |
| 87 } | 104 } |
| 88 }, | 105 }, |
| 89 ]); | 106 ]); |
| 90 | 107 |
| 91 function setBreakpointAndWaitUntilPaused(urlRegex, lineNumber, pausedCallbac
k) | 108 function setBreakpointAndWaitUntilPaused(urlRegex, lineNumber, pausedCallbac
k) |
| 92 { | 109 { |
| 93 var expectedBreakpointId; | 110 InspectorTest.DebuggerAgent.invoke_setBreakpointByUrl({urlRegex: urlRege
x, lineNumber:lineNumber}, step2); |
| 94 WebInspector.debuggerModel._agent.setBreakpointByUrl(lineNumber, undefin
ed, urlRegex, 0, "", undefined, "dart", didSetBreakpointInDebugger); | |
| 95 | 111 |
| 96 function didSetBreakpointInDebugger(callback, breakpointId) | 112 function step2(result) |
| 97 { | 113 { |
| 98 expectedBreakpointId = breakpointId; | 114 InspectorTest.runTestFunctionAndWaitUntilPaused(pausedCallback); |
| 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 } | 115 } |
| 110 } | 116 } |
| 111 }; | 117 }; |
| 112 </script> | 118 </script> |
| 113 | 119 |
| 114 <body onload="runTest()"> | 120 <body onload="runTest()"> |
| 121 <div></div> |
| 115 </body> | 122 </body> |
| 116 </html> | 123 </html> |
| OLD | NEW |