Bug 1231445 - Part 4: Tests for removing IndexedDB records in storage inspector r=mratcliffe
authorJarda Snajdr <jsnajdr@gmail.com>
Mon, 04 Jul 2016 04:10:00 +0200
changeset 303539 d06d81ac4cf252b5ee1521396524f908938034ac
parent 303538 caf2ddae3120ced2ddd5c9c50d186ff862665c34
child 303540 d9b3b40f0e848798e6f3c30d02d7cb954360fbe9
push id30393
push userphilringnalda@gmail.com
push dateMon, 04 Jul 2016 21:48:04 +0000
treeherdermozilla-central@0842107a80e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1231445
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1231445 - Part 4: Tests for removing IndexedDB records in storage inspector r=mratcliffe
devtools/client/storage/test/browser_storage_delete.js
devtools/client/storage/test/browser_storage_delete_all.js
devtools/client/storage/test/browser_storage_delete_tree.js
--- a/devtools/client/storage/test/browser_storage_delete.js
+++ b/devtools/client/storage/test/browser_storage_delete.js
@@ -9,42 +9,45 @@
 // Test deleting storage items
 
 const TEST_CASES = [
   [["localStorage", "http://test1.example.org"],
     "ls1", "name"],
   [["sessionStorage", "http://test1.example.org"],
     "ss1", "name"],
   [["cookies", "test1.example.org"],
-    "c1", "name"]
+    "c1", "name"],
+  [["indexedDB", "http://test1.example.org", "idb1", "obj1"],
+    1, "name"]
 ];
 
 add_task(function* () {
   yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html");
 
   let contextMenu = gPanelWindow.document.getElementById("storage-table-popup");
   let menuDeleteItem = contextMenu.querySelector("#storage-table-popup-delete");
 
-  for (let [ [store, host], rowName, cellToClick] of TEST_CASES) {
-    info(`Selecting tree item ${store} > ${host}`);
-    yield selectTreeItem([store, host]);
+  for (let [ treeItem, rowName, cellToClick] of TEST_CASES) {
+    let treeItemName = treeItem.join(" > ");
+
+    info(`Selecting tree item ${treeItemName}`);
+    yield selectTreeItem(treeItem);
 
     let row = getRowCells(rowName);
-    ok(gUI.table.items.has(rowName),
-      `There is a row '${rowName}' in ${store} > ${host}`);
+    ok(gUI.table.items.has(rowName), `There is a row '${rowName}' in ${treeItemName}`);
 
     let eventWait = gUI.once("store-objects-updated");
 
     yield waitForContextMenu(contextMenu, row[cellToClick], () => {
-      info(`Opened context menu in ${store} > ${host}, row '${rowName}'`);
+      info(`Opened context menu in ${treeItemName}, row '${rowName}'`);
       menuDeleteItem.click();
       ok(menuDeleteItem.getAttribute("label").includes(rowName),
         `Context menu item label contains '${rowName}'`);
     });
 
     yield eventWait;
 
     ok(!gUI.table.items.has(rowName),
-      `There is no row '${rowName}' in ${store} > ${host} after deletion`);
+      `There is no row '${rowName}' in ${treeItemName} after deletion`);
   }
 
   yield finishTests();
 });
--- a/devtools/client/storage/test/browser_storage_delete_all.js
+++ b/devtools/client/storage/test/browser_storage_delete_all.js
@@ -24,24 +24,27 @@ add_task(function* () {
     [["localStorage", "https://sectest1.example.org"],
       ["iframe-s-ls1"]],
     [["sessionStorage", "http://test1.example.org"],
       ["ss1"]],
     [["sessionStorage", "http://sectest1.example.org"],
       ["iframe-u-ss1", "iframe-u-ss2"]],
     [["sessionStorage", "https://sectest1.example.org"],
       ["iframe-s-ss1"]],
+    [["indexedDB", "http://test1.example.org", "idb1", "obj1"],
+      [1, 2, 3]],
   ];
 
   yield checkState(beforeState);
 
   info("do the delete");
   const deleteHosts = [
     [["localStorage", "https://sectest1.example.org"], "iframe-s-ls1"],
     [["sessionStorage", "https://sectest1.example.org"], "iframe-s-ss1"],
+    [["indexedDB", "http://test1.example.org", "idb1", "obj1"], 1],
   ];
 
   for (let [store, rowName] of deleteHosts) {
     let storeName = store.join(" > ");
 
     yield selectTreeItem(store);
 
     let eventWait = gUI.once("store-objects-cleared");
@@ -66,14 +69,16 @@ add_task(function* () {
     [["localStorage", "https://sectest1.example.org"],
       []],
     [["sessionStorage", "http://test1.example.org"],
       ["ss1"]],
     [["sessionStorage", "http://sectest1.example.org"],
       ["iframe-u-ss1", "iframe-u-ss2"]],
     [["sessionStorage", "https://sectest1.example.org"],
       []],
+    [["indexedDB", "http://test1.example.org", "idb1", "obj1"],
+      []],
   ];
 
   yield checkState(afterState);
 
   yield finishTests();
 });
--- a/devtools/client/storage/test/browser_storage_delete_tree.js
+++ b/devtools/client/storage/test/browser_storage_delete_tree.js
@@ -15,23 +15,25 @@ add_task(function* () {
   let menuDeleteAllItem = contextMenu.querySelector(
     "#storage-tree-popup-delete-all");
 
   info("test state before delete");
   yield checkState([
     [["cookies", "test1.example.org"], ["c1", "c3", "cs2", "uc1"]],
     [["localStorage", "http://test1.example.org"], ["ls1", "ls2"]],
     [["sessionStorage", "http://test1.example.org"], ["ss1"]],
+    [["indexedDB", "http://test1.example.org", "idb1", "obj1"], [1, 2, 3]],
   ]);
 
   info("do the delete");
   const deleteHosts = [
     ["cookies", "test1.example.org"],
     ["localStorage", "http://test1.example.org"],
     ["sessionStorage", "http://test1.example.org"],
+    ["indexedDB", "http://test1.example.org", "idb1", "obj1"],
   ];
 
   for (let store of deleteHosts) {
     let storeName = store.join(" > ");
 
     yield selectTreeItem(store);
 
     let eventName = "store-objects-" +
@@ -49,12 +51,13 @@ add_task(function* () {
     yield eventWait;
   }
 
   info("test state after delete");
   yield checkState([
     [["cookies", "test1.example.org"], []],
     [["localStorage", "http://test1.example.org"], []],
     [["sessionStorage", "http://test1.example.org"], []],
+    [["indexedDB", "http://test1.example.org", "idb1", "obj1"], []],
   ]);
 
   yield finishTests();
 });