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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/debugger-test.js

Issue 2752403002: [DevTools] Migrate usages of Target to RuntimeModel where makes sense (Closed)
Patch Set: review comments addressed Created 3 years, 9 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
OLDNEW
1 function scheduleTestFunction() 1 function scheduleTestFunction()
2 { 2 {
3 setTimeout(testFunction, 0); 3 setTimeout(testFunction, 0);
4 } 4 }
5 5
6 var initialize_DebuggerTest = function() { 6 var initialize_DebuggerTest = function() {
7 7
8 InspectorTest.preloadPanel("sources"); 8 InspectorTest.preloadPanel("sources");
9 9
10 InspectorTest.startDebuggerTest = function(callback, quiet) 10 InspectorTest.startDebuggerTest = function(callback, quiet)
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 function runtimeCallFramePosition() 341 function runtimeCallFramePosition()
342 { 342 {
343 return new SDK.DebuggerModel.Location(debuggerModel, this.scriptId, this .lineNumber, this.columnNumber); 343 return new SDK.DebuggerModel.Location(debuggerModel, this.scriptId, this .lineNumber, this.columnNumber);
344 } 344 }
345 345
346 results.push("Call stack:"); 346 results.push("Call stack:");
347 printCallFrames(callFrames, SDK.DebuggerModel.CallFrame.prototype.location, SDK.DebuggerModel.CallFrame.prototype.returnValue); 347 printCallFrames(callFrames, SDK.DebuggerModel.CallFrame.prototype.location, SDK.DebuggerModel.CallFrame.prototype.returnValue);
348 while (asyncStackTrace) { 348 while (asyncStackTrace) {
349 results.push(" [" + (asyncStackTrace.description || "Async Call") + " ]"); 349 results.push(" [" + (asyncStackTrace.description || "Async Call") + " ]");
350 var debuggerModel = SDK.DebuggerModel.fromTarget(SDK.targetManager.mainT arget()); 350 var debuggerModel = InspectorTest.debuggerModel;
351 var printed = printCallFrames(asyncStackTrace.callFrames, runtimeCallFra mePosition); 351 var printed = printCallFrames(asyncStackTrace.callFrames, runtimeCallFra mePosition);
352 if (!printed) 352 if (!printed)
353 results.pop(); 353 results.pop();
354 asyncStackTrace = asyncStackTrace.parent; 354 asyncStackTrace = asyncStackTrace.parent;
355 } 355 }
356 return results.join("\n"); 356 return results.join("\n");
357 }; 357 };
358 358
359 InspectorTest.dumpSourceFrameContents = function(sourceFrame) 359 InspectorTest.dumpSourceFrameContents = function(sourceFrame)
360 { 360 {
361 InspectorTest.addResult("==Source frame contents start=="); 361 InspectorTest.addResult("==Source frame contents start==");
362 var textEditor = sourceFrame._textEditor; 362 var textEditor = sourceFrame._textEditor;
363 for (var i = 0; i < textEditor.linesCount; ++i) 363 for (var i = 0; i < textEditor.linesCount; ++i)
364 InspectorTest.addResult(textEditor.line(i)); 364 InspectorTest.addResult(textEditor.line(i));
365 InspectorTest.addResult("==Source frame contents end=="); 365 InspectorTest.addResult("==Source frame contents end==");
366 }; 366 };
367 367
368 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId s, asyncStackTrace) 368 InspectorTest._pausedScript = function(callFrames, reason, auxData, breakpointId s, asyncStackTrace)
369 { 369 {
370 if (!InspectorTest._quiet) 370 if (!InspectorTest._quiet)
371 InspectorTest.addResult("Script execution paused."); 371 InspectorTest.addResult("Script execution paused.");
372 var debuggerModel = SDK.DebuggerModel.fromTarget(this.target()); 372 var debuggerModel = this.target().model(SDK.DebuggerModel);
373 InspectorTest._pausedScriptArguments = [SDK.DebuggerModel.CallFrame.fromPayl oadArray(debuggerModel, callFrames), reason, breakpointIds, asyncStackTrace, aux Data]; 373 InspectorTest._pausedScriptArguments = [SDK.DebuggerModel.CallFrame.fromPayl oadArray(debuggerModel, callFrames), reason, breakpointIds, asyncStackTrace, aux Data];
374 if (InspectorTest._waitUntilPausedCallback) { 374 if (InspectorTest._waitUntilPausedCallback) {
375 var callback = InspectorTest._waitUntilPausedCallback; 375 var callback = InspectorTest._waitUntilPausedCallback;
376 delete InspectorTest._waitUntilPausedCallback; 376 delete InspectorTest._waitUntilPausedCallback;
377 setTimeout(() => callback.apply(callback, InspectorTest._pausedScriptArg uments)); 377 setTimeout(() => callback.apply(callback, InspectorTest._pausedScriptArg uments));
378 } 378 }
379 }; 379 };
380 380
381 InspectorTest._resumedScript = function() 381 InspectorTest._resumedScript = function()
382 { 382 {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 var script = InspectorTest.debuggerModel._scripts[scriptId]; 579 var script = InspectorTest.debuggerModel._scripts[scriptId];
580 if (!filter || filter(script)) 580 if (!filter || filter(script))
581 scripts.push(script); 581 scripts.push(script);
582 } 582 }
583 return scripts; 583 return scripts;
584 }; 584 };
585 585
586 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent Script, source, target, preRegisterCallback) 586 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent Script, source, target, preRegisterCallback)
587 { 587 {
588 target = target || SDK.targetManager.mainTarget(); 588 target = target || SDK.targetManager.mainTarget();
589 var debuggerModel = SDK.DebuggerModel.fromTarget(target); 589 var debuggerModel = target.model(SDK.DebuggerModel);
590 var scriptId = ++InspectorTest._lastScriptId + ""; 590 var scriptId = ++InspectorTest._lastScriptId + "";
591 var lineCount = source.computeLineEndings().length; 591 var lineCount = source.computeLineEndings().length;
592 var endLine = startLine + lineCount - 1; 592 var endLine = startLine + lineCount - 1;
593 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt h - source.computeLineEndings()[lineCount - 2]; 593 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt h - source.computeLineEndings()[lineCount - 2];
594 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); 594 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m) || !!so urce.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m);
595 var script = new SDK.Script(debuggerModel, scriptId, url, startLine, startCo lumn, endLine, endColumn, 0, "", isContentScript, false, undefined, hasSourceURL , source.length); 595 var script = new SDK.Script(debuggerModel, scriptId, url, startLine, startCo lumn, endLine, endColumn, 0, "", isContentScript, false, undefined, hasSourceURL , source.length);
596 script.requestContent = function() 596 script.requestContent = function()
597 { 597 {
598 var trimmedSource = SDK.Script._trimSourceURLComment(source); 598 var trimmedSource = SDK.Script._trimSourceURLComment(source);
599 return Promise.resolve(trimmedSource); 599 return Promise.resolve(trimmedSource);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 var bookmark = bookmarks[index]; 729 var bookmark = bookmarks[index];
730 if (bookmark) { 730 if (bookmark) {
731 bookmark[Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymb olForTest].click(); 731 bookmark[Sources.JavaScriptSourceFrame.BreakpointDecoration._elementSymb olForTest].click();
732 } else { 732 } else {
733 InspectorTest.addResult(`Could not click on Javascript breakpoint - line Number: ${lineNumber}, index: ${index}`); 733 InspectorTest.addResult(`Could not click on Javascript breakpoint - line Number: ${lineNumber}, index: ${index}`);
734 next(); 734 next();
735 } 735 }
736 } 736 }
737 737
738 }; 738 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698