Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function produceGarbageForGCEvents(callback) | |
| 8 { | |
| 9 var array = []; | |
| 10 for (var i = 0; i < 1000; ++i) { | |
| 11 array = []; | |
| 12 for (var j = 0; j < 10000; ++j) | |
| 13 array.push(Math.random()); | |
| 14 } | |
| 15 if (window.testRunner) | |
|
yurys
2014/04/11 13:46:03
maybe call testRunner.gc() instead?
| |
| 16 testRunner.displayAsyncThen(callback); | |
| 17 } | |
| 18 | |
| 19 function test() | |
| 20 { | |
| 21 InspectorTest.invokeAsyncWithTimeline("produceGarbageForGCEvents", validate) ; | |
| 22 | |
| 23 function validate(records) | |
| 24 { | |
| 25 for (var i = 0; i < records.length; ++i) { | |
| 26 var record = records[i]; | |
| 27 if (record.type === WebInspector.TimelineModel.RecordType.GCEvent) { | |
|
yurys
2014/04/11 13:46:03
What if there is more than one GCEvent?
| |
| 28 InspectorTest.addResult("The expected GC event record"); | |
| 29 InspectorTest.addObject(record, InspectorTest.timelinePropertyFo rmatters); | |
| 30 | |
| 31 InspectorTest.addResult("The expected first call frame for GC ev ent record call stack"); | |
| 32 InspectorTest.addObject(record.stackTrace[0], InspectorTest.time linePropertyFormatters); | |
| 33 break; | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 InspectorTest.completeTest(); | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 </script> | |
| 42 </head> | |
| 43 | |
| 44 <body onload="runTest()"> | |
| 45 <p> | |
| 46 Tests the Timeline API instrumentation of a gc event | |
| 47 </p> | |
| 48 </body> | |
| 49 </html> | |
| OLD | NEW |