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

Side by Side Diff: LayoutTests/inspector/profiler/heap-snapshot-test.js

Issue 268293003: DevTools: Get rid of WebInspector.panels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months 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_HeapSnapshotTest = function() { 1 var initialize_HeapSnapshotTest = function() {
2 2
3 InspectorTest.createHeapSnapshotMockFactories = function() { 3 InspectorTest.createHeapSnapshotMockFactories = function() {
4 4
5 InspectorTest.createJSHeapSnapshotMockObject = function() 5 InspectorTest.createJSHeapSnapshotMockObject = function()
6 { 6 {
7 return { 7 return {
8 _rootNodeIndex: 0, 8 _rootNodeIndex: 0,
9 _nodeTypeOffset: 0, 9 _nodeTypeOffset: 0,
10 _nodeNameOffset: 1, 10 _nodeNameOffset: 1,
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 InspectorTest.startProfilerTest = function(callback) 412 InspectorTest.startProfilerTest = function(callback)
413 { 413 {
414 WebInspector.inspectorView.showPanel("profiles"); 414 WebInspector.inspectorView.showPanel("profiles");
415 WebInspector.settings.showAdvancedHeapSnapshotProperties.set(true); 415 WebInspector.settings.showAdvancedHeapSnapshotProperties.set(true);
416 416
417 InspectorTest.addResult("Profiler was enabled."); 417 InspectorTest.addResult("Profiler was enabled.");
418 // We mock out HeapProfilerAgent -- as DRT runs in single-process mode, Insp ector 418 // We mock out HeapProfilerAgent -- as DRT runs in single-process mode, Insp ector
419 // and test share the same heap. Taking a snapshot takes too long for a test , 419 // and test share the same heap. Taking a snapshot takes too long for a test ,
420 // so we provide synthetic snapshots. 420 // so we provide synthetic snapshots.
421 InspectorTest._panelReset = InspectorTest.override(WebInspector.panels.profi les, "_reset", function(){}, true); 421 InspectorTest._panelReset = InspectorTest.override(WebInspector.inspectorVie w.panel("profiles"), "_reset", function(){}, true);
422 InspectorTest.addSniffer(WebInspector.HeapSnapshotView.prototype, "show", In spectorTest._snapshotViewShown, true); 422 InspectorTest.addSniffer(WebInspector.HeapSnapshotView.prototype, "show", In spectorTest._snapshotViewShown, true);
423 423
424 // Reduce the number of populated nodes to speed up testing. 424 // Reduce the number of populated nodes to speed up testing.
425 WebInspector.HeapSnapshotContainmentDataGrid.prototype.defaultPopulateCount = function() { return 10; }; 425 WebInspector.HeapSnapshotContainmentDataGrid.prototype.defaultPopulateCount = function() { return 10; };
426 WebInspector.HeapSnapshotConstructorsDataGrid.prototype.defaultPopulateCount = function() { return 10; }; 426 WebInspector.HeapSnapshotConstructorsDataGrid.prototype.defaultPopulateCount = function() { return 10; };
427 WebInspector.HeapSnapshotDiffDataGrid.prototype.defaultPopulateCount = funct ion() { return 5; }; 427 WebInspector.HeapSnapshotDiffDataGrid.prototype.defaultPopulateCount = funct ion() { return 5; };
428 WebInspector.HeapSnapshotDominatorsDataGrid.prototype.defaultPopulateCount = function() { return 3; } 428 WebInspector.HeapSnapshotDominatorsDataGrid.prototype.defaultPopulateCount = function() { return 3; }
429 InspectorTest.addResult("Detailed heap profiles were enabled."); 429 InspectorTest.addResult("Detailed heap profiles were enabled.");
430 InspectorTest.safeWrap(callback)(); 430 InspectorTest.safeWrap(callback)();
431 }; 431 };
(...skipping 17 matching lines...) Expand all
449 if (completeTestStack) 449 if (completeTestStack)
450 InspectorTest.addResult("FAIL: test already completed at " + com pleteTestStack); 450 InspectorTest.addResult("FAIL: test already completed at " + com pleteTestStack);
451 InspectorTest.completeProfilerTest(); 451 InspectorTest.completeProfilerTest();
452 completeTestStack = new Error().stack; 452 completeTestStack = new Error().stack;
453 return; 453 return;
454 } 454 }
455 455
456 var nextTest = testSuiteTests.shift(); 456 var nextTest = testSuiteTests.shift();
457 InspectorTest.addResult(""); 457 InspectorTest.addResult("");
458 InspectorTest.addResult("Running: " + /function\s([^(]*)/.exec(nextTest) [1]); 458 InspectorTest.addResult("Running: " + /function\s([^(]*)/.exec(nextTest) [1]);
459 InspectorTest._panelReset.call(WebInspector.panels.profiles); 459 InspectorTest._panelReset.call(WebInspector.inspectorView.panel("profile s"));
460 InspectorTest.safeWrap(nextTest)(runner, runner); 460 InspectorTest.safeWrap(nextTest)(runner, runner);
461 } 461 }
462 462
463 InspectorTest.startProfilerTest(runner); 463 InspectorTest.startProfilerTest(runner);
464 }; 464 };
465 465
466 InspectorTest.assertColumnContentsEqual = function(reference, actual) 466 InspectorTest.assertColumnContentsEqual = function(reference, actual)
467 { 467 {
468 var length = Math.min(reference.length, actual.length); 468 var length = Math.min(reference.length, actual.length);
469 for (var i = 0; i < length; ++i) 469 for (var i = 0; i < length; ++i)
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 for (var node = parent.children[0]; node; node = node.traverseNextNode(true, parent, true)) { 668 for (var node = parent.children[0]; node; node = node.traverseNextNode(true, parent, true)) {
669 if (matcher(node)) 669 if (matcher(node))
670 return node; 670 return node;
671 } 671 }
672 return null; 672 return null;
673 }; 673 };
674 674
675 InspectorTest.switchToView = function(title, callback) 675 InspectorTest.switchToView = function(title, callback)
676 { 676 {
677 callback = InspectorTest.safeWrap(callback); 677 callback = InspectorTest.safeWrap(callback);
678 var view = WebInspector.panels.profiles.visibleView; 678 var view = WebInspector.inspectorView.panel("profiles").visibleView;
679 view._changePerspectiveAndWait(title, callback); 679 view._changePerspectiveAndWait(title, callback);
680 // Increase the grid container height so the viewport don't limit the number of nodes. 680 // Increase the grid container height so the viewport don't limit the number of nodes.
681 InspectorTest._currentGrid().scrollContainer.style.height = "10000px"; 681 InspectorTest._currentGrid().scrollContainer.style.height = "10000px";
682 }; 682 };
683 683
684 InspectorTest.takeAndOpenSnapshot = function(generator, callback) 684 InspectorTest.takeAndOpenSnapshot = function(generator, callback)
685 { 685 {
686 callback = InspectorTest.safeWrap(callback); 686 callback = InspectorTest.safeWrap(callback);
687 var snapshot = generator(); 687 var snapshot = generator();
688 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotPro fileType; 688 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotPro fileType;
(...skipping 13 matching lines...) Expand all
702 profileType._takeHeapSnapshot(function() { }); 702 profileType._takeHeapSnapshot(function() { });
703 }; 703 };
704 704
705 InspectorTest.viewColumns = function() 705 InspectorTest.viewColumns = function()
706 { 706 {
707 return InspectorTest._currentGrid()._columnsArray; 707 return InspectorTest._currentGrid()._columnsArray;
708 }; 708 };
709 709
710 InspectorTest.currentProfileView = function() 710 InspectorTest.currentProfileView = function()
711 { 711 {
712 return WebInspector.panels.profiles.visibleView; 712 return WebInspector.inspectorView.panel("profiles").visibleView;
713 }; 713 };
714 714
715 InspectorTest._currentGrid = function() 715 InspectorTest._currentGrid = function()
716 { 716 {
717 return this.currentProfileView()._dataGrid; 717 return this.currentProfileView()._dataGrid;
718 }; 718 };
719 719
720 InspectorTest._snapshotViewShown = function() 720 InspectorTest._snapshotViewShown = function()
721 { 721 {
722 if (InspectorTest._takeAndOpenSnapshotCallback) { 722 if (InspectorTest._takeAndOpenSnapshotCallback) {
723 var callback = InspectorTest._takeAndOpenSnapshotCallback; 723 var callback = InspectorTest._takeAndOpenSnapshotCallback;
724 InspectorTest._takeAndOpenSnapshotCallback = null; 724 InspectorTest._takeAndOpenSnapshotCallback = null;
725 var dataGrid = this._dataGrid; 725 var dataGrid = this._dataGrid;
726 function sortingComplete() 726 function sortingComplete()
727 { 727 {
728 dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGr id.Events.SortingComplete, sortingComplete, null); 728 dataGrid.removeEventListener(WebInspector.HeapSnapshotSortableDataGr id.Events.SortingComplete, sortingComplete, null);
729 callback(); 729 callback();
730 } 730 }
731 dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Even ts.SortingComplete, sortingComplete, null); 731 dataGrid.addEventListener(WebInspector.HeapSnapshotSortableDataGrid.Even ts.SortingComplete, sortingComplete, null);
732 } 732 }
733 }; 733 };
734 734
735 }; 735 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698