diff options
Diffstat (limited to 'devtools/client/storage/test')
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.`); +} |