Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 if (window.testRunner) { | |
| 7 testRunner.dumpAsText(); | |
| 8 testRunner.waitUntilDone(); | |
| 9 } | |
| 10 | |
| 11 function jankGenerator() | |
|
yurys
2013/04/25 14:08:26
jank -> junk
| |
| 12 { | |
| 13 var jankArray = new Array(1000); | |
| 14 for (var i = 0; i < jankArray.length; ++i) | |
| 15 jankArray[i] = "42 " + i; | |
| 16 window.jankArray = jankArray; | |
| 17 } | |
| 18 | |
| 19 function setupIntervalAndRunTest() | |
| 20 { | |
| 21 setInterval(jankGenerator, 0); | |
| 22 runTest(); | |
| 23 } | |
| 24 | |
| 25 function test() | |
| 26 { | |
| 27 InspectorTest.importScript("../../../../inspector-protocol/heap-profiler/res ources/heap-snapshot-common.js"); | |
| 28 | |
| 29 function trackingStarted() | |
| 30 { | |
| 31 InspectorTest.log("SUCCESS: tracking started"); | |
| 32 } | |
| 33 | |
| 34 function trackingStopped() | |
| 35 { | |
| 36 InspectorTest.log("SUCCESS: tracking stopped"); | |
| 37 InspectorTest.completeTest(); | |
| 38 } | |
| 39 | |
| 40 var fragments = []; | |
| 41 InspectorTest.eventHandler["HeapProfiler.lastSeenObjectId"] = function(messa geObject) | |
| 42 { | |
| 43 InspectorTest.log("SUCCESS: lastSeenObjectId arrived"); | |
| 44 var params = messageObject["params"]; | |
| 45 InspectorTest.assert(params, "no params found in event HeapProfiler.last SeenObjectId"); | |
| 46 InspectorTest.assert(params.lastSeenObjectId, "lastSeenObjectId is missi ng in event HeapProfiler.lastSeenObjectId"); | |
| 47 InspectorTest.assert(params.timestamp, "timestamp is missing in event He apProfiler.lastSeenObjectId"); | |
| 48 InspectorTest.assert(fragments.length, "a heap stats fragment didn't arr ive before HeapProfiler.lastSeenObjectId"); | |
| 49 InspectorTest.sendCommand("HeapProfiler.stopTrackingHeapObjects", {}, tr ackingStopped); | |
| 50 } | |
| 51 | |
| 52 InspectorTest.eventHandler["HeapProfiler.heapStatsUpdate"] = function(messag eObject) | |
| 53 { | |
| 54 InspectorTest.log("SUCCESS: heapStatsUpdate arrived"); | |
| 55 var params = messageObject["params"]; | |
| 56 InspectorTest.assert(params, "no params found in event HeapProfiler.heap StatsUpdate"); | |
| 57 var statsUpdate = params.statsUpdate; | |
| 58 InspectorTest.assert(statsUpdate, "statsUpdata is missing in event HeapP rofiler.heapStatsUpdate"); | |
| 59 InspectorTest.assert(statsUpdate.length, "statsUpdate should have non ze ro length"); | |
| 60 InspectorTest.assert(!(statsUpdate.length % 3), "statsUpdate length must be a multiple of three"); | |
| 61 InspectorTest.assert(!(statsUpdate.length % 3), "statsUpdate length must be a multiple of three"); | |
| 62 InspectorTest.assert(!statsUpdate[0], "statsUpdate: first fragmentIndex in first update has to be zero"); | |
| 63 InspectorTest.assert(statsUpdate[1], "statsUpdate: total count of object s should be not zero"); | |
| 64 InspectorTest.assert(statsUpdate[2], "statsUpdate: total size of objects should be not zero"); | |
| 65 fragments.push(statsUpdate); | |
| 66 } | |
| 67 | |
| 68 InspectorTest.sendCommand("HeapProfiler.startTrackingHeapObjects", {}, track ingStarted); | |
| 69 //@ sourceURL=heap-objects-tracking.html | |
| 70 } | |
| 71 </script> | |
| 72 </head> | |
| 73 <body onload="setupIntervalAndRunTest()"> | |
| 74 <p>Test that heap tracking actually reports data fragments.</p> | |
| 75 </body> | |
| 76 </html> | |
| OLD | NEW |