| OLD | NEW |
| 1 var initialize_ConsoleTest = function() { | 1 var initialize_ConsoleTest = function() { |
| 2 | 2 |
| 3 InspectorTest.preloadModule("source_frame"); | 3 InspectorTest.preloadModule("source_frame"); |
| 4 InspectorTest.preloadPanel("console"); | 4 InspectorTest.preloadPanel("console"); |
| 5 | 5 |
| 6 InspectorTest.selectMainExecutionContext = function() | 6 InspectorTest.selectMainExecutionContext = function() |
| 7 { | 7 { |
| 8 var executionContexts = InspectorTest.mainTarget.runtimeModel.executionConte
xts(); | 8 var executionContexts = InspectorTest.mainTarget.runtimeModel.executionConte
xts(); |
| 9 for (var context of executionContexts) { | 9 for (var context of executionContexts) { |
| 10 if (context.isDefault) { | 10 if (context.isDefault) { |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 InspectorTest.addResult("FAILED: didn't find _parameters field in th
e message."); | 361 InspectorTest.addResult("FAILED: didn't find _parameters field in th
e message."); |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 | 365 |
| 366 InspectorTest.waitUntilMessageReceived = function(callback) | 366 InspectorTest.waitUntilMessageReceived = function(callback) |
| 367 { | 367 { |
| 368 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", callback,
false); | 368 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", callback,
false); |
| 369 } | 369 } |
| 370 | 370 |
| 371 InspectorTest.waitUntilMessageReceivedPromise = function() |
| 372 { |
| 373 var callback; |
| 374 var promise = new Promise((fullfill) => callback = fullfill); |
| 375 InspectorTest.waitUntilMessageReceived(callback); |
| 376 return promise; |
| 377 } |
| 378 |
| 371 InspectorTest.waitUntilNthMessageReceived = function(count, callback) | 379 InspectorTest.waitUntilNthMessageReceived = function(count, callback) |
| 372 { | 380 { |
| 373 function override() | 381 function override() |
| 374 { | 382 { |
| 375 if (--count === 0) | 383 if (--count === 0) |
| 376 InspectorTest.safeWrap(callback)(); | 384 InspectorTest.safeWrap(callback)(); |
| 377 else | 385 else |
| 378 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", o
verride, false); | 386 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", o
verride, false); |
| 379 } | 387 } |
| 380 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", override,
false); | 388 InspectorTest.addSniffer(InspectorTest.consoleModel, "addMessage", override,
false); |
| 381 } | 389 } |
| 382 | 390 |
| 391 InspectorTest.waitUntilNthMessageReceivedPromise = function(count) |
| 392 { |
| 393 var callback; |
| 394 var promise = new Promise((fullfill) => callback = fullfill); |
| 395 InspectorTest.waitUntilNthMessageReceived(count, callback); |
| 396 return promise; |
| 397 } |
| 398 |
| 383 InspectorTest.changeExecutionContext = function(namePrefix) | 399 InspectorTest.changeExecutionContext = function(namePrefix) |
| 384 { | 400 { |
| 385 var selector = WebInspector.ConsoleView.instance()._executionContextModel._s
electElement; | 401 var selector = WebInspector.ConsoleView.instance()._executionContextModel._s
electElement; |
| 386 var option = selector.firstChild; | 402 var option = selector.firstChild; |
| 387 while (option) { | 403 while (option) { |
| 388 if (option.textContent && option.textContent.startsWith(namePrefix)) | 404 if (option.textContent && option.textContent.startsWith(namePrefix)) |
| 389 break; | 405 break; |
| 390 option = option.nextSibling; | 406 option = option.nextSibling; |
| 391 } | 407 } |
| 392 if (!option) { | 408 if (!option) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 407 if (consoleView._visibleViewMessages.length === expectedCount) { | 423 if (consoleView._visibleViewMessages.length === expectedCount) { |
| 408 InspectorTest.addResult("Message count: " + expectedCount); | 424 InspectorTest.addResult("Message count: " + expectedCount); |
| 409 callback(); | 425 callback(); |
| 410 } else { | 426 } else { |
| 411 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); | 427 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch
eckAndReturn); |
| 412 } | 428 } |
| 413 } | 429 } |
| 414 } | 430 } |
| 415 | 431 |
| 416 } | 432 } |
| OLD | NEW |