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() |
(...skipping 21 matching lines...) Expand all Loading... |
32 function callback() | 32 function callback() |
33 { | 33 { |
34 InspectorTest.testTargetManager.addTarget(target); | 34 InspectorTest.testTargetManager.addTarget(target); |
35 userCallback(target); | 35 userCallback(target); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
39 function createWorkspaceWithTarget(userCallback) | 39 function createWorkspaceWithTarget(userCallback) |
40 { | 40 { |
41 InspectorTest.createWorkspace(); | 41 InspectorTest.createWorkspace(); |
| 42 |
| 43 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeAdded, uiSourceCodeAdded); |
| 44 InspectorTest.testWorkspace.addEventListener(WebInspector.Workspace.Even
ts.UISourceCodeRemoved, uiSourceCodeRemoved); |
| 45 |
42 createMockTarget(callback); | 46 createMockTarget(callback); |
43 function callback(target) | 47 function callback(target) |
44 { | 48 { |
45 userCallback(target); | 49 userCallback(target); |
46 } | 50 } |
47 } | 51 } |
48 | 52 |
49 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s
ourceLineNumber, sourceColumnNumber, mapping) | 53 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s
ourceLineNumber, sourceColumnNumber, mapping) |
50 { | 54 { |
51 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber); | 55 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber); |
(...skipping 14 matching lines...) Expand all Loading... |
66 var location = script.target().debuggerModel.createRawLocation(script, l
ine, column); | 70 var location = script.target().debuggerModel.createRawLocation(script, l
ine, column); |
67 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); | 71 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio
n(location); |
68 } | 72 } |
69 | 73 |
70 function resetModels() | 74 function resetModels() |
71 { | 75 { |
72 target.debuggerModel._reset(); | 76 target.debuggerModel._reset(); |
73 InspectorTest.testDebuggerWorkspaceBinding._reset(target); | 77 InspectorTest.testDebuggerWorkspaceBinding._reset(target); |
74 } | 78 } |
75 | 79 |
| 80 function uiSourceCodeAdded(event) |
| 81 { |
| 82 var uiSourceCode = event.data; |
| 83 InspectorTest.addResult("UISourceCodeAdded: [" + uiSourceCode.project().
type() + "] " + uiSourceCode.url); |
| 84 } |
| 85 |
| 86 function uiSourceCodeRemoved(event) |
| 87 { |
| 88 var uiSourceCode = event.data; |
| 89 InspectorTest.addResult("UISourceCodeRemoved: [" + uiSourceCode.project(
).type() + "] " + uiSourceCode.url); |
| 90 } |
| 91 |
76 InspectorTest.runTestSuite([ | 92 InspectorTest.runTestSuite([ |
77 function testSimpleMap(next) | 93 function testSimpleMap(next) |
78 { | 94 { |
79 /* | 95 /* |
80 example.js: | 96 example.js: |
81 0 1 2 3 | 97 0 1 2 3 |
82 012345678901234567890123456789012345 | 98 012345678901234567890123456789012345 |
83 function add(variable_x, variable_y) | 99 function add(variable_x, variable_y) |
84 { | 100 { |
85 return variable_x + variable_y; | 101 return variable_x + variable_y; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 262 } |
247 | 263 |
248 function originalUISourceCodeAdded(uiSourceCode) | 264 function originalUISourceCodeAdded(uiSourceCode) |
249 { | 265 { |
250 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalRes
ourceUISourceCodeAdded); | 266 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalRes
ourceUISourceCodeAdded); |
251 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebI
nspector.resourceTypes.Script, ""); | 267 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebI
nspector.resourceTypes.Script, ""); |
252 } | 268 } |
253 | 269 |
254 function originalResourceUISourceCodeAdded(uiSourceCode) | 270 function originalResourceUISourceCodeAdded(uiSourceCode) |
255 { | 271 { |
| 272 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(stubUISourc
eCodeAdded, 1, WebInspector.projectTypes.Service); |
| 273 originalUISourceCode = uiSourceCode; |
| 274 } |
| 275 |
| 276 function stubUISourceCodeAdded(uiSourceCode) |
| 277 { |
256 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISour
ceCodeAdded); | 278 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISour
ceCodeAdded); |
257 originalUISourceCode = uiSourceCode; | |
258 } | 279 } |
259 | 280 |
260 function firstUISourceCodeAdded(uiSourceCode) | 281 function firstUISourceCodeAdded(uiSourceCode) |
261 { | 282 { |
262 if (!uiSourceCode.url) { | 283 if (!uiSourceCode.url) { |
263 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUI
SourceCodeAdded); | 284 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUI
SourceCodeAdded); |
264 return; | 285 return; |
265 } | 286 } |
266 | |
267 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondUISou
rceCodeAdded); | 287 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondUISou
rceCodeAdded); |
268 } | 288 } |
269 | 289 |
270 function secondUISourceCodeAdded(uiSourceCode) | 290 function secondUISourceCodeAdded(uiSourceCode) |
271 { | 291 { |
272 if (!uiSourceCode.url) { | 292 if (!uiSourceCode.url) { |
273 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondU
ISourceCodeAdded); | 293 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondU
ISourceCodeAdded); |
274 return; | 294 return; |
275 } | 295 } |
276 afterScriptAdded(); | 296 afterScriptAdded(); |
277 } | 297 } |
278 | 298 |
279 function afterScriptAdded(uiSourceCode) | 299 function afterScriptAdded() |
280 { | 300 { |
| 301 InspectorTest.addResult("afterScriptAdded"); |
281 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); | 302 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source1.js"); |
282 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); | 303 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO
riginURL("http://localhost:8000/inspector/resources/source2.js"); |
283 | 304 |
284 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); | 305 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc
ript, 0, 81)); |
285 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); | 306 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc
ript, 0, 93)); |
286 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); | 307 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc
ript, 1, 151)); |
287 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); | 308 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo
cation(script, 1, 200)); |
288 | 309 |
289 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); | 310 InspectorTest.checkRawLocation(script, 0, 42, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode1, 3, 10)); |
290 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 0, 0)); | 311 InspectorTest.checkRawLocation(script, 1, 85, InspectorTest.test
DebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode2, 0, 0)); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 }; | 492 }; |
472 | 493 |
473 </script> | 494 </script> |
474 | 495 |
475 </head> | 496 </head> |
476 | 497 |
477 <body onload="runTest()"> | 498 <body onload="runTest()"> |
478 <p>Tests SourceMap and CompilerScriptMapping.</p> | 499 <p>Tests SourceMap and CompilerScriptMapping.</p> |
479 </body> | 500 </body> |
480 </html> | 501 </html> |
OLD | NEW |