Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / profiler / heap-snapshot-inspect-dom-wrapper.html
blobb6f7421bbe1bf3264c2c805d6f42d421274d6f0d
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="heap-snapshot-test.js"></script>
5 <script>
7 function handleLoad()
9 // Make sure there is a body wrapper.
10 document.body.fieldOnDomWrapper = 2012;
11 runTest();
14 function test()
16 var heapProfileType = WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType;
17 heapProfileType.addEventListener(WebInspector.HeapSnapshotProfileType.SnapshotReceived, finishHeapSnapshot);
18 InspectorTest.addSniffer(heapProfileType, "_snapshotReceived", snapshotReceived);
19 heapProfileType._takeHeapSnapshot(function() {});
21 function finishHeapSnapshot(uid)
23 InspectorTest.addResult("PASS: snapshot was taken");
24 var profiles = heapProfileType.getProfiles();
26 if (!profiles.length)
27 return clear("FAILED: no profiles found");
29 if (profiles.length > 1)
30 return clear("FAILED: wrong number of recorded profiles was found. profiles.length = " + profiles.length);
32 var profile = profiles[profiles.length - 1];
33 WebInspector.panels.profiles.showProfile(profile);
36 function snapshotReceived(profile)
38 InspectorTest.addResult("PASS: snapshot was received");
39 var snapshotProxy = profile._snapshotProxy;
40 snapshotProxy.callMethod(didGetBodyWrapperIds, "idsOfObjectsWithName", "HTMLBodyElement");
43 function didGetBodyWrapperIds(bodyWrapperIds)
45 if (bodyWrapperIds.length < 3)
46 return clear("FAILED: less than 3 HTMLBodyElement objects were detected");
48 InspectorTest.addResult("PASS: more than 2 HTMLBodyElements were found");
50 for (var i = 0; i < bodyWrapperIds.length; i++)
51 InspectorTest.HeapProfilerAgent.getObjectByHeapObjectId("" + bodyWrapperIds[i], undefined, didGetObjectByHeapObjectId);
53 var resolvedObjectsCount = 0;
54 var remoteObjects = [];
55 function didGetObjectByHeapObjectId(error, object)
57 if (!error)
58 remoteObjects.push(InspectorTest.runtimeModel.createRemoteObject(object));
60 if (++resolvedObjectsCount === bodyWrapperIds.length)
61 requestPropertiesOfResolvedObjects();
64 function requestPropertiesOfResolvedObjects()
66 if (!remoteObjects.length)
67 return clear("FAILED: no resolved objects were detected");
69 InspectorTest.addResult("PASS: got at least one HTMLBodyElement wrapper");
71 for (var i = 0; i < remoteObjects.length; i++)
72 remoteObjects[i].getOwnProperties(didGetOwnProperties);
75 var didGetOwnPropertiesCount = 0;
76 function didGetOwnProperties()
78 if (++didGetOwnPropertiesCount !== remoteObjects.length)
79 return;
81 clear();
86 function clear(errorMessage)
88 if (errorMessage)
89 InspectorTest.addResult(errorMessage);
90 setTimeout(done, 0);
91 WebInspector.panels.profiles._reset();
92 return !errorMessage;
95 function done()
97 InspectorTest.addResult("PASS: profile was deleted");
98 InspectorTest.completeTest();
102 </script>
103 </head>
105 <body onload="handleLoad()">
107 Test that resolving heap snaphot object to a JS object will not crash on DOM wrapper boilerplate. Test passes if it doesn't crash.
108 </p>
110 </body>
111 </html>