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

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

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 11 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 panel.showUISourceCode(uiSourceCode); 360 panel.showUISourceCode(uiSourceCode);
361 var sourceFrame = panel.visibleView; 361 var sourceFrame = panel.visibleView;
362 if (sourceFrame.loaded) 362 if (sourceFrame.loaded)
363 callback(sourceFrame); 363 callback(sourceFrame);
364 else 364 else
365 InspectorTest.addSniffer(sourceFrame, "onTextEditorContentLoaded", callb ack && callback.bind(null, sourceFrame)); 365 InspectorTest.addSniffer(sourceFrame, "onTextEditorContentLoaded", callb ack && callback.bind(null, sourceFrame));
366 }; 366 };
367 367
368 InspectorTest.showScriptSource = function(scriptName, callback) 368 InspectorTest.showScriptSource = function(scriptName, callback)
369 { 369 {
370 InspectorTest.waitForScriptSource(scriptName, function(uiSourceCode) { Inspe ctorTest.showUISourceCode(uiSourceCode, callback); }); 370 InspectorTest.waitForScriptSource(scriptName, onScriptSource);
371
372 function onScriptSource(uiSourceCode)
373 {
374 InspectorTest.showUISourceCode(uiSourceCode, callback);
375 }
371 }; 376 };
372 377
373 InspectorTest.waitForScriptSource = function(scriptName, callback) 378 InspectorTest.waitForScriptSource = function(scriptName, callback)
374 { 379 {
375 var panel = WebInspector.panels.sources; 380 var panel = WebInspector.panels.sources;
376 var uiSourceCodes = panel._workspace.uiSourceCodes(); 381 var uiSourceCodes = panel._workspace.uiSourceCodes();
377 for (var i = 0; i < uiSourceCodes.length; ++i) { 382 for (var i = 0; i < uiSourceCodes.length; ++i) {
378 if (uiSourceCodes[i].project().type() === WebInspector.projectTypes.Serv ice) 383 if (uiSourceCodes[i].project().type() === WebInspector.projectTypes.Serv ice)
379 continue; 384 continue;
380 if (uiSourceCodes[i].name() === scriptName) { 385 if (uiSourceCodes[i].name() === scriptName) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent Script, source, target, preRegisterCallback) 506 InspectorTest.createScriptMock = function(url, startLine, startColumn, isContent Script, source, target, preRegisterCallback)
502 { 507 {
503 target = target || WebInspector.targetManager.mainTarget(); 508 target = target || WebInspector.targetManager.mainTarget();
504 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 509 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
505 var scriptId = ++InspectorTest._lastScriptId + ""; 510 var scriptId = ++InspectorTest._lastScriptId + "";
506 var lineCount = source.lineEndings().length; 511 var lineCount = source.lineEndings().length;
507 var endLine = startLine + lineCount - 1; 512 var endLine = startLine + lineCount - 1;
508 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt h - source.lineEndings()[lineCount - 2]; 513 var endColumn = lineCount === 1 ? startColumn + source.length : source.lengt h - source.lineEndings()[lineCount - 2];
509 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m); 514 var hasSourceURL = !!source.match(/\/\/#\ssourceURL=\s*(\S*?)\s*$/m);
510 var script = new WebInspector.Script(debuggerModel, scriptId, url, startLine , startColumn, endLine, endColumn, 0, isContentScript, false, false, undefined, hasSourceURL); 515 var script = new WebInspector.Script(debuggerModel, scriptId, url, startLine , startColumn, endLine, endColumn, 0, isContentScript, false, false, undefined, hasSourceURL);
511 script.requestContent = function(callback) 516 script.requestContent = function()
512 { 517 {
513 var trimmedSource = WebInspector.Script._trimSourceURLComment(source); 518 var trimmedSource = WebInspector.Script._trimSourceURLComment(source);
514 callback(trimmedSource, false, "text/javascript"); 519 return Promise.resolve(trimmedSource);
515 }; 520 };
516 if (preRegisterCallback) 521 if (preRegisterCallback)
517 preRegisterCallback(script); 522 preRegisterCallback(script);
518 debuggerModel._registerScript(script); 523 debuggerModel._registerScript(script);
519 return script; 524 return script;
520 }; 525 };
521 526
522 InspectorTest._lastScriptId = 0; 527 InspectorTest._lastScriptId = 0;
523 528
524 InspectorTest.checkRawLocation = function(script, lineNumber, columnNumber, loca tion) 529 InspectorTest.checkRawLocation = function(script, lineNumber, columnNumber, loca tion)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 568 }
564 569
565 InspectorTest.selectThread = function(target) 570 InspectorTest.selectThread = function(target)
566 { 571 {
567 var threadsPane = WebInspector.panels.sources.sidebarPanes.threads; 572 var threadsPane = WebInspector.panels.sources.sidebarPanes.threads;
568 var listItem = threadsPane._debuggerModelToListItems.get(WebInspector.Debugg erModel.fromTarget(target)); 573 var listItem = threadsPane._debuggerModelToListItems.get(WebInspector.Debugg erModel.fromTarget(target));
569 threadsPane._onListItemClick(listItem); 574 threadsPane._onListItemClick(listItem);
570 } 575 }
571 576
572 }; 577 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698