tenfourfox/devtools/client/memory/test/browser/browser_memory-breakdowns-01.js
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

34 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the heap tree renders rows based on the breakdown
*/
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
const { gStore, document } = panel.panelWin;
const $$ = document.querySelectorAll.bind(document);
yield takeSnapshot(panel.panelWin);
yield waitUntilSnapshotState(gStore, [states.SAVED_CENSUS]);
info("Check coarse type heap view");
["objects", "other", "scripts", "strings"].forEach(findNameCell);
yield setBreakdown(panel.panelWin, "objectClass");
info("Check object class heap view");
["Function", "Object"].forEach(findNameCell);
yield setBreakdown(panel.panelWin, "internalType");
info("Check internal type heap view");
["JSObject"].forEach(findNameCell);
function findNameCell (name) {
let el = Array.prototype.find.call($$(".tree .heap-tree-item-name span"), el => el.textContent === name);
ok(el, `Found heap tree item cell for ${name}.`);
}
});