OLD | NEW |
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 InspectorTest.waitForUISourceCodeRemoved = function(callback) | 462 InspectorTest.waitForUISourceCodeRemoved = function(callback) |
463 { | 463 { |
464 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode
Removed, uiSourceCodeRemoved); | 464 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode
Removed, uiSourceCodeRemoved); |
465 function uiSourceCodeRemoved(event) | 465 function uiSourceCodeRemoved(event) |
466 { | 466 { |
467 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou
rceCodeRemoved, uiSourceCodeRemoved); | 467 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou
rceCodeRemoved, uiSourceCodeRemoved); |
468 callback(event.data); | 468 callback(event.data); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
| 472 InspectorTest.waitForTarget = function(filter) { |
| 473 filter = filter || (target => true); |
| 474 for (var target of SDK.targetManager.targets()) { |
| 475 if (filter(target)) |
| 476 return Promise.resolve(target); |
| 477 } |
| 478 var fulfill; |
| 479 var promise = new Promise(callback => fulfill = callback); |
| 480 var observer = { |
| 481 targetAdded: function(target) { |
| 482 if (filter(target)) { |
| 483 SDK.targetManager.unobserveTargets(observer); |
| 484 fulfill(target); |
| 485 } |
| 486 }, |
| 487 targetRemoved: function() { |
| 488 }, |
| 489 }; |
| 490 SDK.targetManager.observeTargets(observer); |
| 491 return promise; |
| 492 } |
| 493 |
| 494 InspectorTest.waitForExecutionContext = function(runtimeModel) { |
| 495 if (runtimeModel.executionContexts().length) |
| 496 return Promise.resolve(runtimeModel.executionContexts()[0]); |
| 497 var fulfill; |
| 498 var promise = new Promise(callback => fulfill = callback); |
| 499 function onContext(event) { |
| 500 runtimeModel.removeEventListener(SDK.RuntimeModel.Events.ExecutionContextC
reated, onContext); |
| 501 fulfill(event.data); |
| 502 } |
| 503 runtimeModel.addEventListener(SDK.RuntimeModel.Events.ExecutionContextCreate
d, onContext); |
| 504 return promise; |
| 505 } |
| 506 |
| 507 InspectorTest.waitForExecutionContextDestroyed = function(context) { |
| 508 var runtimeModel = context.runtimeModel; |
| 509 if (runtimeModel.executionContexts().indexOf(context) === -1) |
| 510 return Promise.resolve(); |
| 511 var fulfill; |
| 512 var promise = new Promise(callback => fulfill = callback); |
| 513 function onContext(event) { |
| 514 if (event.data === context) { |
| 515 runtimeModel.removeEventListener(SDK.RuntimeModel.Events.ExecutionCo
ntextDestroyed, onContext); |
| 516 fulfill(); |
| 517 } |
| 518 } |
| 519 runtimeModel.addEventListener(SDK.RuntimeModel.Events.ExecutionContextDestro
yed, onContext); |
| 520 return promise; |
| 521 } |
| 522 |
472 InspectorTest.assertGreaterOrEqual = function(a, b, message) | 523 InspectorTest.assertGreaterOrEqual = function(a, b, message) |
473 { | 524 { |
474 if (a < b) | 525 if (a < b) |
475 InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + a
+ " < " + b); | 526 InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + a
+ " < " + b); |
476 } | 527 } |
477 | 528 |
478 InspectorTest.navigate = function(url, callback) | 529 InspectorTest.navigate = function(url, callback) |
479 { | 530 { |
480 InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback); | 531 InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback); |
481 InspectorTest.evaluateInPage("window.location.replace('" + url + "')"); | 532 InspectorTest.evaluateInPage("window.location.replace('" + url + "')"); |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 _output("[page] " + text); | 1299 _output("[page] " + text); |
1249 } | 1300 } |
1250 | 1301 |
1251 function _output(result) | 1302 function _output(result) |
1252 { | 1303 { |
1253 if (!outputElement) | 1304 if (!outputElement) |
1254 createOutputElement(); | 1305 createOutputElement(); |
1255 outputElement.appendChild(document.createTextNode(result)); | 1306 outputElement.appendChild(document.createTextNode(result)); |
1256 outputElement.appendChild(document.createElement("br")); | 1307 outputElement.appendChild(document.createElement("br")); |
1257 } | 1308 } |
OLD | NEW |