summaryrefslogtreecommitdiffstats
path: root/browser/components/tests/unit
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/components/tests/unit
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/components/tests/unit')
-rw-r--r--browser/components/tests/unit/.eslintrc.js7
-rw-r--r--browser/components/tests/unit/data/engine-de-DE.xml8
-rw-r--r--browser/components/tests/unit/distribution.ini58
-rw-r--r--browser/components/tests/unit/head.js9
-rw-r--r--browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js32
-rw-r--r--browser/components/tests/unit/test_distribution.js152
-rw-r--r--browser/components/tests/unit/xpcshell.ini10
7 files changed, 0 insertions, 276 deletions
diff --git a/browser/components/tests/unit/.eslintrc.js b/browser/components/tests/unit/.eslintrc.js
deleted file mode 100644
index fee088c17..000000000
--- a/browser/components/tests/unit/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../testing/xpcshell/xpcshell.eslintrc.js"
- ]
-};
diff --git a/browser/components/tests/unit/data/engine-de-DE.xml b/browser/components/tests/unit/data/engine-de-DE.xml
deleted file mode 100644
index b9fa0a464..000000000
--- a/browser/components/tests/unit/data/engine-de-DE.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
-<ShortName>Google</ShortName>
-<Description>override-de-DE</Description>
-<InputEncoding>UTF-8</InputEncoding>
-<Url type="text/html" method="GET" template="http://searchtest.local">
- <Param name="search" value="{searchTerms}"/>
-</Url>
-</SearchPlugin>
diff --git a/browser/components/tests/unit/distribution.ini b/browser/components/tests/unit/distribution.ini
deleted file mode 100644
index d7d298808..000000000
--- a/browser/components/tests/unit/distribution.ini
+++ /dev/null
@@ -1,58 +0,0 @@
-# Distribution Configuration File
-# Test of distribution preferences
-
-[Global]
-id=disttest
-version=1.0
-about=Test distribution file
-about.en-US=Tèƨƭ δïƨƭřïβúƭïôñ ƒïℓè
-
-[Preferences]
-distribution.test.string="Test String"
-distribution.test.string.noquotes=Test String
-distribution.test.int=777
-distribution.test.bool.true=true
-distribution.test.bool.false=false
-distribution.test.empty=
-
-distribution.test.pref.locale="%LOCALE%"
-distribution.test.pref.language.reset="Preference Set"
-distribution.test.pref.locale.reset="Preference Set"
-distribution.test.pref.locale.set="Preference Set"
-distribution.test.pref.language.set="Preference Set"
-
-[Preferences-en]
-distribution.test.pref.language.en="en"
-distribution.test.pref.language.reset=
-distribution.test.pref.language.set="Language Set"
-distribution.test.pref.locale.set="Language Set"
-
-[Preferences-en-US]
-distribution.test.pref.locale.en-US="en-US"
-distribution.test.pref.locale.reset=
-distribution.test.pref.locale.set="Locale Set"
-
-
-[Preferences-de]
-distribution.test.pref.language.de="de"
-
-[LocalizablePreferences]
-distribution.test.locale="%LOCALE%"
-distribution.test.language.reset="Preference Set"
-distribution.test.locale.reset="Preference Set"
-distribution.test.locale.set="Preference Set"
-distribution.test.language.set="Preference Set"
-
-[LocalizablePreferences-en]
-distribution.test.language.en="en"
-distribution.test.language.reset=
-distribution.test.language.set="Language Set"
-distribution.test.locale.set="Language Set"
-
-[LocalizablePreferences-en-US]
-distribution.test.locale.en-US="en-US"
-distribution.test.locale.reset=
-distribution.test.locale.set="Locale Set"
-
-[LocalizablePreferences-de]
-distribution.test.language.de="de"
diff --git a/browser/components/tests/unit/head.js b/browser/components/tests/unit/head.js
deleted file mode 100644
index 3d4e23452..000000000
--- a/browser/components/tests/unit/head.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* 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/. */
-
-const {interfaces: Ci, classes: Cc, results: Cr, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-var gProfD = do_get_profile().QueryInterface(Ci.nsILocalFile);
diff --git a/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js b/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js
deleted file mode 100644
index a68503db3..000000000
--- a/browser/components/tests/unit/test_browserGlue_migration_loop_cleanup.js
+++ /dev/null
@@ -1,32 +0,0 @@
-const UI_VERSION = 41;
-const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
-const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
-
-var gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"]
- .getService(Ci.nsIObserver);
-
-Services.prefs.setIntPref("browser.migration.version", UI_VERSION - 1);
-
-add_task(function* test_check_cleanup_loop_prefs() {
- Services.prefs.setBoolPref("loop.createdRoom", true);
- Services.prefs.setBoolPref("loop1.createdRoom", true);
- Services.prefs.setBoolPref("loo.createdRoom", true);
-
- // Simulate a migration.
- gBrowserGlue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_BROWSERGLUE_TEST);
-
- Assert.throws(() => Services.prefs.getBoolPref("loop.createdRoom"),
- /NS_ERROR_UNEXPECTED/,
- "should have cleared old loop preference 'loop.createdRoom'");
- Assert.ok(Services.prefs.getBoolPref("loop1.createdRoom"),
- "should have left non-loop pref 'loop1.createdRoom' untouched");
- Assert.ok(Services.prefs.getBoolPref("loo.createdRoom"),
- "should have left non-loop pref 'loo.createdRoom' untouched");
-});
-
-do_register_cleanup(() => {
- Services.prefs.clearUserPref("browser.migration.version");
- Services.prefs.clearUserPref("loop.createdRoom");
- Services.prefs.clearUserPref("loop1.createdRoom");
- Services.prefs.clearUserPref("loo.createdRoom");
-});
diff --git a/browser/components/tests/unit/test_distribution.js b/browser/components/tests/unit/test_distribution.js
deleted file mode 100644
index 183ab85d6..000000000
--- a/browser/components/tests/unit/test_distribution.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Tests that preferences are properly set by distribution.ini
- */
-
-Cu.import("resource://gre/modules/LoadContextInfo.jsm");
-
-// Import common head.
-var commonFile = do_get_file("../../../../toolkit/components/places/tests/head_common.js", false);
-/* import-globals-from ../../../../toolkit/components/places/tests/head_common.js */
-if (commonFile) {
- let uri = Services.io.newFileURI(commonFile);
- Services.scriptloader.loadSubScript(uri.spec, this);
-}
-
-const TOPICDATA_DISTRIBUTION_CUSTOMIZATION = "force-distribution-customization";
-const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
-
-/**
- * Copy the engine-distribution.xml engine to a fake distribution
- * created in the profile, and registered with the directory service.
- * Create an empty en-US directory to make sure it isn't used.
- */
-function installDistributionEngine() {
- const XRE_APP_DISTRIBUTION_DIR = "XREAppDist";
-
- let dir = gProfD.clone();
- dir.append("distribution");
- let distDir = dir.clone();
-
- dir.append("searchplugins");
- dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
-
- dir.append("locale");
- dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
- let localeDir = dir.clone();
-
- dir.append("en-US");
- dir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
-
- localeDir.append("de-DE");
- localeDir.create(dir.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
-
- do_get_file("data/engine-de-DE.xml").copyTo(localeDir, "engine-de-DE.xml");
-
- Services.dirsvc.registerProvider({
- getFile: function(aProp, aPersistent) {
- aPersistent.value = true;
- if (aProp == XRE_APP_DISTRIBUTION_DIR)
- return distDir.clone();
- return null;
- }
- });
-}
-
-function run_test() {
- // Set special pref to load distribution.ini from the profile folder.
- Services.prefs.setBoolPref("distribution.testing.loadFromProfile", true);
-
- // Copy distribution.ini file to the profile dir.
- let distroDir = gProfD.clone();
- distroDir.leafName = "distribution";
- let iniFile = distroDir.clone();
- iniFile.append("distribution.ini");
- if (iniFile.exists()) {
- iniFile.remove(false);
- print("distribution.ini already exists, did some test forget to cleanup?");
- }
-
- let testDistributionFile = gTestDir.clone();
- testDistributionFile.append("distribution.ini");
- testDistributionFile.copyTo(distroDir, "distribution.ini");
- Assert.ok(testDistributionFile.exists());
-
- installDistributionEngine();
-
- run_next_test();
-}
-
-do_register_cleanup(function () {
- // Remove the distribution dir, even if the test failed, otherwise all
- // next tests will use it.
- let distDir = gProfD.clone();
- distDir.append("distribution");
- distDir.remove(true);
- Assert.ok(!distDir.exists());
-});
-
-add_task(function* () {
- // Force distribution.
- let glue = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver)
- glue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_DISTRIBUTION_CUSTOMIZATION);
-
- var defaultBranch = Services.prefs.getDefaultBranch(null);
-
- Assert.equal(defaultBranch.getCharPref("distribution.id"), "disttest");
- Assert.equal(defaultBranch.getCharPref("distribution.version"), "1.0");
- Assert.equal(defaultBranch.getComplexValue("distribution.about", Ci.nsISupportsString).data, "Tèƨƭ δïƨƭřïβúƭïôñ ƒïℓè");
-
- Assert.equal(defaultBranch.getCharPref("distribution.test.string"), "Test String");
- Assert.equal(defaultBranch.getCharPref("distribution.test.string.noquotes"), "Test String");
- Assert.equal(defaultBranch.getIntPref("distribution.test.int"), 777);
- Assert.equal(defaultBranch.getBoolPref("distribution.test.bool.true"), true);
- Assert.equal(defaultBranch.getBoolPref("distribution.test.bool.false"), false);
-
- Assert.throws(() => defaultBranch.getCharPref("distribution.test.empty"));
- Assert.throws(() => defaultBranch.getIntPref("distribution.test.empty"));
- Assert.throws(() => defaultBranch.getBoolPref("distribution.test.empty"));
-
- Assert.equal(defaultBranch.getCharPref("distribution.test.pref.locale"), "en-US");
- Assert.equal(defaultBranch.getCharPref("distribution.test.pref.language.en"), "en");
- Assert.equal(defaultBranch.getCharPref("distribution.test.pref.locale.en-US"), "en-US");
- Assert.throws(() => defaultBranch.getCharPref("distribution.test.pref.language.de"));
- // This value was never set because of the empty language specific pref
- Assert.throws(() => defaultBranch.getCharPref("distribution.test.pref.language.reset"));
- // This value was never set because of the empty locale specific pref
- Assert.throws(() => defaultBranch.getCharPref("distribution.test.pref.locale.reset"));
- // This value was overridden by a locale specific setting
- Assert.equal(defaultBranch.getCharPref("distribution.test.pref.locale.set"), "Locale Set");
- // This value was overridden by a language specific setting
- Assert.equal(defaultBranch.getCharPref("distribution.test.pref.language.set"), "Language Set");
- // Language should not override locale
- Assert.notEqual(defaultBranch.getCharPref("distribution.test.pref.locale.set"), "Language Set");
-
- Assert.equal(defaultBranch.getComplexValue("distribution.test.locale", Ci.nsIPrefLocalizedString).data, "en-US");
- Assert.equal(defaultBranch.getComplexValue("distribution.test.language.en", Ci.nsIPrefLocalizedString).data, "en");
- Assert.equal(defaultBranch.getComplexValue("distribution.test.locale.en-US", Ci.nsIPrefLocalizedString).data, "en-US");
- Assert.throws(() => defaultBranch.getComplexValue("distribution.test.language.de", Ci.nsIPrefLocalizedString));
- // This value was never set because of the empty language specific pref
- Assert.throws(() => defaultBranch.getComplexValue("distribution.test.language.reset", Ci.nsIPrefLocalizedString));
- // This value was never set because of the empty locale specific pref
- Assert.throws(() => defaultBranch.getComplexValue("distribution.test.locale.reset", Ci.nsIPrefLocalizedString));
- // This value was overridden by a locale specific setting
- Assert.equal(defaultBranch.getComplexValue("distribution.test.locale.set", Ci.nsIPrefLocalizedString).data, "Locale Set");
- // This value was overridden by a language specific setting
- Assert.equal(defaultBranch.getComplexValue("distribution.test.language.set", Ci.nsIPrefLocalizedString).data, "Language Set");
- // Language should not override locale
- Assert.notEqual(defaultBranch.getComplexValue("distribution.test.locale.set", Ci.nsIPrefLocalizedString).data, "Language Set");
-
- do_test_pending();
-
- Services.prefs.setCharPref("distribution.searchplugins.defaultLocale", "de-DE");
-
- Services.search.init(function() {
- Assert.equal(Services.search.isInitialized, true);
- var engine = Services.search.getEngineByName("Google");
- Assert.equal(engine.description, "override-de-DE");
- do_test_finished();
- });
-});
diff --git a/browser/components/tests/unit/xpcshell.ini b/browser/components/tests/unit/xpcshell.ini
deleted file mode 100644
index c2f461966..000000000
--- a/browser/components/tests/unit/xpcshell.ini
+++ /dev/null
@@ -1,10 +0,0 @@
-[DEFAULT]
-head = head.js
-firefox-appdir = browser
-skip-if = toolkit == 'android'
-support-files =
- distribution.ini
- data/engine-de-DE.xml
-
-[test_distribution.js]
-[test_browserGlue_migration_loop_cleanup.js]