InspectorTest.runHeapSnapshotTestSuite = function(testSuite)
{
- InspectorTest._nextUid = 1;
var testSuiteTests = testSuite.slice();
+ var completeTestStack;
function runner()
{
if (!testSuiteTests.length) {
+ if (completeTestStack)
+ InspectorTest.addResult("FAIL: test already completed at " + completeTestStack);
InspectorTest.completeProfilerTest();
+ completeTestStack = new Error().stack;
return;
}
InspectorTest.takeAndOpenSnapshot = function(generator, callback)
{
callback = InspectorTest.safeWrap(callback);
- var uid = InspectorTest._nextUid++;
var snapshot = generator();
- var profileType = WebInspector.panels.profiles.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
- var profile = new WebInspector.HeapProfileHeader(profileType, "Mock snapshot #" + uid, uid);
- function pushGeneratedSnapshot(uid, callback)
+ var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType;
+ function pushGeneratedSnapshot(reportProgress, callback)
{
+ var profile = profileType.profileBeingRecorded();
+ if (reportProgress) {
+ profileType.reportHeapSnapshotProgress(50, 100, false);
+ profileType.reportHeapSnapshotProgress(100, 100, true);
+ }
snapshot.snapshot.typeId = "HEAP";
- snapshot.snapshot.title = profile.title;
- snapshot.snapshot.uid = profile.uid;
- profileType.addHeapSnapshotChunk(uid, JSON.stringify(snapshot));
+ profileType.addHeapSnapshotChunk(JSON.stringify(snapshot));
setTimeout(callback, 0);
}
- InspectorTest.override(HeapProfilerAgent, "getHeapSnapshot", pushGeneratedSnapshot);
+ InspectorTest.override(HeapProfilerAgent, "takeHeapSnapshot", pushGeneratedSnapshot);
InspectorTest._takeAndOpenSnapshotCallback = callback;
- profileType.addProfile(profile);
- WebInspector.panels.profiles._showProfile(profile);
+ profileType._takeHeapSnapshot(function() { });
};
InspectorTest.viewColumns = function()