Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: LayoutTests/http/tests/inspector/compiler-script-mapping.html

Issue 299443016: DevTools: Decouple debugger model from UI entities (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge DebuggerScriptMapping into DebuggerWorkspaceBinding Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7
7 <script> 8 <script>
8 9
9 function test() 10 function test() {
10 { 11 var mockTargetId = 1;
11 var defaultScriptMapping; 12 var MockTarget = function(name, connection, callback)
12 var resourceScriptMapping; 13 {
13 var target = WebInspector.debuggerModel.target(); 14 WebInspector.Target.call(this, name, connection, callback);
14 function createCompilerScriptMapping() 15 }
16 MockTarget.prototype = {
17 _loadedWithCapabilities: function(callback)
18 {
19 this.debuggerModel = new WebInspector.DebuggerModel(this);
20 this.resourceTreeModel = WebInspector.targetManager.mainTarget().res ourceTreeModel;
vsevik 2014/08/04 09:05:14 Is this redundant?
apavlov 2014/08/04 10:04:34 Nope
21 if (callback)
22 callback();
23 },
24
25 __proto__: WebInspector.Target.prototype
26 }
27
28 function createMockTarget(userCallback)
29 {
30 var target = new MockTarget("mock-target-" + (mockTargetId++), new Inspe ctorBackendClass.StubConnection(), callback);
31 function callback()
32 {
33 InspectorTest.testTargetManager.addTarget(target);
34 userCallback(target);
35 }
36 }
37
38 function createWorkspaceWithTarget(userCallback)
15 { 39 {
16 InspectorTest.createWorkspace(); 40 InspectorTest.createWorkspace();
17 var compilerScriptMapping = new WebInspector.CompilerScriptMapping(WebIn spector.debuggerModel, InspectorTest.testWorkspace, InspectorTest.testNetworkWor kspaceBinding); 41 createMockTarget(callback);
18 resourceScriptMapping = new WebInspector.ResourceScriptMapping(WebInspec tor.debuggerModel, InspectorTest.testWorkspace); 42 function callback(target)
19 defaultScriptMapping = new WebInspector.DefaultScriptMapping(WebInspecto r.debuggerModel, InspectorTest.testWorkspace); 43 {
20 return compilerScriptMapping; 44 target.resourceTreeModel = WebInspector.targetManager.mainTarget().r esourceTreeModel;
vsevik 2014/08/04 09:05:14 Or this?
apavlov 2014/08/04 10:04:34 Yep
45 userCallback(target);
46 }
21 } 47 }
22 48
23 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s ourceLineNumber, sourceColumnNumber, mapping) 49 function checkMapping(compiledLineNumber, compiledColumnNumber, sourceURL, s ourceLineNumber, sourceColumnNumber, mapping)
24 { 50 {
25 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber); 51 var entry = mapping.findEntry(compiledLineNumber, compiledColumnNumber);
26 InspectorTest.addResult(sourceURL + " === " + entry[2]); 52 InspectorTest.addResult(sourceURL + " === " + entry[2]);
27 InspectorTest.addResult(sourceLineNumber + " === " + entry[3]); 53 InspectorTest.addResult(sourceLineNumber + " === " + entry[3]);
28 InspectorTest.addResult(sourceColumnNumber + " === " + entry[4]); 54 InspectorTest.addResult(sourceColumnNumber + " === " + entry[4]);
29 } 55 }
30 56
31 function checkReverseMapping(compiledLineNumber, compiledColumnNumber, sourc eURL, sourceLineNumber, mapping) 57 function checkReverseMapping(compiledLineNumber, compiledColumnNumber, sourc eURL, sourceLineNumber, mapping)
32 { 58 {
33 var entry = mapping.findEntryReversed(sourceURL, sourceLineNumber, 5); 59 var entry = mapping.findEntryReversed(sourceURL, sourceLineNumber, 5);
34 InspectorTest.addResult(compiledLineNumber + " === " + entry[0]); 60 InspectorTest.addResult(compiledLineNumber + " === " + entry[0]);
35 InspectorTest.addResult(compiledColumnNumber + " === " + entry[1]); 61 InspectorTest.addResult(compiledColumnNumber + " === " + entry[1]);
36 } 62 }
37 63
38 function uiLocation(script, line, column) 64 function uiLocation(script, line, column)
39 { 65 {
40 var location = script.target().debuggerModel.createRawLocation(script, l ine, column); 66 var location = script.target().debuggerModel.createRawLocation(script, l ine, column);
41 return WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(loc ation); 67 return InspectorTest.testDebuggerWorkspaceBinding.rawLocationToUILocatio n(location);
42 } 68 }
43 69
44 function resetModels() 70 function resetModels()
45 { 71 {
46 WebInspector.debuggerModel._reset(); 72 target.debuggerModel._reset();
73 InspectorTest.testDebuggerWorkspaceBinding._reset(target);
47 } 74 }
48 75
49 InspectorTest.runTestSuite([ 76 InspectorTest.runTestSuite([
50 function testSimpleMap(next) 77 function testSimpleMap(next)
51 { 78 {
52 /* 79 /*
53 example.js: 80 example.js:
54 0 1 2 3 81 0 1 2 3
55 012345678901234567890123456789012345 82 012345678901234567890123456789012345
56 function add(variable_x, variable_y) 83 function add(variable_x, variable_y)
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 rfc3986_5_4("g#s/../x", "http://a/b/c/g#s/../x"); 224 rfc3986_5_4("g#s/../x", "http://a/b/c/g#s/../x");
198 225
199 rfc3986_5_4("//secure.com/moo", "http://secure.com/moo"); // not i n RFC3986 226 rfc3986_5_4("//secure.com/moo", "http://secure.com/moo"); // not i n RFC3986
200 rfc3986_5_4("cat.jpeg", "http://a/b/c/cat.jpeg"); // not in RFC398 6 227 rfc3986_5_4("cat.jpeg", "http://a/b/c/cat.jpeg"); // not in RFC398 6
201 next(); 228 next();
202 }, 229 },
203 230
204 function testCompilerScriptMapping(next) 231 function testCompilerScriptMapping(next)
205 { 232 {
206 var script; 233 var script;
207 resetModels(); 234 createWorkspaceWithTarget(function(target) {
vsevik 2014/08/04 09:05:14 Let's use a name function instead, so that we need
apavlov 2014/08/04 10:04:34 Done.
208 var mapping = createCompilerScriptMapping(); 235 var originalUISourceCode;
236 step1();
237
238 function step1()
239 {
240 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(origina lUISourceCodeAdded);
241 script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "", target, function(script) {
242 script.sourceMapURL = "http://localhost:8000/inspector/r esources/source-map.json";
243 });
244 InspectorTest.testDebuggerWorkspaceBinding._targetToData.get (target)._parsedScriptSource({ data: script });
245 }
246
247 function originalUISourceCodeAdded(uiSourceCode)
248 {
249 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(origina lResourceUISourceCodeAdded);
250 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebInspector.resourceTypes.Script, "");
251 }
252
253 function originalResourceUISourceCodeAdded(uiSourceCode)
254 {
255 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUI SourceCodeAdded);
256 originalUISourceCode = uiSourceCode;
257 }
258
259 function firstUISourceCodeAdded(uiSourceCode)
260 {
261 if (!uiSourceCode.url) {
262 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(fir stUISourceCodeAdded);
263 return;
264 }
265
266 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondU ISourceCodeAdded);
267 }
268
269 function secondUISourceCodeAdded(uiSourceCode)
270 {
271 if (!uiSourceCode.url) {
272 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(sec ondUISourceCodeAdded);
273 return;
274 }
275 afterScriptAdded();
276 }
277
278 function afterScriptAdded(uiSourceCode)
279 {
280 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCode ForOriginURL("http://localhost:8000/inspector/resources/source1.js");
281 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCode ForOriginURL("http://localhost:8000/inspector/resources/source2.js");
282
283 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocatio n(script, 0, 81));
284 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocatio n(script, 0, 93));
285 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocatio n(script, 1, 151));
286 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLocation(script, 1, 200));
287
288 InspectorTest.checkRawLocation(script, 0, 42, uiSourceCode1. uiLocationToRawLocation(target, 3, 10));
289 InspectorTest.checkRawLocation(script, 1, 85, uiSourceCode2. uiLocationToRawLocation(target, 0, 0));
290 InspectorTest.checkRawLocation(script, 1, 110, uiSourceCode2 .uiLocationToRawLocation(target, 5, 2));
291
292 uiSourceCode1.requestContent(didRequestContent1);
293
294 function didRequestContent1(content, contentEncoded, mimeTyp e)
295 {
296 InspectorTest.assertEquals(0, content.indexOf("window.ad dEventListener"));
297 uiSourceCode2.requestContent(didRequestContent2);
298 }
299
300 function didRequestContent2(content, contentEncoded, mimeTyp e)
301 {
302 InspectorTest.assertEquals(0, content.indexOf("function ClickHandler()"));
303 next();
304 }
305 }
306 });
307 },
308
309 function testCompilerScriptMappingWhenResourceWasLoadedAfterSource(next)
310 {
311 var script;
209 var originalUISourceCode; 312 var originalUISourceCode;
210 step1(); 313 createWorkspaceWithTarget(function(target) {
vsevik 2014/08/04 09:05:14 ditto
apavlov 2014/08/04 10:04:34 Done.
211
212 function step1()
213 {
214 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUIS ourceCodeAdded);
215 script = InspectorTest.createScriptMock("compiled.js", 0, 0, tru e, "");
216 script.sourceMapURL = "http://localhost:8000/inspector/resources /source-map.json";
217 defaultScriptMapping.addScript(script);
218 resourceScriptMapping.addScript(script);
219 mapping.addScript(script);
220 }
221
222 function originalUISourceCodeAdded(uiSourceCode)
223 {
224 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalRes ourceUISourceCodeAdded);
225 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebI nspector.resourceTypes.Script, "");
226 }
227
228 function originalResourceUISourceCodeAdded(uiSourceCode)
229 {
230 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISour ceCodeAdded);
231 originalUISourceCode = uiSourceCode;
232 }
233
234 function firstUISourceCodeAdded(uiSourceCode)
235 {
236 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondUISou rceCodeAdded);
237 }
238
239 function secondUISourceCodeAdded(uiSourceCode)
240 {
241 afterScriptAdded();
242 }
243
244 function afterScriptAdded(uiSourceCode)
245 {
246 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO riginURL("http://localhost:8000/inspector/resources/source1.js");
247 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO riginURL("http://localhost:8000/inspector/resources/source2.js");
248
249 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc ript, 0, 81));
250 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc ript, 0, 93));
251 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc ript, 1, 151));
252 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo cation(script, 1, 200));
253
254 InspectorTest.checkRawLocation(script, 0, 42, uiSourceCode1.uiLo cationToRawLocation(target, 3, 10));
255 InspectorTest.checkRawLocation(script, 1, 85, uiSourceCode2.uiLo cationToRawLocation(target, 0, 0));
256 InspectorTest.checkRawLocation(script, 1, 110, uiSourceCode2.uiL ocationToRawLocation(target, 5, 2));
257
258 uiSourceCode1.requestContent(didRequestContent1);
259
260 function didRequestContent1(content, contentEncoded, mimeType)
261 {
262 InspectorTest.assertEquals(0, content.indexOf("window.addEve ntListener"));
263 uiSourceCode2.requestContent(didRequestContent2);
264 }
265
266 function didRequestContent2(content, contentEncoded, mimeType)
267 {
268 InspectorTest.assertEquals(0, content.indexOf("function Clic kHandler()"));
269 next();
270 }
271 }
272 },
273
274 function testCompilerScriptMappingWhenResourceWasLoadedAfterSource(next)
275 {
276 var script;
277 resetModels();
278 var mapping = createCompilerScriptMapping();
279 var originalUISourceCode;
280 step1();
281
282 function step1()
283 {
284 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(function() { }); 314 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(function() { });
285 script = InspectorTest.createScriptMock("compiled.js", 0, 0, tru e, ""); 315 script = InspectorTest.createScriptMock("compiled.js", 0, 0, tru e, "", target, function(script) {
286 script.sourceMapURL = "http://localhost:8000/inspector/resources /source-map.json"; 316 script.sourceMapURL = "http://localhost:8000/inspector/resou rces/source-map.json";
287 defaultScriptMapping.addScript(script); 317 });
288 resourceScriptMapping.addScript(script); 318 InspectorTest.testDebuggerWorkspaceBinding._targetToData.get(tar get)._parsedScriptSource({ data: script });
289 mapping.addScript(script);
290 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalRes ourceUISourceCodeAdded); 319 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalRes ourceUISourceCodeAdded);
291 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebI nspector.resourceTypes.Script, ""); 320 InspectorTest.addMockUISourceCodeToWorkspace("compiled.js", WebI nspector.resourceTypes.Script, "");
292 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISour ceCodeAdded); 321 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(firstUISour ceCodeAdded);
293 } 322
294 323 function originalResourceUISourceCodeAdded(uiSourceCode)
295 function originalResourceUISourceCodeAdded(uiSourceCode) 324 {
296 { 325 originalUISourceCode = uiSourceCode;
297 originalUISourceCode = uiSourceCode; 326 }
298 } 327
299 328 function firstUISourceCodeAdded(uiSourceCode)
300 function firstUISourceCodeAdded(uiSourceCode) 329 {
301 { 330 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondU ISourceCodeAdded);
302 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(secondUISou rceCodeAdded); 331 }
303 } 332
304 333 function secondUISourceCodeAdded(uiSourceCode)
305 function secondUISourceCodeAdded(uiSourceCode) 334 {
306 { 335 afterScriptAdded();
307 afterScriptAdded(); 336 }
308 } 337
309 338 function afterScriptAdded(uiSourceCode)
310 function afterScriptAdded(uiSourceCode) 339 {
311 { 340 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCode ForOriginURL("http://localhost:8000/inspector/resources/source1.js");
312 var uiSourceCode1 = InspectorTest.testWorkspace.uiSourceCodeForO riginURL("http://localhost:8000/inspector/resources/source1.js"); 341 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCode ForOriginURL("http://localhost:8000/inspector/resources/source2.js");
313 var uiSourceCode2 = InspectorTest.testWorkspace.uiSourceCodeForO riginURL("http://localhost:8000/inspector/resources/source2.js"); 342
314 343 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocatio n(script, 0, 81));
315 InspectorTest.checkUILocation(uiSourceCode1, 4, 4, uiLocation(sc ript, 0, 81)); 344 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocatio n(script, 0, 93));
316 InspectorTest.checkUILocation(uiSourceCode1, 5, 4, uiLocation(sc ript, 0, 93)); 345 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocatio n(script, 1, 151));
317 InspectorTest.checkUILocation(uiSourceCode2, 7, 4, uiLocation(sc ript, 1, 151)); 346 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLocation(script, 1, 200));
318 InspectorTest.checkUILocation(originalUISourceCode, 1, 200, uiLo cation(script, 1, 200)); 347
319 348 InspectorTest.checkRawLocation(script, 0, 42, uiSourceCode1. uiLocationToRawLocation(target, 3, 10));
320 InspectorTest.checkRawLocation(script, 0, 42, uiSourceCode1.uiLo cationToRawLocation(target, 3, 10)); 349 InspectorTest.checkRawLocation(script, 1, 85, uiSourceCode2. uiLocationToRawLocation(target, 0, 0));
321 InspectorTest.checkRawLocation(script, 1, 85, uiSourceCode2.uiLo cationToRawLocation(target, 0, 0)); 350 InspectorTest.checkRawLocation(script, 1, 110, uiSourceCode2 .uiLocationToRawLocation(target, 5, 2));
322 InspectorTest.checkRawLocation(script, 1, 110, uiSourceCode2.uiL ocationToRawLocation(target, 5, 2)); 351
323 352 uiSourceCode1.requestContent(didRequestContent1);
324 uiSourceCode1.requestContent(didRequestContent1); 353
325 354 function didRequestContent1(content, contentEncoded, mimeTyp e)
326 function didRequestContent1(content, contentEncoded, mimeType) 355 {
327 { 356 InspectorTest.assertEquals(0, content.indexOf("window.ad dEventListener"));
328 InspectorTest.assertEquals(0, content.indexOf("window.addEve ntListener")); 357 uiSourceCode2.requestContent(didRequestContent2);
329 uiSourceCode2.requestContent(didRequestContent2); 358 }
330 } 359
331 360 function didRequestContent2(content, contentEncoded, mimeTyp e)
332 function didRequestContent2(content, contentEncoded, mimeType) 361 {
333 { 362 InspectorTest.assertEquals(0, content.indexOf("function ClickHandler()"));
334 InspectorTest.assertEquals(0, content.indexOf("function Clic kHandler()")); 363 next();
335 next(); 364 }
336 } 365 }
337 } 366 });
338 }, 367 },
339 368
340 function testInlinedSourceMap(next) 369 function testInlinedSourceMap(next)
341 { 370 {
342 resetModels(); 371 createWorkspaceWithTarget(function(target) {
vsevik 2014/08/04 09:05:14 ditto
apavlov 2014/08/04 10:04:34 Done.
343 var mapping = createCompilerScriptMapping(); 372 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUIS ourceCodeAdded);
344 var script = InspectorTest.createScriptMock("http://example.com/comp iled.js", 0, 0, true, ""); 373 var script = InspectorTest.createScriptMock("http://example.com/ compiled.js", 0, 0, true, "", target, function(script) {
345 var sourceMap = { 374 var sourceMap = {
346 "file":"compiled.js", 375 "file":"compiled.js",
347 "mappings":"AAASA,QAAAA,IAAG,CAACC,CAAD,CAAaC,CAAb,CACZ,CACI,MAA OD,EAAP,CAAoBC,CADxB,CAIA,IAAIC,OAAS;", 376 "mappings":"AAASA,QAAAA,IAAG,CAACC,CAAD,CAAaC,CAAb,CACZ, CACI,MAAOD,EAAP,CAAoBC,CADxB,CAIA,IAAIC,OAAS;",
348 "sources":["source.js"], 377 "sources":["source.js"],
349 "sourcesContent":["<source content>"] 378 "sourcesContent":["<source content>"]
350 }; 379 };
351 script.sourceMapURL = "data:application/json;base64," + btoa(JSON.st ringify(sourceMap)); 380 script.sourceMapURL = "data:application/json;base64," + btoa (JSON.stringify(sourceMap));
352 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUISourc eCodeAdded); 381 });
353 defaultScriptMapping.addScript(script); 382 InspectorTest.testDebuggerWorkspaceBinding._targetToData.get(tar get)._parsedScriptSource({ data: script });
354 resourceScriptMapping.addScript(script); 383
355 mapping.addScript(script); 384 function compiledUISourceCodeAdded(uiSourceCode)
356 385 {
357 function compiledUISourceCodeAdded(uiSourceCode) 386 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(origina lUISourceCodeAdded);
358 { 387 }
359 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUIS ourceCodeAdded); 388
360 } 389 function originalUISourceCodeAdded(uiSourceCode)
361 390 {
362 function originalUISourceCodeAdded(uiSourceCode) 391 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeF orOriginURL("http://example.com/source.js");
363 { 392
364 var uiSourceCode = InspectorTest.testWorkspace.uiSourceCodeForOr iginURL("http://example.com/source.js"); 393 InspectorTest.checkUILocation(uiSourceCode, 2, 4, uiLocation (script, 0, 18));
365 394 InspectorTest.checkRawLocation(script, 0, 18, InspectorTest. testDebuggerWorkspaceBinding.uiLocationToRawLocation(target, uiSourceCode, 2, 4) );
366 InspectorTest.checkUILocation(uiSourceCode, 2, 4, mapping.rawLoc ationToUILocation(WebInspector.debuggerModel.createRawLocation(script, 0, 18))); 395
367 InspectorTest.checkRawLocation(script, 0, 18, mapping.uiLocation ToRawLocation(uiSourceCode, 2, 4)); 396 uiSourceCode.requestContent(didRequestContent);
368 397
369 uiSourceCode.requestContent(didRequestContent); 398 function didRequestContent(content, contentEncoded, mimeType )
370 399 {
371 function didRequestContent(content, contentEncoded, mimeType) 400 InspectorTest.addResult("<source content> === " + conten t);
372 { 401 next();
373 InspectorTest.addResult("<source content> === " + content); 402 }
374 next(); 403 }
375 } 404 });
376 }
377 }, 405 },
378 406
379 function testSourceMapCouldNotBeLoaded(next) 407 function testSourceMapCouldNotBeLoaded(next)
380 { 408 {
381 WebInspector.settings.jsSourceMapsEnabled.get = function() { return true; } 409 WebInspector.settings.jsSourceMapsEnabled.get = function() { return true; }
382 resetModels(); 410 createWorkspaceWithTarget(function(target) {
383 InspectorTest.createWorkspace(); 411 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUIS ourceCodeAdded);
384 var debuggerScriptMapping = new WebInspector.DebuggerScriptMapping(W ebInspector.debuggerModel, InspectorTest.testWorkspace, InspectorTest.testNetwor kWorkspaceBinding); 412 var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, "", target);
385 413
386 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUISourc eCodeAdded); 414 function compiledUISourceCodeAdded(uiSourceCode)
387 var script = InspectorTest.createScriptMock("compiled.js", 0, 0, tru e, ""); 415 {
388 416 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(origina lUISourceCodeAdded);
389 function compiledUISourceCodeAdded(uiSourceCode) 417 }
390 { 418
391 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUIS ourceCodeAdded); 419 function originalUISourceCodeAdded(uiSourceCode) { }
392 } 420
393 421 script.sourceMapURL = "http://localhost:8000/inspector/resources /source-map.json_";
394 function originalUISourceCodeAdded(uiSourceCode) { } 422 console.error = function() {}; // Error message is platform depe ndent.
395 423 InspectorTest.testDebuggerWorkspaceBinding._targetToData.get(tar get)._parsedScriptSource({ data: script });
396 script.sourceMapURL = "http://localhost:8000/inspector/resources/sou rce-map.json_"; 424 var location = uiLocation(script, 0, 0);
397 console.error = function() {}; // Error message is platform dependen t. 425 InspectorTest.addResult(location.uiSourceCode.originURL());
398 debuggerScriptMapping._parsedScriptSource({data:script}); 426 next();
399 var location = uiLocation(script, 0, 0); 427 });
400 InspectorTest.addResult(location.uiSourceCode.originURL());
401 next();
402 }, 428 },
403 429
404 function testSourceRoot(next) 430 function testSourceRoot(next)
405 { 431 {
406 /* 432 /*
407 example.js: 433 example.js:
408 0 1 2 3 434 0 1 2 3
409 012345678901234567890123456789012345 435 012345678901234567890123456789012345
410 function add(variable_x, variable_y) 436 function add(variable_x, variable_y)
411 { 437 {
(...skipping 21 matching lines...) Expand all
433 }; 459 };
434 460
435 </script> 461 </script>
436 462
437 </head> 463 </head>
438 464
439 <body onload="runTest()"> 465 <body onload="runTest()">
440 <p>Tests SourceMap and CompilerScriptMapping.</p> 466 <p>Tests SourceMap and CompilerScriptMapping.</p>
441 </body> 467 </body>
442 </html> 468 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698