Commit 84935122 authored by Julian Descottes's avatar Julian Descottes
Browse files

Bug 1748405 - [devtools] Wait for caches and cell count in browser_storage_cache_overflow r=Honza

parent 182baf51
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -16,10 +16,16 @@ add_task(async function() {
  gUI.tree.expandAll();
  gUI.tree.expandAll();


  await selectTreeItem(["Cache", "https://example.com", "lorem"]);
  await selectTreeItem(["Cache", "https://example.com", "lorem"]);
  checkCellLength(ITEMS_PER_PAGE);
  await waitFor(
    () => getCellLength() == ITEMS_PER_PAGE,
    "Wait until the first 50 messages have been rendered"
  );


  await scroll();
  await scroll();
  checkCellLength(ITEMS_PER_PAGE * 2);
  await waitFor(
    () => getCellLength() == ITEMS_PER_PAGE * 2,
    "Wait until 100 messages have been rendered"
  );


  info("Close Toolbox");
  info("Close Toolbox");
  await gDevTools.closeToolboxForTab(gBrowser.selectedTab);
  await gDevTools.closeToolboxForTab(gBrowser.selectedTab);
+5 −4
Original line number Original line Diff line number Diff line
@@ -1064,11 +1064,12 @@ async function performAdd(store) {
const CELL_SELECTOR =
const CELL_SELECTOR =
  "#storage-table .table-widget-wrapper:first-child .table-widget-cell";
  "#storage-table .table-widget-wrapper:first-child .table-widget-cell";


function checkCellLength(len) {
function getCellLength() {
  const cells = gPanelWindow.document.querySelectorAll(CELL_SELECTOR);
  return gPanelWindow.document.querySelectorAll(CELL_SELECTOR).length;
  const msg = `Table should initially display ${len} items`;
}


  is(cells.length, len, msg);
function checkCellLength(len) {
  is(getCellLength(), len, `Table should initially display ${len} items`);
}
}


async function scroll() {
async function scroll() {
+4 −5
Original line number Original line Diff line number Diff line
@@ -9,11 +9,10 @@
<script>
<script>
  "use strict";
  "use strict";
  async function setup() { // eslint-disable-line no-unused-vars
  async function setup() { // eslint-disable-line no-unused-vars
    caches.open("lorem").then(cache => {
    const cache = await caches.open("lorem");
    for (let i = 0; i < 100; i++) {
    for (let i = 0; i < 100; i++) {
        cache.add(`storage-blank.html?${i}`);
      await cache.add(`storage-blank.html?${i}`);
    }
    }
    });
  }
  }
  function clear() { // eslint-disable-line no-unused-vars
  function clear() { // eslint-disable-line no-unused-vars
    caches.delete("lorem");
    caches.delete("lorem");