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

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

Issue 2958403002: [WIP] DevTools: move UISourceCode creation into ResourceScriptMapping
Patch Set: pass everything but breakpointmanager Created 3 years, 5 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 if (window.GCController) 1 if (window.GCController)
2 GCController.collectAll(); 2 GCController.collectAll();
3 3
4 var initialize_InspectorTest = function() { 4 var initialize_InspectorTest = function() {
5 Protocol.InspectorBackend.Options.suppressRequestErrors = true; 5 Protocol.InspectorBackend.Options.suppressRequestErrors = true;
6 var results = []; 6 var results = [];
7 7
8 function consoleOutputHook(messageType) 8 function consoleOutputHook(messageType)
9 { 9 {
10 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1)); 10 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }); 52 });
53 if (!response[Protocol.Error]) 53 if (!response[Protocol.Error])
54 InspectorTest.safeWrap(callback)(InspectorTest.runtimeModel.createRemote Object(response.result), response.exceptionDetails); 54 InspectorTest.safeWrap(callback)(InspectorTest.runtimeModel.createRemote Object(response.result), response.exceptionDetails);
55 } 55 }
56 56
57 InspectorTest.addScriptUISourceCode = function(url, content, isContentScript, wo rldId) { 57 InspectorTest.addScriptUISourceCode = function(url, content, isContentScript, wo rldId) {
58 content += '\n//# sourceURL=' + url; 58 content += '\n//# sourceURL=' + url;
59 if (isContentScript) 59 if (isContentScript)
60 content = `testRunner.evaluateScriptInIsolatedWorld(${worldId}, \`${cont ent}\`)`; 60 content = `testRunner.evaluateScriptInIsolatedWorld(${worldId}, \`${cont ent}\`)`;
61 InspectorTest.evaluateInPagePromise(content); 61 InspectorTest.evaluateInPagePromise(content);
62 return InspectorTest.waitForUISourceCode(url); 62 return InspectorTest.waitForUISourceCode(url, isContentScript ? Workspace.pr ojectTypes.ContentScripts : Workspace.projectTypes.Network);
63 } 63 }
64 64
65 InspectorTest.addScriptForFrame = function(url, content, frame) { 65 InspectorTest.addScriptForFrame = function(url, content, frame) {
66 content += '\n//# sourceURL=' + url; 66 content += '\n//# sourceURL=' + url;
67 var executionContext = InspectorTest.runtimeModel.executionContexts().find(c ontext => context.frameId === frame.id); 67 var executionContext = InspectorTest.runtimeModel.executionContexts().find(c ontext => context.frameId === frame.id);
68 InspectorTest.RuntimeAgent.evaluate(content, "console", false, false, execut ionContext.id); 68 InspectorTest.RuntimeAgent.evaluate(content, "console", false, false, execut ionContext.id);
69 } 69 }
70 70
71 InspectorTest.evaluateInPagePromise = function(code) 71 InspectorTest.evaluateInPagePromise = function(code)
72 { 72 {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 { 458 {
459 if (projectType && uiSourceCode.project().type() !== projectType) 459 if (projectType && uiSourceCode.project().type() !== projectType)
460 return false; 460 return false;
461 if (!projectType && uiSourceCode.project().type() === Workspace.projectT ypes.Service) 461 if (!projectType && uiSourceCode.project().type() === Workspace.projectT ypes.Service)
462 return false; 462 return false;
463 if (urlSuffix && !uiSourceCode.url().endsWith(urlSuffix)) 463 if (urlSuffix && !uiSourceCode.url().endsWith(urlSuffix))
464 return false; 464 return false;
465 return true; 465 return true;
466 } 466 }
467 467
468 projectType = projectType || Workspace.projectTypes.Network;
468 for (var uiSourceCode of Workspace.workspace.uiSourceCodes()) { 469 for (var uiSourceCode of Workspace.workspace.uiSourceCodes()) {
469 if (urlSuffix && matches(uiSourceCode)) 470 if (urlSuffix && matches(uiSourceCode))
470 return Promise.resolve(uiSourceCode); 471 return Promise.resolve(uiSourceCode);
471 } 472 }
472 473
473 return InspectorTest.waitForEvent(Workspace.Workspace.Events.UISourceCodeAdd ed, Workspace.workspace, matches); 474 return InspectorTest.waitForEvent(Workspace.Workspace.Events.UISourceCodeAdd ed, Workspace.workspace, matches);
474 } 475 }
475 476
476 InspectorTest.waitForUISourceCodeRemoved = function(callback) 477 InspectorTest.waitForUISourceCodeRemoved = function(callback)
477 { 478 {
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 _output("[page] " + text); 1284 _output("[page] " + text);
1284 } 1285 }
1285 1286
1286 function _output(result) 1287 function _output(result)
1287 { 1288 {
1288 if (!outputElement) 1289 if (!outputElement)
1289 createOutputElement(); 1290 createOutputElement();
1290 outputElement.appendChild(document.createTextNode(result)); 1291 outputElement.appendChild(document.createTextNode(result));
1291 outputElement.appendChild(document.createElement("br")); 1292 outputElement.appendChild(document.createElement("br"));
1292 } 1293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698