| 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 var heapProfileType = WebInspector.ProfileTypeRegistry.instance.heapSnapsho
tProfileType; | 16 var heapProfileType = Profiler.ProfileTypeRegistry.instance.heapSnapshotPro
fileType; |
| 17 heapProfileType.addEventListener(WebInspector.HeapSnapshotProfileType.Snapsh
otReceived, finishHeapSnapshot); | 17 heapProfileType.addEventListener(Profiler.HeapSnapshotProfileType.SnapshotRe
ceived, finishHeapSnapshot); |
| 18 InspectorTest.addSniffer(heapProfileType, "_snapshotReceived", snapshotRecei
ved); | 18 InspectorTest.addSniffer(heapProfileType, "_snapshotReceived", snapshotRecei
ved); |
| 19 heapProfileType._takeHeapSnapshot(function() {}); | 19 heapProfileType._takeHeapSnapshot(function() {}); |
| 20 | 20 |
| 21 function finishHeapSnapshot(uid) | 21 function finishHeapSnapshot(uid) |
| 22 { | 22 { |
| 23 InspectorTest.addResult("PASS: snapshot was taken"); | 23 InspectorTest.addResult("PASS: snapshot was taken"); |
| 24 var profiles = heapProfileType.getProfiles(); | 24 var profiles = heapProfileType.getProfiles(); |
| 25 | 25 |
| 26 if (!profiles.length) | 26 if (!profiles.length) |
| 27 return clear("FAILED: no profiles found"); | 27 return clear("FAILED: no profiles found"); |
| 28 | 28 |
| 29 if (profiles.length > 1) | 29 if (profiles.length > 1) |
| 30 return clear("FAILED: wrong number of recorded profiles was found. p
rofiles.length = " + profiles.length); | 30 return clear("FAILED: wrong number of recorded profiles was found. p
rofiles.length = " + profiles.length); |
| 31 | 31 |
| 32 var profile = profiles[profiles.length - 1]; | 32 var profile = profiles[profiles.length - 1]; |
| 33 WebInspector.panels.profiles.showProfile(profile); | 33 UI.panels.profiles.showProfile(profile); |
| 34 } | 34 } |
| 35 | 35 |
| 36 function snapshotReceived(profile) | 36 function snapshotReceived(profile) |
| 37 { | 37 { |
| 38 InspectorTest.addResult("PASS: snapshot was received"); | 38 InspectorTest.addResult("PASS: snapshot was received"); |
| 39 var snapshotProxy = profile._snapshotProxy; | 39 var snapshotProxy = profile._snapshotProxy; |
| 40 snapshotProxy.callMethod(didGetBodyWrapperIds, "idsOfObjectsWithName", "
HTMLBodyElement"); | 40 snapshotProxy.callMethod(didGetBodyWrapperIds, "idsOfObjectsWithName", "
HTMLBodyElement"); |
| 41 } | 41 } |
| 42 | 42 |
| 43 function didGetBodyWrapperIds(bodyWrapperIds) | 43 function didGetBodyWrapperIds(bodyWrapperIds) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 clear(); | 81 clear(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } | 84 } |
| 85 | 85 |
| 86 function clear(errorMessage) | 86 function clear(errorMessage) |
| 87 { | 87 { |
| 88 if (errorMessage) | 88 if (errorMessage) |
| 89 InspectorTest.addResult(errorMessage); | 89 InspectorTest.addResult(errorMessage); |
| 90 setTimeout(done, 0); | 90 setTimeout(done, 0); |
| 91 WebInspector.panels.profiles._reset(); | 91 UI.panels.profiles._reset(); |
| 92 return !errorMessage; | 92 return !errorMessage; |
| 93 } | 93 } |
| 94 | 94 |
| 95 function done() | 95 function done() |
| 96 { | 96 { |
| 97 InspectorTest.addResult("PASS: profile was deleted"); | 97 InspectorTest.addResult("PASS: profile was deleted"); |
| 98 InspectorTest.completeTest(); | 98 InspectorTest.completeTest(); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 </script> | 102 </script> |
| 103 </head> | 103 </head> |
| 104 | 104 |
| 105 <body onload="handleLoad()"> | 105 <body onload="handleLoad()"> |
| 106 <p> | 106 <p> |
| 107 Test that resolving heap snapshot object to a JS object will not crash on DOM wr
apper boilerplate. Test passes if it doesn't crash. | 107 Test that resolving heap snapshot object to a JS object will not crash on DOM wr
apper boilerplate. Test passes if it doesn't crash. |
| 108 </p> | 108 </p> |
| 109 | 109 |
| 110 </body> | 110 </body> |
| 111 </html> | 111 </html> |
| OLD | NEW |