| <html> |
| <head> |
| <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| function onChange(e) |
| { |
| console.log("onChange " + e.matches); |
| } |
| |
| function createTwoActiveDOMObjectsAndRunTest() |
| { |
| var m = window.matchMedia("(min-width: 1400px)"); |
| m.addListener(onChange); |
| m = window.matchMedia("(min-height: 1800px)"); |
| m.addListener(onChange); |
| console.log("Created 2 MediaQueryList eleements"); |
| runTest(); |
| } |
| |
| function test() |
| { |
| InspectorTest.importScript("../../../../inspector-protocol/heap-profiler/resources/heap-snapshot-common.js"); |
| |
| function checkHeapSnapshot(snapshot) { |
| var node; |
| for (var it = snapshot._allNodes(); it.hasNext(); it.next()) { |
| if (it.node.name() === "(Pending activities group)") { |
| node = it.node; |
| break; |
| } |
| } |
| if (node) |
| InspectorTest.log("SUCCESS: found " + node.name()); |
| else |
| return InspectorTest.fail("cannot find '(Pending activities group)'"); |
| |
| var pendingActivitiesRE = /^Pending activities/; |
| var pendingActivitiesFound = false; |
| for (var iter = node.edges(); iter.hasNext(); iter.next()) { |
| var node = iter.edge.node(); |
| if (pendingActivitiesRE.test(node.className())) { |
| if ("Pending activities / 3 entries" === node.name()) { |
| if (pendingActivitiesFound) |
| return InspectorTest.fail("second " + node.name()); |
| pendingActivitiesFound = true; |
| InspectorTest.log("SUCCESS: found " + node.name()); |
| checkPendingActivities(node); |
| } else |
| return InspectorTest.fail("unexpected 'Pending activities': " + node.name()); |
| } |
| } |
| InspectorTest.completeTest(); |
| } |
| |
| function checkPendingActivities(groupNode) |
| { |
| var mediaQuryListCount = 0; |
| for (var iter = groupNode.edges(); iter.hasNext(); iter.next()) { |
| var node = iter.edge.node(); |
| if (node.name() === "MediaQueryList") |
| ++mediaQuryListCount; |
| } |
| if (mediaQuryListCount === 2) |
| InspectorTest.log("SUCCESS: found " + mediaQuryListCount + " MediaQueryLists in " + groupNode.name()); |
| else |
| return InspectorTest.fail("unexpected MediaQueryLists count: " + mediaQuryListCount); |
| |
| } |
| |
| InspectorTest.takeHeapSnapshot(checkHeapSnapshot); |
| } |
| </script> |
| </head> |
| <body onload="createTwoActiveDOMObjectsAndRunTest()"> |
| <p>Test that all ActiveDOMObjects with pending activities will get into one group in the heap snapshot. <a href="https://crbug.com/426809">Bug 426809.</p> |
| </body> |
| </html> |