Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / profiler / heap-snapshot-test.js
index 646c8d5..791ccf0 100644 (file)
@@ -433,13 +433,16 @@ InspectorTest.completeProfilerTest = function()
 
 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;
         }
 
@@ -691,22 +694,22 @@ InspectorTest.switchToView = function(title, callback)
 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()