| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 InspectorTest.addResult("afterScriptAdded"); | 277 InspectorTest.addResult("afterScriptAdded"); |
| 274 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); | 278 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); |
| 275 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); | 279 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); |
| 276 | 280 |
| 277 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); | 281 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); |
| 278 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); | 282 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); |
| 279 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); | 283 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); |
| 280 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); | 284 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); |
| 281 | 285 |
| 282 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); | 286 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); |
| 283 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 0, 0)); | 287 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 1, 0)); |
| 284 InspectorTest.checkRawLocation(script, 1, 110, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 5, 2)); | 288 InspectorTest.checkRawLocation(script, 1, 110, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 5, 2)); |
| 285 | 289 |
| 286 uiSourceCode1.requestContent(didRequestContent1); | 290 uiSourceCode1.requestContent(didRequestContent1); |
| 287 | 291 |
| 288 function didRequestContent1(content, contentEncoded, mimeType) | 292 function didRequestContent1(content, contentEncoded, mimeType) |
| 289 { | 293 { |
| 290 InspectorTest.assertEquals(0, content.indexOf("window.addEve
ntListener")); | 294 InspectorTest.assertEquals(0, content.indexOf("window.addEve
ntListener")); |
| 291 uiSourceCode2.requestContent(didRequestContent2); | 295 uiSourceCode2.requestContent(didRequestContent2); |
| 292 } | 296 } |
| 293 | 297 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 { | 342 { |
| 339 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); | 343 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); |
| 340 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); | 344 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); |
| 341 | 345 |
| 342 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); | 346 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); |
| 343 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); | 347 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); |
| 344 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); | 348 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); |
| 345 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); | 349 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); |
| 346 | 350 |
| 347 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); | 351 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); |
| 348 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 0, 0)); | 352 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 1, 0)); |
| 349 InspectorTest.checkRawLocation(script, 1, 110, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 5, 2)); | 353 InspectorTest.checkRawLocation(script, 1, 110, InspectorTest.tes
tDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 5, 2)); |
| 350 | 354 |
| 351 uiSourceCode1.requestContent(didRequestContent1); | 355 uiSourceCode1.requestContent(didRequestContent1); |
| 352 | 356 |
| 353 function didRequestContent1(content, contentEncoded, mimeType) | 357 function didRequestContent1(content, contentEncoded, mimeType) |
| 354 { | 358 { |
| 355 InspectorTest.assertEquals(0, content.indexOf("window.addEve
ntListener")); | 359 InspectorTest.assertEquals(0, content.indexOf("window.addEve
ntListener")); |
| 356 uiSourceCode2.requestContent(didRequestContent2); | 360 uiSourceCode2.requestContent(didRequestContent2); |
| 357 } | 361 } |
| 358 | 362 |
| (...skipping 104 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 |