summaryrefslogtreecommitdiffstats
path: root/toolkit/components/xulstore/tests/xpcshell
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/xulstore/tests/xpcshell
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/xulstore/tests/xpcshell')
-rw-r--r--toolkit/components/xulstore/tests/xpcshell/.eslintrc.js7
-rw-r--r--toolkit/components/xulstore/tests/xpcshell/localstore.rdf31
-rw-r--r--toolkit/components/xulstore/tests/xpcshell/test_XULStore.js199
-rw-r--r--toolkit/components/xulstore/tests/xpcshell/xpcshell.ini6
4 files changed, 0 insertions, 243 deletions
diff --git a/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js b/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js
deleted file mode 100644
index d35787cd2..000000000
--- a/toolkit/components/xulstore/tests/xpcshell/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../../testing/xpcshell/xpcshell.eslintrc.js"
- ]
-};
diff --git a/toolkit/components/xulstore/tests/xpcshell/localstore.rdf b/toolkit/components/xulstore/tests/xpcshell/localstore.rdf
deleted file mode 100644
index 458eb50ea..000000000
--- a/toolkit/components/xulstore/tests/xpcshell/localstore.rdf
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<RDF:RDF xmlns:NC="http://home.netscape.com/NC-rdf#"
- xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <RDF:Description RDF:about="chrome://browser/content/browser.xul#sidebar-title"
- value="" />
- <RDF:Description RDF:about="about:config#prefCol"
- ordinal="1"
- sortDirection="ascending" />
- <RDF:Description RDF:about="chrome://browser/content/browser.xul#addon-bar"
- collapsed="true" />
- <RDF:Description RDF:about="about:config">
- <NC:persist RDF:resource="about:config#prefCol"/>
- <NC:persist RDF:resource="about:config#lockCol"/>
- <NC:persist RDF:resource="about:config#typeCol"/>
- <NC:persist RDF:resource="about:config#valueCol"/>
- </RDF:Description>
- <RDF:Description RDF:about="about:config#lockCol"
- ordinal="3" />
- <RDF:Description RDF:about="chrome://browser/content/browser.xul">
- <NC:persist RDF:resource="chrome://browser/content/browser.xul#main-window"/>
- <NC:persist RDF:resource="chrome://browser/content/browser.xul#addon-bar"/>
- <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-box"/>
- <NC:persist RDF:resource="chrome://browser/content/browser.xul#sidebar-title"/>
- </RDF:Description>
- <RDF:Description RDF:about="chrome://browser/content/browser.xul#main-window"
- width="994"
- height="768"
- screenX="4"
- screenY="22"
- sizemode="normal" />
-</RDF:RDF>
diff --git a/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js b/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
deleted file mode 100644
index c3c96654b..000000000
--- a/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/◦
-*/
-
-"use strict"
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-
-Cu.import("resource://gre/modules/osfile.jsm")
-
-var XULStore = null;
-var browserURI = "chrome://browser/content/browser.xul";
-var aboutURI = "about:config";
-
-function run_test() {
- do_get_profile();
- run_next_test();
-}
-
-function checkValue(uri, id, attr, reference) {
- let value = XULStore.getValue(uri, id, attr);
- do_check_true(value === reference);
-}
-
-function checkValueExists(uri, id, attr, exists) {
- do_check_eq(XULStore.hasValue(uri, id, attr), exists);
-}
-
-function getIDs(uri) {
- let it = XULStore.getIDsEnumerator(uri);
- let result = [];
-
- while (it.hasMore()) {
- let value = it.getNext();
- result.push(value);
- }
-
- result.sort();
- return result;
-}
-
-function getAttributes(uri, id) {
- let it = XULStore.getAttributeEnumerator(uri, id);
-
- let result = [];
-
- while (it.hasMore()) {
- let value = it.getNext();
- result.push(value);
- }
-
- result.sort();
- return result;
-}
-
-function checkArrays(a, b) {
- a.sort();
- b.sort();
- do_check_true(a.toString() == b.toString());
-}
-
-function checkOldStore() {
- checkArrays(['addon-bar', 'main-window', 'sidebar-title'], getIDs(browserURI));
- checkArrays(['collapsed'], getAttributes(browserURI, 'addon-bar'));
- checkArrays(['height', 'screenX', 'screenY', 'sizemode', 'width'],
- getAttributes(browserURI, 'main-window'));
- checkArrays(['value'], getAttributes(browserURI, 'sidebar-title'));
-
- checkValue(browserURI, "addon-bar", "collapsed", "true");
- checkValue(browserURI, "main-window", "width", "994");
- checkValue(browserURI, "main-window", "height", "768");
- checkValue(browserURI, "main-window", "screenX", "4");
- checkValue(browserURI, "main-window", "screenY", "22");
- checkValue(browserURI, "main-window", "sizemode", "normal");
- checkValue(browserURI, "sidebar-title", "value", "");
-
- checkArrays(['lockCol', 'prefCol'], getIDs(aboutURI));
- checkArrays(['ordinal'], getAttributes(aboutURI, 'lockCol'));
- checkArrays(['ordinal', 'sortDirection'], getAttributes(aboutURI, 'prefCol'));
-
- checkValue(aboutURI, "prefCol", "ordinal", "1");
- checkValue(aboutURI, "prefCol", "sortDirection", "ascending");
- checkValue(aboutURI, "lockCol", "ordinal", "3");
-}
-
-add_task(function* testImport() {
- let src = "localstore.rdf";
- let dst = OS.Path.join(OS.Constants.Path.profileDir, src);
-
- yield OS.File.copy(src, dst);
-
- // Importing relies on XULStore not yet being loaded before this point.
- XULStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
- checkOldStore();
-});
-
-add_task(function* testTruncation() {
- let dos = Array(8192).join("~");
- // Long id names should trigger an exception
- Assert.throws(() => XULStore.setValue(browserURI, dos, "foo", "foo"), /NS_ERROR_ILLEGAL_VALUE/);
-
- // Long attr names should trigger an exception
- Assert.throws(() => XULStore.setValue(browserURI, "foo", dos, "foo"), /NS_ERROR_ILLEGAL_VALUE/);
-
- // Long values should be truncated
- XULStore.setValue(browserURI, "dos", "dos", dos);
- dos =XULStore.getValue(browserURI, "dos", "dos");
- do_check_true(dos.length == 4096)
- XULStore.removeValue(browserURI, "dos", "dos")
-});
-
-add_task(function* testGetValue() {
- // Get non-existing property
- checkValue(browserURI, "side-window", "height", "");
-
- // Get existing property
- checkValue(browserURI, "main-window", "width", "994");
-});
-
-add_task(function* testHasValue() {
- // Check non-existing property
- checkValueExists(browserURI, "side-window", "height", false);
-
- // Check existing property
- checkValueExists(browserURI, "main-window", "width", true);
-});
-
-add_task(function* testSetValue() {
- // Set new attribute
- checkValue(browserURI, "side-bar", "width", "");
- XULStore.setValue(browserURI, "side-bar", "width", "1000");
- checkValue(browserURI, "side-bar", "width", "1000");
- checkArrays(["addon-bar", "main-window", "side-bar", "sidebar-title"], getIDs(browserURI));
- checkArrays(["width"], getAttributes(browserURI, 'side-bar'));
-
- // Modify existing property
- checkValue(browserURI, "side-bar", "width", "1000");
- XULStore.setValue(browserURI, "side-bar", "width", "1024");
- checkValue(browserURI, "side-bar", "width", "1024");
- checkArrays(["addon-bar", "main-window", "side-bar", "sidebar-title"], getIDs(browserURI));
- checkArrays(["width"], getAttributes(browserURI, 'side-bar'));
-
- // Add another attribute
- checkValue(browserURI, "side-bar", "height", "");
- XULStore.setValue(browserURI, "side-bar", "height", "1000");
- checkValue(browserURI, "side-bar", "height", "1000");
- checkArrays(["addon-bar", "main-window", "side-bar", "sidebar-title"], getIDs(browserURI));
- checkArrays(["width", "height"], getAttributes(browserURI, 'side-bar'));
-});
-
-add_task(function* testRemoveValue() {
- // Remove first attribute
- checkValue(browserURI, "side-bar", "width", "1024");
- XULStore.removeValue(browserURI, "side-bar", "width");
- checkValue(browserURI, "side-bar", "width", "");
- checkValueExists(browserURI, "side-bar", "width", false);
- checkArrays(["addon-bar", "main-window", "side-bar", "sidebar-title"], getIDs(browserURI));
- checkArrays(["height"], getAttributes(browserURI, 'side-bar'));
-
- // Remove second attribute
- checkValue(browserURI, "side-bar", "height", "1000");
- XULStore.removeValue(browserURI, "side-bar", "height");
- checkValue(browserURI, "side-bar", "height", "");
- checkArrays(["addon-bar", "main-window", "sidebar-title"], getIDs(browserURI));
-
- // Removing an attribute that doesn't exists shouldn't fail
- XULStore.removeValue(browserURI, "main-window", "bar");
-
- // Removing from an id that doesn't exists shouldn't fail
- XULStore.removeValue(browserURI, "foo", "bar");
-
- // Removing from a document that doesn't exists shouldn't fail
- let nonDocURI = "chrome://example/content/other.xul";
- XULStore.removeValue(nonDocURI, "foo", "bar");
-
- // Remove all attributes in browserURI
- XULStore.removeValue(browserURI, "addon-bar", "collapsed");
- checkArrays([], getAttributes(browserURI, "addon-bar"));
- XULStore.removeValue(browserURI, "main-window", "width");
- XULStore.removeValue(browserURI, "main-window", "height");
- XULStore.removeValue(browserURI, "main-window", "screenX");
- XULStore.removeValue(browserURI, "main-window", "screenY");
- XULStore.removeValue(browserURI, "main-window", "sizemode");
- checkArrays([], getAttributes(browserURI, "main-window"));
- XULStore.removeValue(browserURI, "sidebar-title", "value");
- checkArrays([], getAttributes(browserURI, "sidebar-title"));
- checkArrays([], getIDs(browserURI));
-
- // Remove all attributes in aboutURI
- XULStore.removeValue(aboutURI, "prefCol", "ordinal");
- XULStore.removeValue(aboutURI, "prefCol", "sortDirection");
- checkArrays([], getAttributes(aboutURI, "prefCol"));
- XULStore.removeValue(aboutURI, "lockCol", "ordinal");
- checkArrays([], getAttributes(aboutURI, "lockCol"));
- checkArrays([], getIDs(aboutURI));
-});
diff --git a/toolkit/components/xulstore/tests/xpcshell/xpcshell.ini b/toolkit/components/xulstore/tests/xpcshell/xpcshell.ini
deleted file mode 100644
index d483dae02..000000000
--- a/toolkit/components/xulstore/tests/xpcshell/xpcshell.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-skip-if = toolkit == 'android'
-support-files =
- localstore.rdf
-
-[test_XULStore.js]