[Pkg-mozext-commits] [requestpolicy] 88/257: [tst][rem] Mozmill: remove migrated tests/libs
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 773b53a0cee9b0f6ec7a64c4e86edadfb953d5ac
Author: Martin Kimmerle <dev at 256k.de>
Date: Fri Oct 16 13:08:56 2015 +0200
[tst][rem] Mozmill: remove migrated tests/libs
* Remove all tests, libraries and functions that have been
migrated completely to the Marionette environment.
* Remove parts which are _not_ present in the Marionette
environment anymore:
* Detection of application restarts `testDetectingRestarts`.
* The procedure in the root `manifest.ini`:
- RP tests (all of them)
- disable RP
- FF tests (the ones in Mozilla's `mozmill-tests` repo)
- enable RP
- RP tests
- upgrade RP
- RP tests
- ...
The tests which disable/enable/upgrade/uninstall/install the
RequestPolicy addon, however, have been migrated. It's just
that each RP test is only run once.
---
.../initDetectingRestarts.js | 19 --
.../testAssertNoRestart.js | 20 --
.../testDetectingRestarts.js | 41 ----
.../detectErrors/initDetectingErrors.js | 27 ---
.../detectErrors/testAssertNoErrors.js | 33 ---
.../detectErrors/testDetectingErrors.js | 43 ----
.../repeatedTests/init-repeated-tests.ini | 2 -
.../repeatedTests/run-repeated-tests.ini | 2 -
.../repeatedTests/test-repeated-tests.ini | 2 -
.../restartlessness/lib/addon-manager-utils.js | 158 ------------
.../highLevelTests/restartlessness/manifest.ini | 13 -
.../restartlessness/testDisableExtension.js | 50 ----
.../restartlessness/testEnableExtension.js | 51 ----
.../restartlessness/testInstallExtension.js | 63 -----
.../restartlessness/testUninstallExtension.js | 55 -----
.../restartlessness/testUpgradeExtension.js | 43 ----
tests/mozmill/lib/constants.js | 31 +--
tests/mozmill/lib/request-log-utils.js | 99 --------
tests/mozmill/lib/rp-utils.js | 52 ----
tests/mozmill/manifest.ini | 71 +-----
tests/mozmill/test-ff.ini | 35 ---
tests/mozmill/test-rp.ini | 4 -
tests/mozmill/tests/manifest.ini | 3 -
tests/mozmill/tests/testLinks/manifest.ini | 4 -
.../testLinks/testHTMLAnchorElement/manifest.ini | 5 -
.../testHTMLAnchorElement/testLinkClick.js | 52 ----
.../testHTMLAnchorElement/testOpenInNewTab.js | 104 --------
.../testHTMLAnchorElement/testOpenInNewWindow.js | 134 -----------
.../tests/testLinks/testTextSelection/manifest.ini | 5 -
.../testTextSelection/testOpenInCurrentTab.js | 58 -----
.../testTextSelection/testOpenInNewTab.js | 77 ------
.../testTextSelection/testOpenInNewWindow.js | 135 -----------
tests/mozmill/tests/testPolicy/manifest.ini | 1 -
.../tests/testPolicy/testRuleWithSchemeOnly.js | 268 ---------------------
tests/mozmill/tests/testRedirect/manifest.ini | 6 -
.../mozmill/tests/testRedirect/testAutoRedirect.js | 109 ---------
.../tests/testRedirect/testInlineRedirect.js | 65 -----
.../tests/testRedirect/testLinkClickRedirect.js | 88 -------
.../testRedirect/testLinkClickRedirectInNewTab.js | 117 ---------
tests/mozmill/tests/testRequestLog/manifest.ini | 1 -
.../tests/testRequestLog/testUriWithoutHost.js | 66 -----
41 files changed, 2 insertions(+), 2210 deletions(-)
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js
deleted file mode 100644
index fd5bf5e..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js
+++ /dev/null
@@ -1,19 +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/. */
-
-"use strict";
-
-Components.utils.import("chrome://rpc-dev-helper/content/restart-detection-helper.jsm");
-
-
-function setupModule(aModule) {
-}
-
-function teardownModule(aModule) {
-}
-
-
-function testInitAssertNoRestart() {
- RestartDetectionHelper.mark = "MARK";
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js
deleted file mode 100644
index 2dfd2f6..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js
+++ /dev/null
@@ -1,20 +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/. */
-
-"use strict";
-
-Components.utils.import("chrome://rpc-dev-helper/content/restart-detection-helper.jsm");
-
-
-function setupModule(aModule) {
-}
-
-function teardownModule(aModule) {
-}
-
-
-function testAssertNoRestart() {
- assert.ok(RestartDetectionHelper.mark === "MARK",
- "The MARK still exists, which means the browser did not restart.");
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js
deleted file mode 100644
index f47f39f..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js
+++ /dev/null
@@ -1,41 +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/. */
-
-"use strict";
-
-Components.utils.import("chrome://rpc-dev-helper/content/restart-detection-helper.jsm");
-
-
-function setupModule(aModule) {
-}
-
-function setupTest(aModule) {
- aModule.controller = mozmill.getBrowserController();
-
- persisted.nextTest = null;
-}
-
-function teardownTest(aModule) {
- if (persisted.nextTest) {
- aModule.controller.restartApplication(persisted.nextTest);
- }
-}
-
-function teardownModule(aModule) {
- delete persisted.nextTest;
-}
-
-
-
-
-function testAddMark() {
- persisted.nextTest = "testMarkHasBeenRemoved";
-
- RestartDetectionHelper.mark = "MARK";
-}
-
-function testMarkHasBeenRemoved() {
- assert.ok(RestartDetectionHelper.mark !== "MARK",
- "The MARK has been removed after a restart.");
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/initDetectingErrors.js b/tests/mozmill/highLevelTests/repeatedTests/detectErrors/initDetectingErrors.js
deleted file mode 100644
index 6ca5bc2..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/initDetectingErrors.js
+++ /dev/null
@@ -1,27 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-
-function setupModule(aModule) {
-}
-
-function teardownModule(aModule) {
-}
-
-
-function testInitDetectingErros() {
- prefs.setPref("extensions.requestpolicy.unitTesting.errorCount", 0);
- Services.prefs.savePrefFile(null);
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testAssertNoErrors.js b/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testAssertNoErrors.js
deleted file mode 100644
index 447044a..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testAssertNoErrors.js
+++ /dev/null
@@ -1,33 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-
-Components.utils.import("chrome://rpc-dev-helper/content/console-observer.jsm");
-
-
-
-function setupModule(aModule) {
-}
-
-function teardownModule(aModule) {
-}
-
-
-function testAssertNoErrors() {
- const prefName = "extensions.requestpolicy.unitTesting.errorCount";
- assert.equal(prefs.getPref(prefName, -1), 0,
- "No error has been logged in RequestPolicy so far.");
-
- assert.equal(ConsoleObserver.getNumErrors(), 0,
- "The Console Observer didn't register any error or " +
- "warning so far.");
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testDetectingErrors.js b/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testDetectingErrors.js
deleted file mode 100644
index 56da704..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/detectErrors/testDetectingErrors.js
+++ /dev/null
@@ -1,43 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-
-Components.utils.import("chrome://rpcontinued/content/lib/logger.jsm");
-
-
-function setupModule(aModule) {
-}
-
-function teardownModule(aModule) {
-}
-
-
-function testDetectingErrors() {
- let previousValue = getErrorCount();
- assert.notEqual(previousValue, -1, "The pref for the error count exists.");
-
- Logger.warning(Logger.TYPE_ERROR, "unit test: testDetectingErrors.");
- assert.equal(getErrorCount(), previousValue + 1,
- "The error has been detected.");
-
- Logger.severe(Logger.TYPE_INTERNAL, "unit test: testDetectingErrors.");
- assert.equal(getErrorCount(), previousValue + 2,
- "The severe log message has been detected.");
-}
-
-/**
- * Get the preference. If it doesn't exist, -1 will be returned.
- */
-function getErrorCount() {
- const prefName = "extensions.requestpolicy.unitTesting.errorCount";
- return prefs.getPref(prefName, -1);
-}
diff --git a/tests/mozmill/highLevelTests/repeatedTests/init-repeated-tests.ini b/tests/mozmill/highLevelTests/repeatedTests/init-repeated-tests.ini
deleted file mode 100644
index fb29a4c..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/init-repeated-tests.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[detectApplicationRestarts/initDetectingRestarts.js]
-[detectErrors/initDetectingErrors.js]
diff --git a/tests/mozmill/highLevelTests/repeatedTests/run-repeated-tests.ini b/tests/mozmill/highLevelTests/repeatedTests/run-repeated-tests.ini
deleted file mode 100644
index 2a0046f..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/run-repeated-tests.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[detectApplicationRestarts/testAssertNoRestart.js]
-[detectErrors/testAssertNoErrors.js]
diff --git a/tests/mozmill/highLevelTests/repeatedTests/test-repeated-tests.ini b/tests/mozmill/highLevelTests/repeatedTests/test-repeated-tests.ini
deleted file mode 100644
index e3f5e2b..0000000
--- a/tests/mozmill/highLevelTests/repeatedTests/test-repeated-tests.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[detectApplicationRestarts/testDetectingRestarts.js]
-[detectErrors/testDetectingErrors.js]
diff --git a/tests/mozmill/highLevelTests/restartlessness/lib/addon-manager-utils.js b/tests/mozmill/highLevelTests/restartlessness/lib/addon-manager-utils.js
deleted file mode 100644
index 9ad1e76..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/lib/addon-manager-utils.js
+++ /dev/null
@@ -1,158 +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 self
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-var modalDialog = require(rootDir + "lib/modal-dialog");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-
-
-const PREF_INSTALL_DIALOG = "security.dialog_enable_delay";
-const PREF_NEW_CONFIRMATION_UI = "xpinstall.customConfirmationUI";
-
-const INSTALL_DIALOG_DELAY = 1000;
-const TIMEOUT_DOWNLOAD = 25000;
-
-
-function AMHelper(aController, aAddonsManager) {
- var self = this;
- self.controller = aController;
- self.addonsManager = aAddonsManager;
- self.tabBrowser = new tabs.tabBrowser(self.controller);
-}
-
-
-AMHelper.prototype.onSetupModule = function(aModule) {
- var self = this;
- prefs.setPref(PREF_INSTALL_DIALOG, INSTALL_DIALOG_DELAY);
- addons.setDiscoveryPaneURL("about:home");
- prefs.setPref(PREF_NEW_CONFIRMATION_UI, false);
-};
-
-AMHelper.prototype.onSetupTest = function(aModule) {
- var self = this;
-}
-
-AMHelper.prototype.onTeardownTest = function(aModule) {
- var self = this;
-}
-
-AMHelper.prototype.onTeardownModule = function(aModule) {
- var self = this;
- prefs.clearUserPref(PREF_INSTALL_DIALOG);
- addons.resetDiscoveryPaneURL();
- prefs.clearUserPref(PREF_NEW_CONFIRMATION_UI);
-}
-
-
-
-AMHelper.prototype.forEachTab = function(callback) {
- var self = this;
- for (let i = 0, len = self.tabBrowser.length; i < len; ++i) {
- let tab = self.tabBrowser.getTab(i);
- callback(tab, i);
- }
-}
-
-AMHelper.prototype.forEachTabReverse = function(callback) {
- var self = this;
- for (let i = self.tabBrowser.length - 1; i >= 0; --i) {
- let tab = self.tabBrowser.getTab(i);
- callback(tab, i);
- }
-}
-
-AMHelper.prototype.findTabIndex = function(callback) {
- var self = this;
- var tabIndex;
-
- try {
- self.forEachTab(function(tab, index) {
- if (callback.apply(null, arguments) === true) {
- tabIndex = index;
- throw "found";
- }
- });
- } catch (e if e === "found") {
- return tabIndex;
- }
-
- return -1;
-}
-
-AMHelper.prototype.getTabHref = function(tab) {
- var self = this;
- return tab.getNode().linkedBrowser.contentWindow.location.href;
-}
-
-AMHelper.prototype.openAddonManager = function() {
- var self = this;
- var tabIndex = self.findTabIndex(function(tab) {
- return self.getTabHref(tab) === "about:addons";
- });
-
- if (tabIndex === -1) {
- self.addonsManager.open();
- }
-}
-
-AMHelper.prototype.openOnlyAddonManager = function() {
- var self = this;
- // Note: Sometimes when open() is called, open() needs
- // several seconds to finish. This is because there is no
- // "TabOpen" event in `tabBrowser._waitForTabOpened()`.
- //
- // More specifically, self happens when
- // (a) the addon manager is already opened
- // (b) there is only one tab opened, which is `about:blank`
- self.openAddonManager();
-
- // close all tabs except `about:addons`.
- // iterate frome high indexes to low indexes.
- self.forEachTabReverse(function(tab, index) {
- if (self.getTabHref(tab) !== "about:addons") {
- self.tabBrowser.closeTab({method: "middleClick", index: index});
- }
- });
-
- assert.equal(self.tabBrowser.length, 1, "There is only one tab left.");
-}
-
-AMHelper.prototype.getAddon = function() {
- var self = this;
- var addonList = self.addonsManager.getAddons({attribute: "value",
- value: rpConst.ADDON_ID});
- return addonList.length === 0 ? null : addonList[0];
-}
-
-AMHelper.prototype.getSetupTabIndex = function() {
- var self = this;
- return self.findTabIndex(function(tab) {
- return self.getTabHref(tab) === "about:requestpolicy?setup";
- });
-}
-
-
-AMHelper.prototype.installAddon = function(xpiUrl) {
- var self = this;
- assert.ok(xpiUrl, "The XPI's URL has been specified.");
- var md = new modalDialog.modalDialog(self.addonsManager.controller.window);
-
- // Install the add-on
- md.start(addons.handleInstallAddonDialog);
- self.controller.open(xpiUrl);
- md.waitForDialog(TIMEOUT_DOWNLOAD);
-}
-
-
-exports.AMHelper = AMHelper;
diff --git a/tests/mozmill/highLevelTests/restartlessness/manifest.ini b/tests/mozmill/highLevelTests/restartlessness/manifest.ini
deleted file mode 100644
index 3cf332d..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/manifest.ini
+++ /dev/null
@@ -1,13 +0,0 @@
-; This manifest file is used only directly, by calling `mozmill` with
-; the `-m` CLI option.
-; Example command:
-; make unit-testing-xpi dev-helper-xpi ; \
-; mozmill -a dist/rpcontinued-unit-testing.xpi -a dist/rpc-dev-helper.xpi \
-; -b .mozilla/software/firefox/release/firefox \
-; -m .mozilla/mozmill-tests/firefox/tests/addons/requestpolicy at requestpolicy.com/highLevelTests/restartlessness/manifest.ini
-
-[testDisableExtension.js]
-[testEnableExtension.js]
-[testUpgradeExtension.js]
-[testUninstallExtension.js]
-[testInstallExtension.js]
diff --git a/tests/mozmill/highLevelTests/restartlessness/testDisableExtension.js b/tests/mozmill/highLevelTests/restartlessness/testDisableExtension.js
deleted file mode 100644
index 6c91139..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/testDisableExtension.js
+++ /dev/null
@@ -1,50 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-
-var amUtils = require("lib/addon-manager-utils");
-
-
-function setupModule(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.addonsManager = new addons.AddonsManager(aModule.controller);
- aModule.amHelper = new amUtils.AMHelper(aModule.controller,
- aModule.addonsManager);
- aModule.amHelper.onSetupModule(aModule);
-}
-
-function setupTest(aModule) {
- aModule.amHelper.onSetupTest(aModule);
-}
-
-function teardownTest(aModule) {
- aModule.amHelper.onTeardownTest(aModule);
-}
-
-function teardownModule(aModule) {
- aModule.amHelper.onTeardownModule(aModule);
-}
-
-
-function testDisableExtension() {
- amHelper.openOnlyAddonManager();
- addonsManager.setCategoryById({id: "extension"});
-
- var addon = amHelper.getAddon();
- assert.ok(addonsManager.isAddonEnabled({addon: addon}),
- "The addon is enabled");
-
- // Disable the addon
- addonsManager.disableAddon({addon: addon});
-
- assert.ok(addonsManager.isAddonEnabled({addon: addon}) === false,
- "The addon has been disabled");
-}
diff --git a/tests/mozmill/highLevelTests/restartlessness/testEnableExtension.js b/tests/mozmill/highLevelTests/restartlessness/testEnableExtension.js
deleted file mode 100644
index d08a40f..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/testEnableExtension.js
+++ /dev/null
@@ -1,51 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-
-var amUtils = require("lib/addon-manager-utils");
-
-
-function setupModule(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.addonsManager = new addons.AddonsManager(aModule.controller);
- aModule.amHelper = new amUtils.AMHelper(aModule.controller,
- aModule.addonsManager);
- aModule.amHelper.onSetupModule(aModule);
-}
-
-function setupTest(aModule) {
- aModule.amHelper.onSetupTest(aModule);
-}
-
-function teardownTest(aModule) {
- aModule.amHelper.onTeardownTest(aModule);
-}
-
-function teardownModule(aModule) {
- aModule.amHelper.onTeardownModule(aModule);
-}
-
-
-function testEnableExtension() {
- amHelper.openOnlyAddonManager();
- addonsManager.setCategoryById({id: "extension"});
-
- var addon = amHelper.getAddon();
-
- assert.ok(addonsManager.isAddonEnabled({addon: addon}) === false,
- "The addon is disabled");
-
- // Enable the addon
- addonsManager.enableAddon({addon: addon});
-
- assert.ok(addonsManager.isAddonEnabled({addon: addon}),
- "The addon has been enabled");
-}
diff --git a/tests/mozmill/highLevelTests/restartlessness/testInstallExtension.js b/tests/mozmill/highLevelTests/restartlessness/testInstallExtension.js
deleted file mode 100644
index cfa2506..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/testInstallExtension.js
+++ /dev/null
@@ -1,63 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-var prefs = require(rootDir + "lib/prefs");
-
-var amUtils = require("lib/addon-manager-utils");
-
-const BASE_URL = collector.addHttpResource(rpRootDir + "data/");
-const XPI_URL = BASE_URL + "dist/requestpolicy-unit-testing.xpi";
-
-
-function setupModule(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.addonsManager = new addons.AddonsManager(aModule.controller);
- aModule.amHelper = new amUtils.AMHelper(aModule.controller,
- aModule.addonsManager);
- aModule.amHelper.onSetupModule(aModule);
-}
-
-function setupTest(aModule) {
- aModule.amHelper.onSetupTest(aModule);
-}
-
-function teardownTest(aModule) {
- aModule.amHelper.onTeardownTest(aModule);
-}
-
-function teardownModule(aModule) {
- aModule.amHelper.onTeardownModule(aModule);
-}
-
-
-function testInstallExtension() {
- // Reset the 'welcomeWindowShown' pref so that the setup will be
- // opened the next time the extension is installed.
- prefs.prefBranch.clearUserPref("extensions.requestpolicy.welcomeWindowShown")
-
- // The setup tab has to be closed for later being sure that
- // *this* installation opened the tab.
- assert.equal(amHelper.getSetupTabIndex(), -1, "The setup tab is closed.");
-
- amHelper.installAddon(XPI_URL);
-
- // wait for the setup tab to appear. it might not be there already.
- controller.waitFor(function() {
- return amHelper.getSetupTabIndex() !== -1;
- }, "The setup tab has been opened.");
-
- amHelper.openOnlyAddonManager();
- addonsManager.setCategoryById({id: "extension"});
-
- var addon = amHelper.getAddon();
- assert.ok(addonsManager.isAddonEnabled({addon: addon}),
- "The addon is enabled");
-}
diff --git a/tests/mozmill/highLevelTests/restartlessness/testUninstallExtension.js b/tests/mozmill/highLevelTests/restartlessness/testUninstallExtension.js
deleted file mode 100644
index 0a6587c..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/testUninstallExtension.js
+++ /dev/null
@@ -1,55 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-
-var amUtils = require("lib/addon-manager-utils");
-
-
-function setupModule(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.addonsManager = new addons.AddonsManager(aModule.controller);
- aModule.amHelper = new amUtils.AMHelper(aModule.controller,
- aModule.addonsManager);
- aModule.amHelper.onSetupModule(aModule);
-}
-
-function setupTest(aModule) {
- aModule.amHelper.onSetupTest(aModule);
-}
-
-function teardownTest(aModule) {
- aModule.amHelper.onTeardownTest(aModule);
-}
-
-function teardownModule(aModule) {
- aModule.amHelper.onTeardownModule(aModule);
-}
-
-
-function testUninstallExtension() {
- amHelper.openOnlyAddonManager();
- addonsManager.setCategoryById({id: "extension"});
-
- var addon = amHelper.getAddon();
- assert.notEqual(addon, null,
- "Extension '" + rpConst.ADDON_ID + "' is installed");
-
- // Uninstall the extension
- addonsManager.removeAddon({addon: addon});
-
- // Switch categories to dispose of the undo link,
- // i.e. switch to 'Appearance' and back to 'Extensions'.
- addonsManager.setCategoryById({id: "theme"});
- addonsManager.setCategoryById({id: "extension"});
-
- assert.equal(amHelper.getAddon(), null,
- "Extension '" + rpConst.ADDON_ID + "' has been uninstalled");
-}
diff --git a/tests/mozmill/highLevelTests/restartlessness/testUpgradeExtension.js b/tests/mozmill/highLevelTests/restartlessness/testUpgradeExtension.js
deleted file mode 100644
index 31b1ed6..0000000
--- a/tests/mozmill/highLevelTests/restartlessness/testUpgradeExtension.js
+++ /dev/null
@@ -1,43 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var addons = require(rootDir + "lib/addons");
-var prefs = require(rootDir + "lib/prefs");
-
-var amUtils = require("lib/addon-manager-utils");
-
-const BASE_URL = collector.addHttpResource(rpRootDir + "data/");
-const XPI_URL = BASE_URL + "dist/requestpolicy-unit-testing.xpi";
-
-
-function setupModule(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.addonsManager = new addons.AddonsManager(aModule.controller);
- aModule.amHelper = new amUtils.AMHelper(aModule.controller,
- aModule.addonsManager);
- aModule.amHelper.onSetupModule(aModule);
-}
-
-function setupTest(aModule) {
- aModule.amHelper.onSetupTest(aModule);
-}
-
-function teardownTest(aModule) {
- aModule.amHelper.onTeardownTest(aModule);
-}
-
-function teardownModule(aModule) {
- aModule.amHelper.onTeardownModule(aModule);
-}
-
-
-function testUpgradeExtension() {
- amHelper.installAddon(XPI_URL);
-}
diff --git a/tests/mozmill/lib/constants.js b/tests/mozmill/lib/constants.js
index 50cd32e..04ef76d 100644
--- a/tests/mozmill/lib/constants.js
+++ b/tests/mozmill/lib/constants.js
@@ -12,35 +12,6 @@ exports.PREF_DEFAULT_ALLOW = "extensions.requestpolicy.defaultPolicy.allow";
exports.PREF_DEFAULT_ALLOW_SAME_DOMAIN =
"extensions.requestpolicy.defaultPolicy.allowSameDomain";
-exports.REDIRECT_NOTIFICATION_VALUE = "request-policy-meta-redirect";
-
-
-// Export of variables
-// exports.PREF_DEFAULT_ALLOW = PREF_DEFAULT_ALLOW;
-// exports.REDIRECT_NOTIFICATION_VALUE = REDIRECT_NOTIFICATION_VALUE;
-
-
-
-// uncomment if needed
-// exports.PREF_LOG = "extensions.requestpolicy.log";
-// exports.PREF_LOG_LEVEL = "extensions.requestpolicy.log.level";
-// exports.PREF_LOG_TYPES = "extensions.requestpolicy.log.types";
-//
exports.PREF_AUTO_RELOAD = "extensions.requestpolicy.autoReload";
-//
-// exports.PREF_WELCOME_WINDOW = "extensions.requestpolicy.welcomeWindowShown";
-//
-// exports. = "extensions.requestpolicy.indicateBlockedObjects";
-// exports. = "extensions.requestpolicy.startWithAllowAllEnabled";
-// exports. = "extensions.requestpolicy.privateBrowsingPermanentWhitelisting";
-//
-// exports. = "extensions.requestpolicy.prefetch.link.disableOnStartup";
-// exports. = "extensions.requestpolicy.prefetch.link.restoreDefaultOnUninstall";
-// exports. = "extensions.requestpolicy.prefetch.dns.disableOnStartup";
-// exports. = "extensions.requestpolicy.prefetch.dns.restoreDefaultOnUninstall";
-//
-// exports. = "extensions.requestpolicy.menu.sorting";
+
exports.PREF_MENU_SHOW_NUM_REQUESTS = "extensions.requestpolicy.menu.info.showNumRequests";
-//
-// exports. = "extensions.requestpolicy.lastVersion";
-// exports. = "extensions.requestpolicy.lastAppVersion";
diff --git a/tests/mozmill/lib/request-log-utils.js b/tests/mozmill/lib/request-log-utils.js
deleted file mode 100644
index aab3039..0000000
--- a/tests/mozmill/lib/request-log-utils.js
+++ /dev/null
@@ -1,99 +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/. */
-
-"use strict";
-
-var rpRootDir = "../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var menuUtils = require(rpRootDir + "lib/menu-utils");
-
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-
-function RequestLog(aController) {
- this.controller = aController;
- this.windowDoc = this.controller.window.document;
-}
-
-RequestLog.prototype.open = function () {
- {
- let menu = new menuUtils.Menu(this.controller);
- menu.open();
-
- // open the request log
- findElement.ID(this.windowDoc, "rpc-link-request-log").click();
-
- // close the menu
- menu.close();
- }
-
- let iframe = this.windowDoc.getElementById("rpcontinued-requestLog-frame");
- this.requestLogDoc = iframe.contentDocument;
- this.controller.waitForPageLoad(this.requestLogDoc);
-
- var tree = this.requestLogDoc.getElementById("rpcontinued-requestLog-tree");
- this.treeView = tree.view;
-
- this.originCol = tree.columns
- .getNamedColumn("rpcontinued-requestLog-origin");
- this.destCol = tree.columns
- .getNamedColumn("rpcontinued-requestLog-destination");
- this.blockedCol = tree.columns
- .getNamedColumn("rpcontinued-requestLog-blocked");
- this.timeCol = tree.columns
- .getNamedColumn("rpcontinued-requestLog-time");
-};
-
-RequestLog.prototype.close = function () {
- findElement.ID(this.windowDoc, "rpcontinued-requestLog-close").click();
-};
-
-RequestLog.prototype.clear = function () {
- findElement.ID(this.windowDoc, "rpcontinued-requestLog-clear").click();
-};
-
-
-RequestLog.prototype.getOrigin = function (aRow) {
- return this.treeView.getCellText(aRow, this.originCol);
-};
-
-RequestLog.prototype.getDestination = function (aRow) {
- return this.treeView.getCellText(aRow, this.destCol);
-};
-
-RequestLog.prototype.getDestinations = function () {
- var destinations = [];
- for (let i = 0, len = this.treeView.rowCount; i < len; ++i) {
- destinations.push(this.getDestination(i));
- }
- return destinations;
-};
-
-RequestLog.prototype.hasBeenAllowed = function (aRow) {
- let imageSrc = this.treeView.getImageSrc(aRow, this.blockedCol);
- return imageSrc !== "chrome://rpcontinued/skin/dot.png";
-};
-
-RequestLog.prototype.getRow = function(aRow) {
- return {
- origin: this.getOrigin(aRow),
- destination: this.getDestination(aRow),
- hasBeenAllowed: this.hasBeenAllowed(aRow)
- };
-};
-
-RequestLog.prototype.getRowsByDestination = function (aDestination) {
- let rows = [];
- for (let i = 0, len = this.treeView.rowCount; i < len; ++i) {
- if (this.getDestination(i) === aDestination) {
- rows.push(this.getRow(i));
- }
- }
- return rows;
-};
-
-exports.RequestLog = RequestLog;
diff --git a/tests/mozmill/lib/rp-utils.js b/tests/mozmill/lib/rp-utils.js
index e16c0f1..2a3b878 100644
--- a/tests/mozmill/lib/rp-utils.js
+++ b/tests/mozmill/lib/rp-utils.js
@@ -6,28 +6,6 @@
/* global findElement, assert */
-/**
- * @param {MozMillController} _controller
- * @param {ElemBase} tab
- */
-function waitForTabLoad(_controller, tab) {
- // sleep as a workaround because the "busy" attribute is not present
- // immediately.
- _controller.sleep(100);
-
- assert.waitFor(function() {
- return !tab.getNode().hasAttribute("busy");
- }, "The tab has loaded");
-}
-
-function selectText(_tabBrowser, text) {
- var findBar = _tabBrowser.findBar;
- findBar.open();
- findBar.search(text);
- findBar.value = "";
- findBar.close(true);
-}
-
function getElementById(ancestor, id) {
var element = ancestor.getElementById(id);
assert.ok(element, "element #" + id + " has been found.");
@@ -35,31 +13,6 @@ function getElementById(ancestor, id) {
}
/**
- * @param {MozMillController} _controller
- * @return {MozMillElement} The link to click on.
- */
-function getLink(_controller, i = 0) {
- let links = _controller.window.content.document.getElementsByTagName("a");
- assert.ok(links.length >= i, "The page contains at least " + i + " links.");
- return findElement.Elem(links[i]);
-}
-
-/**
- * @param {MozMillController} _controller
- * @return {Array.<MozMillElement>} The links on the page
- */
-function getLinks(_controller) {
- let linksHtmlCollection = _controller.window.content.document
- .getElementsByTagName("a");
- let linksArray = Array.prototype.slice.call(linksHtmlCollection);
- return linksArray.map(l => findElement.Elem(l));
-}
-
-function getNumLinks(_controller) {
- return _controller.window.content.document.getElementsByTagName("a").length;
-}
-
-/**
* Create all combinations of a two-dimensional array.
*
* Example:
@@ -89,10 +42,5 @@ function combinations(list) {
}
// Export of functions
-exports.waitForTabLoad = waitForTabLoad;
-exports.selectText = selectText;
exports.getElementById = getElementById;
-exports.getLink = getLink;
-exports.getLinks = getLinks;
-exports.getNumLinks = getNumLinks;
exports.combinations = combinations;
diff --git a/tests/mozmill/manifest.ini b/tests/mozmill/manifest.ini
index f6b983f..6f8cb9f 100644
--- a/tests/mozmill/manifest.ini
+++ b/tests/mozmill/manifest.ini
@@ -1,70 +1 @@
-; PREPARATION of the repeated tests:
-;test the repeated high-level tests themselves
-[include:highLevelTests/repeatedTests/test-repeated-tests.ini]
-;initialize the repeated high-level tests
-[include:highLevelTests/repeatedTests/init-repeated-tests.ini]
-
-
-;test RP
-[include:test-rp.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-;disable RP
-[highLevelTests/restartlessness/testDisableExtension.js]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;then run FF tests
-[include:test-ff.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-;activate RP
-[highLevelTests/restartlessness/testEnableExtension.js]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;then test RP again
-[include:test-rp.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-;upgrade RP
-[highLevelTests/restartlessness/testUpgradeExtension.js]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;and test RP again
-[include:test-rp.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-;uninstall RP
-[highLevelTests/restartlessness/testUninstallExtension.js]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;run FF tests again
-[include:test-ff.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-;install RP
-[highLevelTests/restartlessness/testInstallExtension.js]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;and test RP again
-[include:test-rp.ini]
-[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-
-
-
-; Below is a procedure that would need less time to run
-; than the procedure above. However, the above procedure
-; is more complete.
-
-
-;[highLevelTests/restartlessness/testDisableExtension.js]
-;[highLevelTests/restartlessness/testEnableExtension.js]
-;[highLevelTests/restartlessness/testUninstallExtension.js]
-;[highLevelTests/restartlessness/testInstallExtension.js]
-;[highLevelTests/restartlessness/testUpgradeExtension.js]
-;[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;
-;;test RP
-;[include:test-rp.ini]
-;[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;
-;;run FF tests
-;[highLevelTests/restartlessness/testDisableExtension.js]
-;[include:test-ff.ini]
-;[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
-;[highLevelTests/restartlessness/testEnableExtension.js]
-;[include:highLevelTests/repeatedTests/run-repeated-tests.ini]
+[include:tests/manifest.ini]
diff --git a/tests/mozmill/test-ff.ini b/tests/mozmill/test-ff.ini
deleted file mode 100644
index ce3f65e..0000000
--- a/tests/mozmill/test-ff.ini
+++ /dev/null
@@ -1,35 +0,0 @@
-; This manifest runs multiple of the tests of the official
-; "mozmill-tests" repository.
-
-; None of the firefox tests should restart firefox itself. If firefox
-; would restart, some kind of errors that RequestPolicy's might have
-; possibly could not be detected. The reason is that a restart can
-; "repair" some misbehaviour in RequestPolicy, but the intention of
-; this test is to actually *find* those bugs.
-[highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js]
-
-; some tests are failing on nightly (41.0a1 (2015-06-06)):
-; testAwesomeBar/testAccessLocationBar.js
-; testAwesomeBar/testSuggestBookmarks.js
-; testAwesomeBar/testSuggestHistory.js
-; testAwesomeBar/testSwitchToTab.js
-; therefore `testAwesomeBar` tests are disabled.
-;[include:mozmill-tests/firefox/tests/functional/testAwesomeBar/manifest.ini]
-
-[include:mozmill-tests/firefox/tests/functional/testBookmarks/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testFindInPage/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testFormManager/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testInstallation/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testPlacesOrganizer/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testPopups/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testPreferences/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testPrivateBrowsing/manifest.ini]
-; testSearch tests seem to fail
-;[include:mozmill-tests/firefox/tests/functional/testSearch/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testSecurity/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testTabbedBrowsing/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testTabView/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testTechnicalTools/manifest.ini]
-[include:mozmill-tests/firefox/tests/functional/testToolbar/manifest.ini]
-
-[highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js]
diff --git a/tests/mozmill/test-rp.ini b/tests/mozmill/test-rp.ini
deleted file mode 100644
index 9c2055e..0000000
--- a/tests/mozmill/test-rp.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-; This manifest runs the "usual" mozmill tests for
-; RequestPolicy. The full test is captured in
-; "./manifest.ini"
-[include:tests/manifest.ini]
diff --git a/tests/mozmill/tests/manifest.ini b/tests/mozmill/tests/manifest.ini
index 5a10e51..37340f9 100644
--- a/tests/mozmill/tests/manifest.ini
+++ b/tests/mozmill/tests/manifest.ini
@@ -1,6 +1,3 @@
[parent:../manifest.ini]
-[include:testLinks/manifest.ini]
[include:testPolicy/manifest.ini]
-[include:testRedirect/manifest.ini]
-[include:testRequestLog/manifest.ini]
diff --git a/tests/mozmill/tests/testLinks/manifest.ini b/tests/mozmill/tests/testLinks/manifest.ini
deleted file mode 100644
index 51af283..0000000
--- a/tests/mozmill/tests/testLinks/manifest.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[parent:../manifest.ini]
-
-[include:testHTMLAnchorElement/manifest.ini]
-[include:testTextSelection/manifest.ini]
diff --git a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/manifest.ini b/tests/mozmill/tests/testLinks/testHTMLAnchorElement/manifest.ini
deleted file mode 100644
index f5579f9..0000000
--- a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/manifest.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[parent:../manifest.ini]
-
-[testLinkClick.js]
-[testOpenInNewTab.js]
-[testOpenInNewWindow.js]
diff --git a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testLinkClick.js b/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testLinkClick.js
deleted file mode 100644
index 2c13bd0..0000000
--- a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testLinkClick.js
+++ /dev/null
@@ -1,52 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testLinkClick = function() {
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let link = rpUtils.getLink(controller);
- let linkURL = link.getNode().href;
-
- link.click();
-
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(0));
-
- var panel = tabBrowser.getTabPanelElement(0,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the link didn't cause a redirect");
-
- assert.equal(controller.tabs.activeTab.location.href, linkURL,
- "The location is correct.");
-}
diff --git a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewTab.js b/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewTab.js
deleted file mode 100644
index ef19453..0000000
--- a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewTab.js
+++ /dev/null
@@ -1,104 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-var utils = require(rootDir + "lib/utils");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
-
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- utils.closeContentAreaContextMenu(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testOpenInNewTab = function() {
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let link = rpUtils.getLink(controller);
- let linkURL = link.getNode().href;
-
- let i = 1;
- while (true === openNextTab(i, link)) {
- // Check that i+1 tabs are open
- assert.waitFor(function () {
- return tabBrowser.length === (i + 1);
- }, "Tab " + (i + 1) + " opened.");
- ++i;
- }
-
- assertCorrectLocations(linkURL);
- assertNoRedirects();
-}
-
-
-
-/**
- * Opens the next tab.
- * @return {boolean}
- * true if a new tab has been opened.
- * false if no tab needs to open anymore.
- */
-var openNextTab = function(i, link) {
- switch (i) {
- case 1:
- // Open another tab by middle-clicking on the link
- tabBrowser.openTab({method: "middleClick", target: link});
- return true;
- break;
-
- case 2:
- // Open link via context menu in a new tab:
- tabBrowser.openTab({method: "contextMenu", target: link});
- return true;
- break;
-
- default:
- return false;
- break;
- }
-}
-
-var assertCorrectLocations = function(linkURL) {
- for (let index = 1; index < tabBrowser.length; ++index) {
- tabBrowser.selectedIndex = index;
- assert.equal(controller.tabs.activeTab.location.href, linkURL,
- "The location in the new tab is correct.");
- }
-}
-
-
-/**
- * Assert that the link clicks have not been detected as redirects.
- */
-var assertNoRedirects = function() {
- for (let index = 0; index < tabBrowser.length; ++index) {
- var panel = tabBrowser.getTabPanelElement(index,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the link didn't cause a redirect");
- }
-}
diff --git a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewWindow.js b/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewWindow.js
deleted file mode 100644
index aca023e..0000000
--- a/tests/mozmill/tests/testLinks/testHTMLAnchorElement/testOpenInNewWindow.js
+++ /dev/null
@@ -1,134 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-var utils = require(rootDir + "lib/utils");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.otherController = null;
-
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
- aModule.otherTabBrowser = null;
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-};
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- utils.closeContentAreaContextMenu(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- closeWindow(aModule.otherController);
-};
-
-var testOpenInNewWindow = function () {
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let link = rpUtils.getLink(controller);
- let linkURL = link.getNode().href;
-
- let i = 1;
- while (true === openNextWindow(i, link)) {
- assert.waitFor(function () {
- // Make sure that we work on the correct window
- var windows = mozmill.utils.getWindows("navigator:browser");
- for (var j = 0; j < windows.length; ++j) {
- if (windows[j] !== controller.window) {
- otherController = new mozmill.controller.MozMillController(windows[j]);
- otherTabBrowser = new tabs.tabBrowser(otherController);
- break;
- }
- }
-
- return !!otherController;
- }, "Newly opened browser window has been found.");
-
- rpUtils.waitForTabLoad(controller, otherTabBrowser.getTab(0));
-
- assert.equal(otherController.tabs.activeTab.location.href, linkURL,
- "The location in the new window is correct.");
-
- assertNoRedirects();
- closeWindow(otherController);
- otherController = null;
- otherTabBrowser = null;
- ++i;
- }
-};
-
-var closeWindow = function(_controller) {
- if (_controller && _controller.window) {
- _controller.window.close();
- }
-};
-
-
-
-/**
- * Opens the next tab.
- * @return {boolean}
- * true if a new tab has been opened.
- * false if no tab needs to open anymore.
- */
-var openNextWindow = function(i, link) {
- var contextMenuItemID;
-
- switch (i) {
- case 1:
- // Context Menu: Open Link in New Window
- contextMenuItemID = "#context-openlink";
- break;
-
- case 2:
- // Context Menu: Open Link in New Private Window
- contextMenuItemID = "#context-openlinkprivate";
- break;
-
- default:
- return false;
- break;
- }
-
- // There seems to be a bug in Mozmill: the right-click is not performed the
- // second time. The workaround seems to be to wait for some miliseconds before
- // continuing. I set the timeout to 100 ms. If this time is still not enough
- // for anybody, simply increase it.
- // It seemed that this bug has to do with the focus. However, the
- // HTMLElement.blur() function doesn't work for <a> Elements.
- controller.sleep(100);
-
- var contextMenu = controller.getMenu("#contentAreaContextMenu");
- contextMenu.select(contextMenuItemID, link);
- return true;
-};
-
-/**
- * Assert that the link clicks have not been detected as redirects.
- */
-var assertNoRedirects = function() {
- var tabBrowsers = [tabBrowser, otherTabBrowser];
-
- for (let i = 0; i < tabBrowsers.length; ++i) {
- var panel = tabBrowsers[i].getTabPanelElement(0,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the link didn't cause a redirect");
- }
-};
diff --git a/tests/mozmill/tests/testLinks/testTextSelection/manifest.ini b/tests/mozmill/tests/testLinks/testTextSelection/manifest.ini
deleted file mode 100644
index 493f115..0000000
--- a/tests/mozmill/tests/testLinks/testTextSelection/manifest.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[parent:../manifest.ini]
-
-[testOpenInCurrentTab.js]
-[testOpenInNewTab.js]
-[testOpenInNewWindow.js]
diff --git a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInCurrentTab.js b/tests/mozmill/tests/testLinks/testTextSelection/testOpenInCurrentTab.js
deleted file mode 100644
index 02fb20d..0000000
--- a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInCurrentTab.js
+++ /dev/null
@@ -1,58 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testOpenInCurrentTab = function() {
- var tabIndex = tabBrowser.selectedIndex;
-
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let textURL = findElement.ID(controller.window.document, "text_url_1");
- let textURLValue = textURL.getNode().textContent;
-
- rpUtils.selectText(tabBrowser, textURLValue);
-
- // perform right-click and entry selection
- var contextMenu = controller.getMenu("#contentAreaContextMenu");
- contextMenu.select("#context-openlinkincurrent", textURL);
-
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(tabIndex));
-
- var panel = tabBrowser.getTabPanelElement(tabIndex,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the URL didn't cause a redirect");
-
- assert.equal(controller.tabs.activeTab.location.href, textURLValue,
- "The location is correct.");
-}
diff --git a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewTab.js b/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewTab.js
deleted file mode 100644
index 99bc879..0000000
--- a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewTab.js
+++ /dev/null
@@ -1,77 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-var utils = require(rootDir + "lib/utils");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- utils.closeContentAreaContextMenu(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testOpenInNewTab = function() {
- var tabIndex = tabBrowser.selectedIndex;
-
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let textURL = findElement.ID(controller.window.document, "text_url_1");
- let textURLValue = textURL.getNode().textContent;
-
- rpUtils.selectText(tabBrowser, textURLValue);
-
- // perform right-click and entry selection
- var contextMenu = controller.getMenu("#contentAreaContextMenu");
- contextMenu.select("#context-openlinkintab", textURL);
-
- assert.waitFor(() => { return tabBrowser.length == 2; }, "New Tab opened.");
-
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(tabIndex));
-
- assertNoRedirects();
- assertCorrectLocations(textURLValue);
-}
-
-var assertCorrectLocations = function(linkURL) {
- for (let index = 1; index < tabBrowser.length; ++index) {
- tabBrowser.selectedIndex = index;
- assert.equal(controller.tabs.activeTab.location.href, linkURL,
- "The location in the new tab is correct.");
- }
-}
-
-/**
- * Assert that the link clicks have not been detected as redirects.
- */
-var assertNoRedirects = function() {
- for (let index = 0; index < tabBrowser.length; ++index) {
- var panel = tabBrowser.getTabPanelElement(index,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the link didn't cause a redirect");
- }
-}
diff --git a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewWindow.js b/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewWindow.js
deleted file mode 100644
index bed62ae..0000000
--- a/tests/mozmill/tests/testLinks/testTextSelection/testOpenInNewWindow.js
+++ /dev/null
@@ -1,135 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-var utils = require(rootDir + "lib/utils");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-const TEST_URL = "http://www.maindomain.test/link_1.html";
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.otherController = null;
-
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
- aModule.otherTabBrowser = null;
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-};
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- utils.closeContentAreaContextMenu(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- closeWindow(aModule.otherController);
-};
-
-var testOpenInNewWindow = function () {
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let textURL = findElement.ID(controller.window.document, "text_url_1");
- let textURLValue = textURL.getNode().textContent;
-
- rpUtils.selectText(tabBrowser, textURLValue);
-
- let i = 1;
- while (true === openNextWindow(i, textURL)) {
- assert.waitFor(function () {
- // Make sure that we work on the correct window
- var windows = mozmill.utils.getWindows("navigator:browser");
- for (var j = 0; j < windows.length; ++j) {
- if (windows[j] !== controller.window) {
- otherController = new mozmill.controller.MozMillController(windows[j]);
- otherTabBrowser = new tabs.tabBrowser(otherController);
- break;
- }
- }
-
- return !!otherController;
- }, "Newly opened browser window has been found.");
-
- rpUtils.waitForTabLoad(controller, otherTabBrowser.getTab(0));
-
- assert.equal(otherController.tabs.activeTab.location.href, textURLValue,
- "The location in the new window is correct.");
-
- assertNoRedirects();
- closeWindow(otherController);
- otherController = null;
- otherTabBrowser = null;
- ++i;
- }
-};
-
-var closeWindow = function(_controller) {
- if (_controller && _controller.window) {
- _controller.window.close();
- }
-};
-
-
-/**
- * Opens the next tab.
- * @return {boolean}
- * true if a new tab has been opened.
- * false if no tab needs to open anymore.
- */
-var openNextWindow = function(i, textURL) {
- var contextMenuItemID;
-
- switch (i) {
- case 1:
- // Context Menu: Open Link in New Window
- contextMenuItemID = "#context-openlink";
- break;
-
- case 2:
- // Context Menu: Open Link in New Private Window
- contextMenuItemID = "#context-openlinkprivate";
- break;
-
- default:
- return false;
- break;
- }
-
- // There seems to be a bug in Mozmill: the right-click is not performed the
- // second time. The workaround seems to be to wait for some miliseconds before
- // continuing. I set the timeout to 100 ms. If this time is still not enough
- // for anybody, simply increase it.
- // It seemed that this bug has to do with the focus. However, the
- // HTMLElement.blur() function doesn't work for <a> Elements.
- controller.sleep(100);
-
- var contextMenu = controller.getMenu("#contentAreaContextMenu");
- contextMenu.select(contextMenuItemID, textURL);
- return true;
-};
-
-/**
- * Assert that the link clicks have not been detected as redirects.
- */
-var assertNoRedirects = function() {
- var tabBrowsers = [tabBrowser, otherTabBrowser];
-
- for (let i = 0; i < tabBrowsers.length; ++i) {
- var panel = tabBrowsers[i].getTabPanelElement(0,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- assert.ok(false === panel.exists(),
- "Following the link didn't cause a redirect");
- }
-};
diff --git a/tests/mozmill/tests/testPolicy/manifest.ini b/tests/mozmill/tests/testPolicy/manifest.ini
index 05182ef..9ebff53 100644
--- a/tests/mozmill/tests/testPolicy/manifest.ini
+++ b/tests/mozmill/tests/testPolicy/manifest.ini
@@ -1,4 +1,3 @@
[parent:../manifest.ini]
-[testRuleWithSchemeOnly.js]
[include:testIframeTree/manifest.ini]
diff --git a/tests/mozmill/tests/testPolicy/testRuleWithSchemeOnly.js b/tests/mozmill/tests/testPolicy/testRuleWithSchemeOnly.js
deleted file mode 100644
index 0b53aeb..0000000
--- a/tests/mozmill/tests/testPolicy/testRuleWithSchemeOnly.js
+++ /dev/null
@@ -1,268 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-var requestLogUtils = require(rpRootDir + "lib/request-log-utils");
-
-const TEST_URL = "http://www.maindomain.test/scheme-unknown-and-without-host-2.html";
-const SCHEME = "rpc";
-
-
-var setupModule = function (aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- aModule.requestLog = new requestLogUtils.RequestLog(aModule.controller);
- aModule.requestLog.open();
- aModule.requestLog.clear();
-};
-
-var teardownModule = function (aModule) {
- aModule.requestLog.close();
- aModule.tabBrowser.closeAllTabs();
-};
-
-var teardownTest = function (aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- removeRules();
-}
-
-
-var RowUtils = {
- getPolicy: function (row) {
- return row.children[0].textContent;
- },
- getOrigin: function (row) {
- return row.children[1].textContent;
- },
- getDest: function (row) {
- return row.children[2].textContent;
- },
- getRuleSet: function (row) {
- return row.children[3].textContent;
- },
- removeRule: function (row) {
- findElement.Elem(row.children[4].getElementsByTagName("a")[0]).click();
- },
- countTableRows: function (tbody) {
- return tbody.children.length;
- }
-};
-
-
-/**
- * Get all table row (html: <tr>) elements whose content of the
- * "detination" column contains the specified string.
- */
-function getTableRowElements(aTbody, aDestinationString) {
- var rows = Array.prototype.slice.call(aTbody.children);
-
- var filteredRows = rows.filter(function (row) {
- if (RowUtils.getDest(row).indexOf(aDestinationString) === -1) {
- return false;
- }
-
- return true;
- });
-
- return filteredRows;
-}
-
-/**
- * Add a rule that either allows or denies requests to
- * the scheme SCHEME.
- */
-function addRule(aIsAllowRule) {
- controller.open("about:requestpolicy?yourpolicy");
- controller.waitForPageLoad();
-
- var doc = controller.window.content.document;
- var tbody = doc.getElementById("rules");
-
- function numberOfRules() {
- return RowUtils.countTableRows(tbody);
- }
-
- var numberOfRulesBefore = numberOfRules();
-
- // fill the form
- {
- let destSchemeField = findElement.Name(doc, "destscheme");
- destSchemeField.sendKeys(SCHEME);
- let radioButtonId = aIsAllowRule ? "allowrule" : "denyrule";
- findElement.ID(doc, radioButtonId).select();
- }
-
- // submit the form
- {
- let button = findElement.XPath(doc, "//button[@data-string='addRule']");
- button.click();
- }
-
- //
- // below, do checks whether the rule has been added correctly
- //
-
- controller.waitFor(function () {
- return numberOfRules() > numberOfRulesBefore;
- }, "The number of rules in the table has increased.");
-
- assert.equal(numberOfRules() - numberOfRulesBefore, 1,
- "The number of rules added is exactly one.");
-
- var rows = getTableRowElements(tbody, SCHEME + ":");
-
- assert.equal(rows.length, 1,
- "There is exactly one rule with '" + SCHEME + "' " +
- "being the destination scheme.");
-
- // check the content of every single cell of that table row
- {
- let row = rows[0];
-
- expect.equal(RowUtils.getPolicy(row), aIsAllowRule ? "Allow" : "Block",
- "The policy of the rule is correct.");
- expect.equal(RowUtils.getOrigin(row),
- "",
- "The origin of the rule is correct.");
- expect.equal(RowUtils.getDest(row),
- SCHEME + ":*",
- "The destination of the rule is correct.");
- expect.equal(RowUtils.getRuleSet(row), "User",
- "The Rule Set of the rule is correct.");
- }
-}
-
-/**
- * Remove all rules that specify the scheme SCHEME.
- */
-function removeRules() {
- controller.open("about:requestpolicy?yourpolicy");
- controller.waitForPageLoad();
-
- var doc = controller.window.content.document;
- var tbody = doc.getElementById("rules");
-
- // remove the rules
- {
- let rows = getTableRowElements(tbody, SCHEME + ":");
- rows.forEach(function (row) {
- RowUtils.removeRule(row);
- });
- }
-
- // do final checks
- {
- let rows = getTableRowElements(tbody, SCHEME + ":");
- expect.equal(rows.length, 0, "There are no more rules for " +
- "URI scheme '" + SCHEME + "'.");
- }
-}
-
-/**
- * Return the string that is displayed in the table of rules.
- */
-function isAllowedToString(aIsAllowed) {
- return aIsAllowed ? "allowed" : "denied";
-}
-
-
-/**
- * Do anything that has to be done before the test URL is opened.
- */
-function setupTestCase({isDefaultAllow, allowRuleExists, denyRuleExists}) {
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, isDefaultAllow);
-
- if (allowRuleExists) {
- addRule(true);
- }
- if (denyRuleExists) {
- addRule(false);
- }
-
- requestLog.clear();
-}
-
-
-/**
- * Common function for all test cases
- */
-function runTestCase(aTestCase) {
- var {isDefaultAllow, allowRuleExists, denyRuleExists,
- requestShouldBeAllowed} = aTestCase;
-
- setupTestCase(aTestCase);
-
- assert.ok(requestLog.treeView.rowCount === 0,
- "The request log is empty.");
-
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- var iframeURI = controller.window.content.document
- .getElementsByTagName("iframe")[0].src;
-
- assert.ok(iframeURI.indexOf(SCHEME + ":") === 0,
- "The iframe's URI starts with the correct scheme: '" +
- SCHEME + "'.");
-
- var rows = requestLog.getRowsByDestination(iframeURI);
- assert.equal(rows.length, 1,
- "There is exactly one entry in the request log with '" +
- iframeURI + "' as the destination.");
-
- // check the decision (allow or deny) on the request
- {
- let expectedDecision = isAllowedToString(requestShouldBeAllowed);
- let actualDecision = isAllowedToString(rows[0].hasBeenAllowed);
- assert.equal(actualDecision, expectedDecision,
- "The request has been " + expectedDecision + ".");
- }
-}
-
-//
-// below, generate the test cases
-//
-
-var testDefaultDeny = runTestCase.bind(null,
- {
- isDefaultAllow: false,
- allowRuleExists: false,
- denyRuleExists: false,
- requestShouldBeAllowed: false
- });
-
-var testDefaultDenyWithAllowRule = runTestCase.bind(null,
- {
- isDefaultAllow: false,
- allowRuleExists: true,
- denyRuleExists: false,
- requestShouldBeAllowed: true
- });
-
-var testDefaultAllow = runTestCase.bind(null,
- {
- isDefaultAllow: true,
- allowRuleExists: false,
- denyRuleExists: false,
- requestShouldBeAllowed: true
- });
-
-var testDefaultAllowWithDenyRule = runTestCase.bind(null,
- {
- isDefaultAllow: true,
- allowRuleExists: false,
- denyRuleExists: true,
- requestShouldBeAllowed: false
- });
diff --git a/tests/mozmill/tests/testRedirect/manifest.ini b/tests/mozmill/tests/testRedirect/manifest.ini
deleted file mode 100644
index 1caf456..0000000
--- a/tests/mozmill/tests/testRedirect/manifest.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[parent:../manifest.ini]
-
-[testAutoRedirect.js]
-[testLinkClickRedirect.js]
-[testLinkClickRedirectInNewTab.js]
-[testInlineRedirect.js]
diff --git a/tests/mozmill/tests/testRedirect/testAutoRedirect.js b/tests/mozmill/tests/testRedirect/testAutoRedirect.js
deleted file mode 100644
index e3ca855..0000000
--- a/tests/mozmill/tests/testRedirect/testAutoRedirect.js
+++ /dev/null
@@ -1,109 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-var testURLPrePath = "http://www.maindomain.test/";
-var urlsWithRedirect = [
- // [shouldBeAllowed, url]
- [false, "redirect-http-location-header.php"],
- [false, "redirect-http-refresh-header.php"],
- [false, "redirect-js-document-location-auto.html"],
- [false, "redirect-meta-tag-01-immediate.html"],
- [false, "redirect-meta-tag-02-delayed.html"],
- [false, "redirect-meta-tag-03-multiple.html"],
- [false, "redirect-meta-tag-08.html"],
-
- [true, "redirect-meta-tag-04-relative-without-slash.html"],
- [true, "redirect-meta-tag-05-relative-with-slash.html"],
- [true, "redirect-meta-tag-06-different-formatting.html"],
- [true, "redirect-meta-tag-07-different-formatting-delayed.html"],
- [true, "redirect-meta-tag-09-relative.html"]
-];
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testAutoRedirect = function() {
- var tabIndex = tabBrowser.selectedIndex;
-
- var getPanel = () => tabBrowser.getTabPanelElement(tabIndex,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
-
- for (let [shouldBeAllowed, testURL] of urlsWithRedirect) {
- let initialURI = controller.window.content.document.location.href;
- testURL = testURLPrePath + testURL;
- dump("Testing " + testURL + ". The redirect should be " +
- (shouldBeAllowed ? "allowed" : "blocked") + ".\n");
-
- controller.open(testURL);
-
- // Wait for the tab to be loaded. The function `waitForPageLoad()` will not
- // work here, because if a redirect is blocked by cancelling the channel's
- // associated request, the `waitForPageLoad` would wait infinitely.
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(tabIndex));
-
- if (shouldBeAllowed) {
- controller.waitFor(function() {
- return controller.window.content.document.location.href !== testURL;
- }, "The URL in the urlbar has changed.");
- expect.ok(!getPanel().exists(),
- "The redirect notification bar is hidden.");
- } else {
- controller.waitFor(() => getPanel().exists(), "The redirect " +
- "notification bar has been displayed.");
- let finalURI = controller.window.content.document.location.href;
- expect.ok(finalURI === testURL || finalURI === initialURI,
- "The URL in the urlbar hasn't changed.");
- }
-
- tabBrowser.closeAllTabs();
-
- // It's necessary to wait for the notification panel to be closed. If we
- // don't wait for that to happen, the next URL in urlsWithRedirect might
- // already be displayed while the panel is still there.
- controller.waitFor(() => !getPanel().exists(), "No panel is being " +
- "displayed because all tabs have been closed.");
-
- //
- // The `sleep` below has been a workaround against the following exception:
- //
- // --> Note: This workaround is probably not needed anymore -- if the
- // problem occurres again, uncomment the `sleep`. Otherwise,
- // remove this comment after some time.
- // (comment by @myrdd, 27.12.2014)
- // *************************
- // A coding exception was thrown in a Promise resolution callback.
- // See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise
- //
- // Full message: TypeError: this.options is undefined
- // Full stack: Capture.prototype.start at resource://gre/modules/BackgroundPageThumbs.jsm:289:19
- // BackgroundPageThumbs._processCaptureQueue at resource://gre/modules/BackgroundPageThumbs.jsm:222:5
- // BackgroundPageThumbs.capture at resource://gre/modules/BackgroundPageThumbs.jsm:73:5
- // (...)
- //controller.sleep(100);
- }
-}
diff --git a/tests/mozmill/tests/testRedirect/testInlineRedirect.js b/tests/mozmill/tests/testRedirect/testInlineRedirect.js
deleted file mode 100644
index f21458a..0000000
--- a/tests/mozmill/tests/testRedirect/testInlineRedirect.js
+++ /dev/null
@@ -1,65 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-var testURLPrePath = "http://www.maindomain.test/";
-var urlsWithInlineRedirect = [
- "redirect-inline-image.html",
- "redirect-iframe.html",
-];
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-/**
- * This test ensures that the redirection notification bar is *not* shown when
- * an inline element such as <img> has caused a redirect.
- */
-var testInlineRedirect = function() {
- var tabIndex = tabBrowser.selectedIndex;
-
- var panel = tabBrowser.getTabPanelElement(tabIndex,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
-
- for (let testURL of urlsWithInlineRedirect) {
- testURL = testURLPrePath + testURL;
- controller.open(testURL);
-
- controller.waitForPageLoad();
- controller.sleep(1000);
-
- expect.ok(!panel.exists(), "The redirect notification bar is hidden.");
-
- tabBrowser.closeAllTabs();
-
- // It's necessary to wait for the notification panel to be closed. If we
- // don't wait for that to happen, the next URL in urlsWithInlineRedirect
- // might already be displayed while the panel is still there.
- controller.waitFor((() => !panel.exists()), "No panel is being displayed " +
- "because all tabs have been closed.");
- }
-}
diff --git a/tests/mozmill/tests/testRedirect/testLinkClickRedirect.js b/tests/mozmill/tests/testRedirect/testLinkClickRedirect.js
deleted file mode 100644
index 0b0021d..0000000
--- a/tests/mozmill/tests/testRedirect/testLinkClickRedirect.js
+++ /dev/null
@@ -1,88 +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/. */
-
-"use strict";
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-var testURLs = [
- "http://www.maindomain.test/redirect-js-document-location-link.html",
- "http://www.maindomain.test/redirect-links.html"
-];
-
-
-var setupModule = function(aModule) {
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-}
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-var testLinkClickRedirect = function() {
- let tabIndex = tabBrowser.selectedIndex;
-
- for (let testURL of testURLs) {
- dump("Visiting " + testURL + ".\n");
-
- controller.open(testURL);
- controller.waitForPageLoad();
-
- let len = rpUtils.getNumLinks(controller);
-
- for (let i = 0; i < len; ++i) {
- dump("Testing link " + i + ".\n");
-
- controller.open(testURL);
- controller.waitForPageLoad();
-
- let link = rpUtils.getLink(controller, i);
- let classNode = link.getNode().attributes.class;
- let redirectShouldBeAllowed = classNode ?
- classNode.nodeValue.indexOf("redirectShouldBeAllowed") >= 0 : false;
- let url = link.getNode().href;
- link.click();
-
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(0));
-
- var panel = tabBrowser.getTabPanelElement(tabIndex,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
-
- if (redirectShouldBeAllowed) {
- // fixme: find a better waitFor-function that ensures that the part of
- // RP which is responsible for showing the panel *really* has
- // finished.
- controller.waitFor(function() {
- return controller.window.content.document.location.href !== url;
- }, "The URL in the urlbar has changed.");
- expect.ok(!panel.exists(), "The redirect notification bar is hidden.");
- } else {
- controller.waitFor((() => panel.exists()), "The redirect " +
- "notification bar has been displayed.");
- }
-
- tabBrowser.closeAllTabs();
-
- // It's necessary to wait for the notification panel to be closed. If we
- // don't wait for that to happen, the next URL in urlsWithRedirect might
- // already be displayed while the panel is still there.
- controller.waitFor((() => !panel.exists()), "No panel is being " +
- "displayed because all tabs have been closed.");
- }
- }
-}
diff --git a/tests/mozmill/tests/testRedirect/testLinkClickRedirectInNewTab.js b/tests/mozmill/tests/testRedirect/testLinkClickRedirectInNewTab.js
deleted file mode 100644
index 9271fca..0000000
--- a/tests/mozmill/tests/testRedirect/testLinkClickRedirectInNewTab.js
+++ /dev/null
@@ -1,117 +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/. */
-
-"use strict";
-
-/* global require, mozmill */
-/* exported setupModule, teardownModule, testLinkClickRedirectInNewTab */
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var {assert, expect} = require(rootDir + "lib/assertions");
-var prefs = require(rootDir + "lib/prefs");
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-
-var testURLs = [
- // fixme: as soon as #599 is fixed, uncomment the following line:
- //"http://www.maindomain.test/redirect-js-document-location-link.html",
- "http://www.maindomain.test/redirect-links.html"
-];
-
-
-var setupModule = function(aModule) {
- /* global controller, tabBrowser */
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- prefs.setPref(rpConst.PREF_DEFAULT_ALLOW, false);
-};
-
-var teardownModule = function(aModule) {
- prefs.clearUserPref(rpConst.PREF_DEFAULT_ALLOW);
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-function Link(mozmillElement) {
- this.element = mozmillElement;
- this.node = this.element.getNode();
-
- let classNode = this.node.attributes.class;
- this.redirectShouldBeAllowed = classNode ?
- classNode.nodeValue.indexOf("redirectShouldBeAllowed") >= 0 : false;
-
- this.href = this.node.href;
-}
-
-
-var testLinkClickRedirectInNewTab = function() {
-
- testURLs.forEach(function(testURL) {
- controller.open(testURL);
- controller.waitForPageLoad();
-
- // Create an array of Link() objects, one for each <a>
- // anchor element on the page.
- let links = rpUtils.getLinks(controller)
- .map((l) => new Link(l));
-
- assert.ok(links.length > 0,
- "There is at least one link on test page '" + testURL + "'");
-
- // Test all links by opening them both via context menu and via
- // middle click.
- let testCombinations = rpUtils.combinations([
- links,
- ["contextMenu", "middleClick"]
- ]);
-
- testCombinations.forEach(function([link, tabOpenMethod], curIndex) {
- let curTabIndex = curIndex + 1;
-
- openLinkInTab(tabBrowser, link, tabOpenMethod);
-
- rpUtils.waitForTabLoad(controller, tabBrowser.getTab(curTabIndex));
-
- expect.ok(!panelExists(0), "The redirect notification bar is not " +
- "displayed on the main tab after opening");
-
- if (link.redirectShouldBeAllowed) {
- // fixme: find a better waitFor-function that ensures that the part of
- // RP which is responsible for showing the panel *really* has
- // finished.
- controller.waitFor(function() {
- return controller.window.content.document.location.href !== link.href;
- }, "The URL in the urlbar has changed.");
-
- expect.ok(!panelExists(curTabIndex),
- "The redirect notification bar is hidden.");
- } else {
- controller.waitFor(
- () => panelExists(curTabIndex),
- "The redirect notification bar has been displayed " +
- "for '" + link.href + "' on '" + testURL + "' with tab " +
- "open method '" + tabOpenMethod + "'.");
- }
- });
-
- tabBrowser.closeAllTabs();
- });
-};
-
-function panelExists(index = 0) {
- let panel = tabBrowser.getTabPanelElement(index,
- '/{"value":"' + rpConst.REDIRECT_NOTIFICATION_VALUE + '"}');
- return panel.exists();
-}
-
-
-function openLinkInTab(tabBrowser, link, tabOpenMethod="contextMenu") {
- tabBrowser.openTab({method: tabOpenMethod, target: link.element});
-}
diff --git a/tests/mozmill/tests/testRequestLog/manifest.ini b/tests/mozmill/tests/testRequestLog/manifest.ini
deleted file mode 100644
index 4c16c93..0000000
--- a/tests/mozmill/tests/testRequestLog/manifest.ini
+++ /dev/null
@@ -1 +0,0 @@
-[testUriWithoutHost.js]
diff --git a/tests/mozmill/tests/testRequestLog/testUriWithoutHost.js b/tests/mozmill/tests/testRequestLog/testUriWithoutHost.js
deleted file mode 100644
index 7348519..0000000
--- a/tests/mozmill/tests/testRequestLog/testUriWithoutHost.js
+++ /dev/null
@@ -1,66 +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/. */
-
-"use strict";
-
-/* global require, mozmill */
-/* exported setupModule, teardownModule, testUnknownScheme */
-
-var rpRootDir = "../../";
-var rpConst = require(rpRootDir + "lib/constants");
-var rootDir = rpRootDir + rpConst.mozmillTestsRootDir;
-
-var tabs = require(rootDir + "firefox/lib/tabs");
-
-var rpUtils = require(rpRootDir + "lib/rp-utils");
-var requestLogUtils = require(rpRootDir + "lib/request-log-utils");
-
-var TEST_URL = "http://www.maindomain.test/scheme-unknown-and-without-host.html";
-
-
-var setupModule = function (aModule) {
- /* global controller, tabBrowser */
- aModule.controller = mozmill.getBrowserController();
- aModule.tabBrowser = new tabs.tabBrowser(aModule.controller);
- aModule.tabBrowser.closeAllTabs();
-
- aModule.requestLog = new requestLogUtils.RequestLog(aModule.controller);
- aModule.requestLog.open();
- aModule.requestLog.clear();
-}
-
-var teardownModule = function (aModule) {
- aModule.requestLog.close();
- aModule.tabBrowser.closeAllTabs();
-}
-
-
-function countDestination(aCompareValue) {
- return requestLog.getDestinations().filter(function (aValue) {
- return aCompareValue === aValue;
- }).length;
-}
-
-
-/**
- * Test that the request log will display URIs without
- * a host.
- */
-var testRequestLogShowsUriWithoutHost = function() {
- controller.open(TEST_URL);
- controller.waitForPageLoad();
-
- let link = rpUtils.getLink(controller);
- let linkURI = link.getNode().href;
-
- assert.equal(countDestination(linkURI), 0,
- "There is no entry in the request log with '" + linkURI +
- "' as the destination.");
-
- link.click();
-
- assert.equal(countDestination(linkURI), 1,
- "There is exactly one entry in the request log with '" +
- linkURI + "' as the destination.");
-}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list