summaryrefslogtreecommitdiffstats
path: root/devtools/client/storage/test
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 17:52:34 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 17:52:34 +0100
commit166fb9f2893dcfb3375aa3227d116fb0ce2c6d42 (patch)
tree9bfd8bb159a20f00ff507ab9c27c22434155df23 /devtools/client/storage/test
parent26e53627d6922b3b965afd76fc5d72e3cc1d9ba5 (diff)
downloadUXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.gz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.lz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.xz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.zip
moebius#339: Make it possible to add cookies, local and session storage entries
Issue #31 https://github.com/MoonchildProductions/moebius/pull/339
Diffstat (limited to 'devtools/client/storage/test')
-rw-r--r--devtools/client/storage/test/browser.ini3
-rw-r--r--devtools/client/storage/test/browser_storage_cookies_add.js20
-rw-r--r--devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js6
-rw-r--r--devtools/client/storage/test/browser_storage_localstorage_add.js20
-rw-r--r--devtools/client/storage/test/browser_storage_sessionstorage_add.js20
-rw-r--r--devtools/client/storage/test/head.js36
6 files changed, 102 insertions, 3 deletions
diff --git a/devtools/client/storage/test/browser.ini b/devtools/client/storage/test/browser.ini
index c13b9d0ec..1250d35d5 100644
--- a/devtools/client/storage/test/browser.ini
+++ b/devtools/client/storage/test/browser.ini
@@ -22,6 +22,7 @@ support-files =
[browser_storage_basic.js]
[browser_storage_cache_delete.js]
[browser_storage_cache_error.js]
+[browser_storage_cookies_add.js]
[browser_storage_cookies_delete_all.js]
[browser_storage_cookies_domain.js]
[browser_storage_cookies_edit.js]
@@ -38,11 +39,13 @@ support-files =
[browser_storage_indexeddb_delete.js]
[browser_storage_indexeddb_delete_blocked.js]
[browser_storage_indexeddb_duplicate_names.js]
+[browser_storage_localstorage_add.js]
[browser_storage_localstorage_edit.js]
[browser_storage_localstorage_error.js]
[browser_storage_overflow.js]
[browser_storage_search.js]
[browser_storage_search_keyboard_trap.js]
+[browser_storage_sessionstorage_add.js]
[browser_storage_sessionstorage_edit.js]
[browser_storage_sidebar.js]
[browser_storage_sidebar_update.js]
diff --git a/devtools/client/storage/test/browser_storage_cookies_add.js b/devtools/client/storage/test/browser_storage_cookies_add.js
new file mode 100644
index 000000000..ac66eb92c
--- /dev/null
+++ b/devtools/client/storage/test/browser_storage_cookies_add.js
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Basic test to check the adding of cookies.
+
+"use strict";
+
+add_task(function* () {
+ yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cookies.html");
+ showAllColumns(true);
+
+ yield performAdd(["cookies", "http://test1.example.org"]);
+ yield performAdd(["cookies", "http://test1.example.org"]);
+ yield performAdd(["cookies", "http://test1.example.org"]);
+ yield performAdd(["cookies", "http://test1.example.org"]);
+ yield performAdd(["cookies", "http://test1.example.org"]);
+
+ yield finishTests();
+});
diff --git a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js
index f87f15d82..2d77896f3 100644
--- a/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js
+++ b/devtools/client/storage/test/browser_storage_indexeddb_delete_blocked.js
@@ -18,8 +18,8 @@ add_task(function* () {
info("do the delete");
yield selectTreeItem(["indexedDB", "http://test1.example.org"]);
- let actor = gUI.getCurrentActor();
- let result = yield actor.removeDatabase("http://test1.example.org", "idb (default)");
+ let front = gUI.getCurrentFront();
+ let result = yield front.removeDatabase("http://test1.example.org", "idb (default)");
ok(result.blocked, "removeDatabase attempt is blocked");
@@ -47,7 +47,7 @@ add_task(function* () {
info("try to delete database from nonexistent host");
let errorThrown = false;
try {
- result = yield actor.removeDatabase("http://test2.example.org", "idb (default)");
+ result = yield front.removeDatabase("http://test2.example.org", "idb (default)");
} catch (ex) {
errorThrown = true;
}
diff --git a/devtools/client/storage/test/browser_storage_localstorage_add.js b/devtools/client/storage/test/browser_storage_localstorage_add.js
new file mode 100644
index 000000000..de40957b8
--- /dev/null
+++ b/devtools/client/storage/test/browser_storage_localstorage_add.js
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Basic test to check the adding of localStorage entries.
+
+"use strict";
+
+add_task(function* () {
+ yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-localstorage.html");
+ showAllColumns(true);
+
+ yield performAdd(["localStorage", "http://test1.example.org"]);
+ yield performAdd(["localStorage", "http://test1.example.org"]);
+ yield performAdd(["localStorage", "http://test1.example.org"]);
+ yield performAdd(["localStorage", "http://test1.example.org"]);
+ yield performAdd(["localStorage", "http://test1.example.org"]);
+
+ yield finishTests();
+});
diff --git a/devtools/client/storage/test/browser_storage_sessionstorage_add.js b/devtools/client/storage/test/browser_storage_sessionstorage_add.js
new file mode 100644
index 000000000..8f220bc81
--- /dev/null
+++ b/devtools/client/storage/test/browser_storage_sessionstorage_add.js
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Basic test to check the adding of sessionStorage entries.
+
+"use strict";
+
+add_task(function* () {
+ yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-sessionstorage.html");
+ showAllColumns(true);
+
+ yield performAdd(["sessionStorage", "http://test1.example.org"]);
+ yield performAdd(["sessionStorage", "http://test1.example.org"]);
+ yield performAdd(["sessionStorage", "http://test1.example.org"]);
+ yield performAdd(["sessionStorage", "http://test1.example.org"]);
+ yield performAdd(["sessionStorage", "http://test1.example.org"]);
+
+ yield finishTests();
+});
diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js
index 07a66120e..ec6459b8d 100644
--- a/devtools/client/storage/test/head.js
+++ b/devtools/client/storage/test/head.js
@@ -897,3 +897,39 @@ function setPermission(url, permission) {
.addFromPrincipal(principal, permission,
nsIPermissionManager.ALLOW_ACTION);
}
+
+/**
+ * Add an item.
+ * @param {Array} store
+ * An array containing the path to the store to which we wish to add an
+ * item.
+ */
+function* performAdd(store) {
+ let storeName = store.join(" > ");
+ let toolbar = gPanelWindow.document.getElementById("storage-toolbar");
+ let type = store[0];
+
+ yield selectTreeItem(store);
+
+ let menuAdd = toolbar.querySelector(
+ "#add-button");
+
+ if (menuAdd.hidden) {
+ is(menuAdd.hidden, false,
+ `performAdd called for ${storeName} but it is not supported`);
+ return;
+ }
+
+ let eventEdit = gUI.table.once("row-edit");
+ let eventWait = gUI.once("store-objects-updated");
+
+ menuAdd.click();
+
+ let rowId = yield eventEdit;
+ yield eventWait;
+
+ let key = type === "cookies" ? "uniqueKey" : "name";
+ let value = getCellValue(rowId, key);
+
+ is(rowId, value, `Row '${rowId}' was successfully added.`);
+}