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

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

Issue 2533073003: [DevTools] Remove workspace-test.js part1. (Closed)
Patch Set: Created 4 years 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 var initialize_InspectorTest = function() { 3 var initialize_InspectorTest = function() {
4 4
5 var results = []; 5 var results = [];
6 6
7 function consoleOutputHook(messageType) 7 function consoleOutputHook(messageType)
8 { 8 {
9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1)); 9 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1));
10 } 10 }
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 { 394 {
395 InspectorTest.addResult(view instanceof Sources.SourcesNavigatorView ? "Sour ces:" : "Content Scripts:"); 395 InspectorTest.addResult(view instanceof Sources.SourcesNavigatorView ? "Sour ces:" : "Content Scripts:");
396 view._groupByFrame = mode.includes("frame"); 396 view._groupByFrame = mode.includes("frame");
397 view._groupByDomain = mode.includes("domain"); 397 view._groupByDomain = mode.includes("domain");
398 view._groupByFolder = mode.includes("folder"); 398 view._groupByFolder = mode.includes("folder");
399 view._resetForTest(); 399 view._resetForTest();
400 InspectorTest.addResult("-------- Setting mode: [" + mode + "]"); 400 InspectorTest.addResult("-------- Setting mode: [" + mode + "]");
401 InspectorTest.dumpNavigatorView(view); 401 InspectorTest.dumpNavigatorView(view);
402 } 402 }
403 403
404 InspectorTest.waitForUISourceCode = function(callback, url, projectType)
405 {
406 function matches(uiSourceCode)
407 {
408 if (projectType && uiSourceCode.project().type() !== projectType)
409 return false;
410 if (!projectType && uiSourceCode.project().type() === Workspace.projectT ypes.Service)
411 return false;
412 if (url && !uiSourceCode.url().endsWith(url))
413 return false;
414 return true;
415 }
416
417 for (var uiSourceCode of Workspace.workspace.uiSourceCodes()) {
418 if (url && matches(uiSourceCode)) {
419 callback(uiSourceCode);
420 return;
421 }
422 }
423
424 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode Added, uiSourceCodeAdded);
425 function uiSourceCodeAdded(event)
426 {
427 if (!matches(event.data))
428 return;
429 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou rceCodeAdded, uiSourceCodeAdded);
430 callback(event.data);
431 }
432 }
433
434 InspectorTest.waitForUISourceCodeRemoved = function(callback)
435 {
436 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode Removed, uiSourceCodeRemoved);
437 function uiSourceCodeRemoved(event)
438 {
439 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou rceCodeRemoved, uiSourceCodeRemoved);
440 callback(event.data);
441 }
442 }
443
444 InspectorTest.createMockTarget = function(name, capabilities)
445 {
lushnikov 2016/11/29 00:27:21 capabilities = capabilities || Object.values(SDK.T
dgozman 2016/11/29 00:33:43 I like the constant more :-)
446 return SDK.targetManager.createTarget(name, capabilities || SDK.Target.Capab ility.AllForTests, params => new SDK.StubConnection(params), null);
447 }
448
404 InspectorTest.assertGreaterOrEqual = function(a, b, message) 449 InspectorTest.assertGreaterOrEqual = function(a, b, message)
405 { 450 {
406 if (a < b) 451 if (a < b)
407 InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + a + " < " + b); 452 InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + a + " < " + b);
408 } 453 }
409 454
410 InspectorTest.navigate = function(url, callback) 455 InspectorTest.navigate = function(url, callback)
411 { 456 {
412 InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback); 457 InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback);
413 InspectorTest.evaluateInPage("window.location.replace('" + url + "')"); 458 InspectorTest.evaluateInPage("window.location.replace('" + url + "')");
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 _output("[page] " + text); 1218 _output("[page] " + text);
1174 } 1219 }
1175 1220
1176 function _output(result) 1221 function _output(result)
1177 { 1222 {
1178 if (!outputElement) 1223 if (!outputElement)
1179 createOutputElement(); 1224 createOutputElement();
1180 outputElement.appendChild(document.createTextNode(result)); 1225 outputElement.appendChild(document.createTextNode(result));
1181 outputElement.appendChild(document.createElement("br")); 1226 outputElement.appendChild(document.createElement("br"));
1182 } 1227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698