| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="inspector-test.js"></script> | 3 <script src="inspector-test.js"></script> |
| 4 <script src="debugger-test.js"></script> | 4 <script src="debugger-test.js"></script> |
| 5 <script src="workspace-test.js"></script> | 5 <script src="workspace-test.js"></script> |
| 6 <script src="breakpoint-manager-test.js"></script> | 6 <script src="breakpoint-manager-test.js"></script> |
| 7 | 7 |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 function test() | 10 function test() |
| 11 { | 11 { |
| 12 function createWorkspaceWithTarget(userCallback) | 12 function createWorkspaceWithTarget(userCallback) |
| 13 { | 13 { |
| 14 InspectorTest.createWorkspace(); | 14 InspectorTest.createWorkspace(); |
| 15 var target = InspectorTest.createMockTarget(InspectorTest._mockTargetId+
+); | 15 var target = InspectorTest.createMockTarget(InspectorTest._mockTargetId+
+); |
| 16 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeAdded, uiSourceCodeAdded); | 16 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeAdded, uiSourceCodeAdded); |
| 17 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeRemoved, uiSourceCodeRemoved); | 17 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeRemoved, uiSourceCodeRemoved); |
| 18 userCallback(target); | 18 userCallback(target); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s
ourceLineNumber, sourceColumnNumber, mapping) | 21 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s
ourceLineNumber, sourceColumnNumber, mapping) |
| 22 { | 22 { |
| 23 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber); | 23 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber); |
| 24 InspectorTest.addResult(sourceURL + " === " + entry[2]); | 24 InspectorTest.addResult(sourceURL + " === " + entry.sourceURL); |
| 25 InspectorTest.addResult(sourceLineNumber + " === " + entry[3]); | 25 InspectorTest.addResult(sourceLineNumber + " === " + entry.sourceLineNum
ber); |
| 26 InspectorTest.addResult(sourceColumnNumber + " === " + entry[4]); | 26 InspectorTest.addResult(sourceColumnNumber + " === " + entry.sourceColum
nNumber); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function checkReverseMapping(compiledLineNumber, compiledColumnNumber, sourc
eURL, sourceLineNumber, mapping) | 29 function checkReverseMapping(compiledLineNumber, compiledColumnNumber, sourc
eURL, sourceLineNumber, mapping) |
| 30 { | 30 { |
| 31 var entry = mapping.findEntryReversed(sourceURL, sourceLineNumber, 5); | 31 var entry = mapping.firstSourceLineMapping(sourceURL, sourceLineNumber); |
| 32 InspectorTest.addResult(compiledLineNumber + " === " + entry[0]); | 32 if (!entry) { |
| 33 InspectorTest.addResult(compiledColumnNumber + " === " + entry[1]); | 33 InspectorTest.addResult("source line " + sourceLineNumber + " has no
mappings."); |
| 34 return; |
| 35 } |
| 36 InspectorTest.addResult(compiledLineNumber + " === " + entry.lineNumber)
; |
| 37 InspectorTest.addResult(compiledColumnNumber + " === " + entry.columnNum
ber); |
| 34 } | 38 } |
| 35 | 39 |
| 36 function uiLocation(script, line, column) | 40 function uiLocation(script, line, column) |
| 37 { | 41 { |
| 38 var location = script.target().debuggerModel.createRawLocation(script, l
ine, column); | 42 var location = script.target().debuggerModel.createRawLocation(script, l
ine, column); |
| 39 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); | 43 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); |
| 40 } | 44 } |
| 41 | 45 |
| 42 function resetModels() | 46 function resetModels() |
| 43 { | 47 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 108 |
| 105 function testNoMappingEntry(next) | 109 function testNoMappingEntry(next) |
| 106 { | 110 { |
| 107 var mappingPayload = { | 111 var mappingPayload = { |
| 108 "mappings":"AAAA,C,CAAE;", | 112 "mappings":"AAAA,C,CAAE;", |
| 109 "sources":["example.js"] | 113 "sources":["example.js"] |
| 110 }; | 114 }; |
| 111 var mapping = new WebInspector.SourceMap("source-map.json", mappingP
ayload); | 115 var mapping = new WebInspector.SourceMap("source-map.json", mappingP
ayload); |
| 112 checkMapping(0, 0, "example.js", 0, 0, mapping); | 116 checkMapping(0, 0, "example.js", 0, 0, mapping); |
| 113 var entry = mapping.findEntry(0, 1); | 117 var entry = mapping.findEntry(0, 1); |
| 114 InspectorTest.assertEquals(2, entry.length); | 118 InspectorTest.assertTrue(!entry.sourceURL); |
| 115 checkMapping(0, 2, "example.js", 0, 2, mapping); | 119 checkMapping(0, 2, "example.js", 0, 2, mapping); |
| 116 next(); | 120 next(); |
| 117 }, | 121 }, |
| 118 | 122 |
| 119 function testEmptyLine(next) | 123 function testEmptyLine(next) |
| 120 { | 124 { |
| 121 var mappingPayload = { | 125 var mappingPayload = { |
| 122 "mappings":"AAAA;;;CACA", | 126 "mappings":"AAAA;;;CACA", |
| 123 "sources":["example.js"] | 127 "sources":["example.js"] |
| 124 }; | 128 }; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 }; | 467 }; |
| 464 | 468 |
| 465 </script> | 469 </script> |
| 466 | 470 |
| 467 </head> | 471 </head> |
| 468 | 472 |
| 469 <body onload="runTest()"> | 473 <body onload="runTest()"> |
| 470 <p>Tests SourceMap and CompilerScriptMapping.</p> | 474 <p>Tests SourceMap and CompilerScriptMapping.</p> |
| 471 </body> | 475 </body> |
| 472 </html> | 476 </html> |
| OLD | NEW |