tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_memory_displays_01.js (1435B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 /**
      6 * Tests that the heap tree renders rows based on the display
      7 */
      8 
      9 const TEST_URL =
     10  "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
     11 const { viewState } = require("resource://devtools/client/memory/constants.js");
     12 const {
     13  changeView,
     14 } = require("resource://devtools/client/memory/actions/view.js");
     15 
     16 this.test = makeMemoryTest(TEST_URL, async function ({ panel }) {
     17  const { gStore, document } = panel.panelWin;
     18 
     19  const { dispatch } = panel.panelWin.gStore;
     20 
     21  function $$(selector) {
     22    return [...document.querySelectorAll(selector)];
     23  }
     24  dispatch(changeView(viewState.CENSUS));
     25 
     26  await takeSnapshot(panel.panelWin);
     27 
     28  await waitUntilState(
     29    gStore,
     30    state =>
     31      state.snapshots[0].census &&
     32      state.snapshots[0].census.state === censusState.SAVED
     33  );
     34 
     35  info("Check coarse type heap view");
     36 
     37  ["Function", "js::PropMap", "Object", "strings"].forEach(findNameCell);
     38 
     39  await setCensusDisplay(panel.panelWin, censusDisplays.allocationStack);
     40  info("Check allocation stack heap view");
     41  [L10N.getStr("tree-item.nostack")].forEach(findNameCell);
     42 
     43  function findNameCell(name) {
     44    const el = $$(".tree .heap-tree-item-name").find(
     45      e => e.textContent === name
     46    );
     47    ok(el, `Found heap tree item cell for ${name}.`);
     48  }
     49 });