OLD | NEW |
1 var initialize_InspectorTest = function() { | 1 var initialize_InspectorTest = function() { |
2 | 2 |
3 var results = []; | 3 var results = []; |
4 var resultsSynchronized = false; | 4 var resultsSynchronized = false; |
5 | 5 |
6 function consoleOutputHook(messageType) | 6 function consoleOutputHook(messageType) |
7 { | 7 { |
8 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); | 8 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu
ments, 1)); |
9 } | 9 } |
10 | 10 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 InspectorTest.MockSetting.prototype = { | 447 InspectorTest.MockSetting.prototype = { |
448 get: function() { | 448 get: function() { |
449 return this._value; | 449 return this._value; |
450 }, | 450 }, |
451 | 451 |
452 set: function(value) { | 452 set: function(value) { |
453 this._value = value; | 453 this._value = value; |
454 } | 454 } |
455 }; | 455 }; |
456 | 456 |
| 457 |
| 458 /** |
| 459 * @constructor |
| 460 * @param {!string} dirPath |
| 461 * @param {!string} name |
| 462 * @param {!function(?WebInspector.TempFile)} callback |
| 463 */ |
| 464 InspectorTest.TempFileMock = function(dirPath, name, callback) |
| 465 { |
| 466 this._chunks = []; |
| 467 this._name = name; |
| 468 setTimeout(callback.bind(this, this), 0); |
| 469 } |
| 470 |
| 471 InspectorTest.TempFileMock.prototype = { |
| 472 /** |
| 473 * @param {!string} data |
| 474 * @param {!function(boolean)} callback |
| 475 */ |
| 476 write: function(data, callback) |
| 477 { |
| 478 this._chunks.push(data); |
| 479 setTimeout(callback.bind(this, true), 0); |
| 480 }, |
| 481 |
| 482 finishWriting: function() { }, |
| 483 |
| 484 /** |
| 485 * @param {function(?string)} callback |
| 486 */ |
| 487 read: function(callback) |
| 488 { |
| 489 callback(this._chunks.join("")); |
| 490 }, |
| 491 |
| 492 /** |
| 493 * @param {!WebInspector.OutputStream} outputStream |
| 494 * @param {!WebInspector.OutputStreamDelegate} delegate |
| 495 */ |
| 496 writeToOutputSteam: function(outputStream, delegate) |
| 497 { |
| 498 var name = this._name; |
| 499 var text = this._chunks.join(""); |
| 500 var chunkedReaderMock = { |
| 501 loadedSize: function() |
| 502 { |
| 503 return text.length; |
| 504 }, |
| 505 |
| 506 fileSize: function() |
| 507 { |
| 508 return text.length; |
| 509 }, |
| 510 |
| 511 fileName: function() |
| 512 { |
| 513 return name; |
| 514 }, |
| 515 |
| 516 cancel: function() { } |
| 517 } |
| 518 delegate.onTransferStarted(chunkedReaderMock); |
| 519 outputStream.write(text); |
| 520 delegate.onChunkTransferred(chunkedReaderMock); |
| 521 outputStream.close(); |
| 522 delegate.onTransferFinished(chunkedReaderMock); |
| 523 }, |
| 524 |
| 525 remove: function() { } |
| 526 } |
| 527 |
| 528 WebInspector.TempFile = InspectorTest.TempFileMock; |
| 529 |
457 }; | 530 }; |
458 | 531 |
459 var initializeCallId = 0; | 532 var initializeCallId = 0; |
460 var runTestCallId = 1; | 533 var runTestCallId = 1; |
461 var completeTestCallId = 2; | 534 var completeTestCallId = 2; |
462 var frontendReopeningCount = 0; | 535 var frontendReopeningCount = 0; |
463 | 536 |
464 function reopenFrontend() | 537 function reopenFrontend() |
465 { | 538 { |
466 closeFrontend(openFrontendAndIncrement); | 539 closeFrontend(openFrontendAndIncrement); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 evaluateInWebInspector: function(callId, script) | 714 evaluateInWebInspector: function(callId, script) |
642 { | 715 { |
643 window.opener.postMessage(["evaluateInWebInspector", callId, script], "*
"); | 716 window.opener.postMessage(["evaluateInWebInspector", callId, script], "*
"); |
644 }, | 717 }, |
645 | 718 |
646 display: function() { } | 719 display: function() { } |
647 } | 720 } |
648 | 721 |
649 if (!window.testRunner && window.opener) | 722 if (!window.testRunner && window.opener) |
650 window.testRunner = new StandaloneTestRunnerStub(); | 723 window.testRunner = new StandaloneTestRunnerStub(); |
OLD | NEW |