| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="heap-snapshot-test.js"></script> | 4 <script src="heap-snapshot-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function handleLoad() | 7 function handleLoad() |
| 8 { | 8 { |
| 9 // Make sure there is a body wrapper. | 9 // Make sure there is a body wrapper. |
| 10 document.body.fieldOnDomWrapper = 2012; | 10 document.body.fieldOnDomWrapper = 2012; |
| 11 runTest(); | 11 runTest(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function test() | 14 function test() |
| 15 { | 15 { |
| 16 WebInspector.showPanel("profiles"); | 16 WebInspector.showPanel("profiles"); |
| 17 var heapProfileType = WebInspector.panels.profiles.getProfileType("HEAP"); | 17 var heapProfileType = WebInspector.ProfileTypeRegistry.instance.heapSnapsho
tProfileType; |
| 18 heapProfileType.addEventListener(WebInspector.HeapSnapshotProfileType.Snapsh
otReceived, finishHeapSnapshot); | 18 heapProfileType.addEventListener(WebInspector.HeapSnapshotProfileType.Snapsh
otReceived, finishHeapSnapshot); |
| 19 InspectorTest.addSniffer(heapProfileType, "_snapshotReceived", snapshotRecei
ved); | 19 InspectorTest.addSniffer(heapProfileType, "_snapshotReceived", snapshotRecei
ved); |
| 20 heapProfileType._takeHeapSnapshot(function() {}); | 20 heapProfileType._takeHeapSnapshot(function() {}); |
| 21 | 21 |
| 22 function finishHeapSnapshot(uid) | 22 function finishHeapSnapshot(uid) |
| 23 { | 23 { |
| 24 InspectorTest.addResult("PASS: snapshot was taken"); | 24 InspectorTest.addResult("PASS: snapshot was taken"); |
| 25 var profiles = heapProfileType.getProfiles(); | 25 var profiles = heapProfileType.getProfiles(); |
| 26 | 26 |
| 27 if (!profiles.length) | 27 if (!profiles.length) |
| 28 return clear("FAILED: no profiles found"); | 28 return clear("FAILED: no profiles found"); |
| 29 | 29 |
| 30 if (profiles.length > 1) | 30 if (profiles.length > 1) |
| 31 return clear("FAILED: wrong number of recorded profiles was found. p
rofiles.length = " + profiles.length); | 31 return clear("FAILED: wrong number of recorded profiles was found. p
rofiles.length = " + profiles.length); |
| 32 | 32 |
| 33 var profile = profiles[profiles.length - 1]; | 33 var profile = profiles[profiles.length - 1]; |
| 34 WebInspector.panels.profiles._showProfile(profile); | 34 WebInspector.panels.profiles.showProfile(profile); |
| 35 } | 35 } |
| 36 | 36 |
| 37 function snapshotReceived(profile) | 37 function snapshotReceived(profile) |
| 38 { | 38 { |
| 39 InspectorTest.addResult("PASS: snapshot was received"); | 39 InspectorTest.addResult("PASS: snapshot was received"); |
| 40 var snapshotProxy = profile._snapshotProxy; | 40 var snapshotProxy = profile._snapshotProxy; |
| 41 snapshotProxy.callMethod(didGetBodyWrapperIds, "idsOfObjectsWithName", "
HTMLBodyElement"); | 41 snapshotProxy.callMethod(didGetBodyWrapperIds, "idsOfObjectsWithName", "
HTMLBodyElement"); |
| 42 } | 42 } |
| 43 | 43 |
| 44 function didGetBodyWrapperIds(bodyWrapperIds) | 44 function didGetBodyWrapperIds(bodyWrapperIds) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 </script> | 103 </script> |
| 104 </head> | 104 </head> |
| 105 | 105 |
| 106 <body onload="handleLoad()"> | 106 <body onload="handleLoad()"> |
| 107 <p> | 107 <p> |
| 108 Test that resolving heap snaphot object to a JS object will not crash on DOM wra
pper boilerplate. Test passes if it doesn't crash. | 108 Test that resolving heap snaphot object to a JS object will not crash on DOM wra
pper boilerplate. Test passes if it doesn't crash. |
| 109 </p> | 109 </p> |
| 110 | 110 |
| 111 </body> | 111 </body> |
| 112 </html> | 112 </html> |
| OLD | NEW |