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

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

Issue 705063004: DevTools: Promisify WebInspector.TempFile (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: teste were fixed Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 var initialize_InspectorTest = function() { 1 var initialize_InspectorTest = function() {
2 2
3 var results = []; 3 var results = [];
4 4
5 function consoleOutputHook(messageType) 5 function consoleOutputHook(messageType)
6 { 6 {
7 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1)); 7 InspectorTest.addResult(messageType + ": " + Array.prototype.slice.call(argu ments, 1));
8 } 8 }
9 9
10 console.log = consoleOutputHook.bind(InspectorTest, "log"); 10 console.log = consoleOutputHook.bind(InspectorTest, "log");
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 438 }
439 }; 439 };
440 440
441 441
442 /** 442 /**
443 * @constructor 443 * @constructor
444 * @param {!string} dirPath 444 * @param {!string} dirPath
445 * @param {!string} name 445 * @param {!string} name
446 * @param {!function(?WebInspector.TempFile)} callback 446 * @param {!function(?WebInspector.TempFile)} callback
447 */ 447 */
448 InspectorTest.TempFileMock = function(dirPath, name, callback) 448 InspectorTest.TempFileMock = function(dirPath, name)
449 { 449 {
450 this._chunks = []; 450 this._chunks = [];
451 this._name = name; 451 this._name = name;
452 setTimeout(callback.bind(this, this), 1);
453 } 452 }
454 453
455 InspectorTest.TempFileMock.prototype = { 454 InspectorTest.TempFileMock.prototype = {
456 /** 455 /**
457 * @param {!Array.<string>} chunks 456 * @param {!Array.<string>} chunks
458 * @param {!function(boolean)} callback 457 * @param {!function(boolean)} callback
459 */ 458 */
460 write: function(chunks, callback) 459 write: function(chunks, callback)
461 { 460 {
462 this._chunks.push.apply(this._chunks, chunks); 461 this._chunks.push.apply(this._chunks, chunks);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 delegate.onTransferStarted(chunkedReaderMock); 519 delegate.onTransferStarted(chunkedReaderMock);
521 outputStream.write(text); 520 outputStream.write(text);
522 delegate.onChunkTransferred(chunkedReaderMock); 521 delegate.onChunkTransferred(chunkedReaderMock);
523 outputStream.close(); 522 outputStream.close();
524 delegate.onTransferFinished(chunkedReaderMock); 523 delegate.onTransferFinished(chunkedReaderMock);
525 }, 524 },
526 525
527 remove: function() { } 526 remove: function() { }
528 } 527 }
529 528
529 InspectorTest.TempFileMock.create = function(dirPath, name)
530 {
531 var tempFile = new InspectorTest.TempFileMock(dirPath, name);
532 return Promise.resolve(tempFile);
533 }
534
530 InspectorTest.dumpLoadedModules = function(next) 535 InspectorTest.dumpLoadedModules = function(next)
531 { 536 {
532 function moduleSorter(left, right) 537 function moduleSorter(left, right)
533 { 538 {
534 return String.naturalOrderComparator(left._descriptor.name, right._descr iptor.name); 539 return String.naturalOrderComparator(left._descriptor.name, right._descr iptor.name);
535 } 540 }
536 541
537 InspectorTest.addResult("Loaded modules:"); 542 InspectorTest.addResult("Loaded modules:");
538 var modules = self.runtime._modules; 543 var modules = self.runtime._modules;
539 modules.sort(moduleSorter); 544 modules.sort(moduleSorter);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 579
575 fireAllTimers: function() 580 fireAllTimers: function()
576 { 581 {
577 for (var timeoutId in this._timeoutIdToProcess) 582 for (var timeoutId in this._timeoutIdToProcess)
578 this._timeoutIdToProcess[timeoutId].call(window); 583 this._timeoutIdToProcess[timeoutId].call(window);
579 this._timeoutIdToProcess = {}; 584 this._timeoutIdToProcess = {};
580 this._timeoutIdToMillis = {}; 585 this._timeoutIdToMillis = {};
581 } 586 }
582 } 587 }
583 588
584 WebInspector.TempFile = InspectorTest.TempFileMock;
585
586 WebInspector.targetManager.observeTargets({ 589 WebInspector.targetManager.observeTargets({
587 targetAdded: function(target) 590 targetAdded: function(target)
588 { 591 {
589 if (!WebInspector.domModel) 592 if (!WebInspector.domModel)
590 WebInspector.domModel = target.domModel; 593 WebInspector.domModel = target.domModel;
591 if (!WebInspector.consoleModel) 594 if (!WebInspector.consoleModel)
592 WebInspector.consoleModel = target.consoleModel; 595 WebInspector.consoleModel = target.consoleModel;
593 if (!WebInspector.networkManager) 596 if (!WebInspector.networkManager)
594 WebInspector.networkManager = target.networkManager; 597 WebInspector.networkManager = target.networkManager;
595 if (!WebInspector.timelineManager) 598 if (!WebInspector.timelineManager)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 _output("[page] " + text); 808 _output("[page] " + text);
806 } 809 }
807 810
808 function _output(result) 811 function _output(result)
809 { 812 {
810 if (!outputElement) 813 if (!outputElement)
811 createOutputElement(); 814 createOutputElement();
812 outputElement.appendChild(document.createTextNode(result)); 815 outputElement.appendChild(document.createTextNode(result));
813 outputElement.appendChild(document.createElement("br")); 816 outputElement.appendChild(document.createElement("br"));
814 } 817 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698