| OLD | NEW |
| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 InspectorTest.completeProfilerTest = function() | 426 InspectorTest.completeProfilerTest = function() |
| 427 { | 427 { |
| 428 // There is no way to disable detailed heap profiles. | 428 // There is no way to disable detailed heap profiles. |
| 429 InspectorTest.addResult(""); | 429 InspectorTest.addResult(""); |
| 430 InspectorTest.addResult("Profiler was disabled."); | 430 InspectorTest.addResult("Profiler was disabled."); |
| 431 InspectorTest.completeTest(); | 431 InspectorTest.completeTest(); |
| 432 }; | 432 }; |
| 433 | 433 |
| 434 InspectorTest.runHeapSnapshotTestSuite = function(testSuite) | 434 InspectorTest.runHeapSnapshotTestSuite = function(testSuite) |
| 435 { | 435 { |
| 436 InspectorTest._nextUid = 1; | |
| 437 var testSuiteTests = testSuite.slice(); | 436 var testSuiteTests = testSuite.slice(); |
| 438 var completeTestStack; | 437 var completeTestStack; |
| 439 | 438 |
| 440 function runner() | 439 function runner() |
| 441 { | 440 { |
| 442 if (!testSuiteTests.length) { | 441 if (!testSuiteTests.length) { |
| 443 if (completeTestStack) | 442 if (completeTestStack) |
| 444 InspectorTest.addResult("FAIL: test already completed at " + com
pleteTestStack); | 443 InspectorTest.addResult("FAIL: test already completed at " + com
pleteTestStack); |
| 445 InspectorTest.completeProfilerTest(); | 444 InspectorTest.completeProfilerTest(); |
| 446 completeTestStack = new Error().stack; | 445 completeTestStack = new Error().stack; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 InspectorTest.switchToView = function(title, callback) | 687 InspectorTest.switchToView = function(title, callback) |
| 689 { | 688 { |
| 690 callback = InspectorTest.safeWrap(callback); | 689 callback = InspectorTest.safeWrap(callback); |
| 691 var view = WebInspector.panels.profiles.visibleView; | 690 var view = WebInspector.panels.profiles.visibleView; |
| 692 view.changeView(title, callback); | 691 view.changeView(title, callback); |
| 693 }; | 692 }; |
| 694 | 693 |
| 695 InspectorTest.takeAndOpenSnapshot = function(generator, callback) | 694 InspectorTest.takeAndOpenSnapshot = function(generator, callback) |
| 696 { | 695 { |
| 697 callback = InspectorTest.safeWrap(callback); | 696 callback = InspectorTest.safeWrap(callback); |
| 698 var uid = InspectorTest._nextUid++; | |
| 699 var snapshot = generator(); | 697 var snapshot = generator(); |
| 700 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotPro
fileType; | 698 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotPro
fileType; |
| 701 var profile = new WebInspector.HeapProfileHeader(profileType, "Mock snapshot
#" + uid, uid); | 699 function pushGeneratedSnapshot(reportProgress, callback) |
| 702 function pushGeneratedSnapshot(uid, callback) | |
| 703 { | 700 { |
| 701 var profile = profileType.profileBeingRecorded(); |
| 702 if (reportProgress) { |
| 703 profileType.reportHeapSnapshotProgress(50, 100, false); |
| 704 profileType.reportHeapSnapshotProgress(100, 100, true); |
| 705 } |
| 704 snapshot.snapshot.typeId = "HEAP"; | 706 snapshot.snapshot.typeId = "HEAP"; |
| 705 snapshot.snapshot.title = profile.title; | 707 profileType.addHeapSnapshotChunk(profile.uid, JSON.stringify(snapshot)); |
| 706 snapshot.snapshot.uid = profile.uid; | |
| 707 profileType.addHeapSnapshotChunk(uid, JSON.stringify(snapshot)); | |
| 708 setTimeout(callback, 0); | 708 setTimeout(callback, 0); |
| 709 } | 709 } |
| 710 InspectorTest.override(HeapProfilerAgent, "getHeapSnapshot", pushGeneratedSn
apshot); | 710 InspectorTest.override(HeapProfilerAgent, "takeHeapSnapshot", pushGeneratedS
napshot); |
| 711 InspectorTest._takeAndOpenSnapshotCallback = callback; | 711 InspectorTest._takeAndOpenSnapshotCallback = callback; |
| 712 profileType.addProfile(profile); | 712 profileType._takeHeapSnapshot(function() { }); |
| 713 WebInspector.panels.profiles.showProfile(profile); | |
| 714 }; | 713 }; |
| 715 | 714 |
| 716 InspectorTest.viewColumns = function() | 715 InspectorTest.viewColumns = function() |
| 717 { | 716 { |
| 718 return InspectorTest._currentGrid()._columnsArray; | 717 return InspectorTest._currentGrid()._columnsArray; |
| 719 }; | 718 }; |
| 720 | 719 |
| 721 InspectorTest.currentProfileView = function() | 720 InspectorTest.currentProfileView = function() |
| 722 { | 721 { |
| 723 return WebInspector.panels.profiles.visibleView; | 722 return WebInspector.panels.profiles.visibleView; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 737 function sortingComplete() | 736 function sortingComplete() |
| 738 { | 737 { |
| 739 dataGrid.removeEventListener("sorting complete", sortingComplete, nu
ll); | 738 dataGrid.removeEventListener("sorting complete", sortingComplete, nu
ll); |
| 740 callback(); | 739 callback(); |
| 741 } | 740 } |
| 742 dataGrid.addEventListener("sorting complete", sortingComplete, null); | 741 dataGrid.addEventListener("sorting complete", sortingComplete, null); |
| 743 } | 742 } |
| 744 }; | 743 }; |
| 745 | 744 |
| 746 }; | 745 }; |
| OLD | NEW |