diff --git a/HACKING b/HACKING index 1bfaea07..6b4ca69f 100644 --- a/HACKING +++ b/HACKING @@ -133,12 +133,20 @@ In general: Just look at the existing source code! Wrong: function splitStr() -== Testing/Optimization == +== Testing == -TODO: Add some information here about testing/validation/etc. -Information about how/when to use :regressions might be nice. -Additionally, maybe there should be some benchmark information here -- -something to let a developer know what's "too" slow...? Or general -guidelines about optimization? +Functional tests are implemented using the Mozmill automated testing framework +-- https://developer.mozilla.org/en/Mozmill_Tests. -// vim: set ft=asciidoc fdm=marker sw=4 ts=4 et ai: +A fresh profile is created for the duration of the test run, however, passing +arguments to the host application won't be supported until Mozmill 1.5.2, the +next release, so any user RC and plugin files should be temporarily disabled. +This can be done by adding the following to the head of the RC file: +set loadplugins= +finish + +The host application binary tested can be overridden via the HOSTAPP_PATH +makefile variable. E.g., +$ HOSTAPP_PATH=/path/to/firefox make -e -C pentadactyl test + +// vim: fdm=marker sw=4 ts=4 et ai: diff --git a/common/Makefile b/common/Makefile index 64441a35..f2460f4e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -9,6 +9,9 @@ GOOGLE = https://$(GOOGLE_PROJ).googlecode.com/files VERSION ?= $(shell sed -n 's/.*em:version\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q) UUID := $(shell sed -n 's/.*em:id\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q) MANGLE := $(shell date '+%s' | awk '{ printf "%x", $$1 }') +MOZMILL = mozmill +HOSTAPP_PATH = $(shell which $(HOSTAPP)) +TEST_DIR = $(BASE)/tests/functional LOCALEDIR = locale DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml) @@ -48,7 +51,7 @@ CURL ?= curl #### rules -TARGETS = all help info jar xpi install clean distclean install installxpi $(CHROME) $(JAR) +TARGETS = all help info jar xpi install clean distclean install installxpi test $(CHROME) $(JAR) $(TARGETS:%=\%.%): echo MAKE $* $(@:$*.%=%) $(MAKE) -C $* $(@:$*.%=%) @@ -71,6 +74,7 @@ help: @echo " make dist - uploads to Google Code (this is not for you)" @echo " make clean - clean up" @echo " make distclean - clean up more" + @echo " make test - run functional tests" @echo @echo "running some commands with V=1 will show more build details" @@ -158,6 +162,11 @@ distclean: @echo "More $(NAME) cleanup..." rm -rf $(BUILD_DIR) +# TODO: generalize log path +test: $(XPI) + @echo "Running functional tests..." + $(MOZMILL) --show-all -l /tmp/dactyl-test.log -b $(HOSTAPP_PATH) --addons $(XPI) -t $(TEST_DIR) + #### xpi $(XPI): $(CHROME) diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 7fe61ab0..8b741d9a 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -105,7 +105,7 @@ var Bookmarks = Module("bookmarks", { */ addSearchKeyword: function (elem) { if (elem instanceof HTMLFormElement || elem.form) - var [url, post,, charset] = util.parseForm(elem); + var [url, post, charset] = util.parseForm(elem); else var [url, post, charset] = [elem.href || elem.src, null, elem.ownerDocument.characterSet]; diff --git a/common/content/statusline.js b/common/content/statusline.js index ccc3b454..f76eac28 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -12,7 +12,7 @@ var StatusLine = Module("statusline", { init: function () { this._statusLine = document.getElementById("status-bar"); this.statusBar = document.getElementById("addon-bar") || this._statusLine; - this.statusBar.collapsed = true; // it is later restored unless the user sets laststatus=0 + this.statusBar.collapsed = true; this.baseGroup = this.statusBar == this._statusLine ? "StatusLine " : ""; if (this.statusBar.localName == "toolbar") { diff --git a/common/locale/en-US/gui.xml b/common/locale/en-US/gui.xml index e7054858..ed6e13e9 100644 --- a/common/locale/en-US/gui.xml +++ b/common/locale/en-US/gui.xml @@ -211,8 +211,9 @@
- The status line appears at the bottom of each window. The
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index 2ffc9586..1a5e5b7a 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -169,8 +169,12 @@ function endModule() {
function require(obj, name, from) {
try {
+ if (arguments.length === 1)
+ [obj, name] = [{}, obj];
+
defineModule.loadLog.push((from || "require") + ": loading " + name + " into " + obj.NAME);
JSMLoader.load(name + ".jsm", obj);
+ return obj;
}
catch (e) {
defineModule.dump("loading " + String.quote(name + ".jsm") + "\n");
diff --git a/common/modules/config.jsm b/common/modules/config.jsm
index ca65a065..0e818d3f 100644
--- a/common/modules/config.jsm
+++ b/common/modules/config.jsm
@@ -8,6 +8,7 @@
try {
+let global = this;
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("config", {
exports: ["ConfigBase", "Config", "config"],
@@ -54,7 +55,7 @@ var ConfigBase = Class("ConfigBase", {
addon: Class.memoize(function () {
let addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon;
if (!addon)
- addon = AddonManager.getAddonByID(this.addonID);
+ addon = require("addons").AddonManager.getAddonByID(this.addonID);
return addon;
}),
diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm
index ac9496f0..9065a44f 100644
--- a/common/modules/highlight.jsm
+++ b/common/modules/highlight.jsm
@@ -145,10 +145,10 @@ var Highlights = Module("Highlight", {
let highlight = this.highlight[key] || this._create(false, [key]);
- let extends = extend || highlight.extend;
+ let bases = extend || highlight.extend;
if (append) {
newStyle = Styles.append(highlight.value || "", newStyle);
- extends = highlight.extends.concat(extends);
+ bases = highlight.extends.concat(bases);
}
if (/^\s*$/.test(newStyle))
@@ -161,11 +161,11 @@ var Highlights = Module("Highlight", {
return null;
}
newStyle = highlight.defaultValue;
- extends = highlight.defaultExtends;
+ bases = highlight.defaultExtends;
}
highlight.set("value", newStyle || "");
- highlight.extends = array.uniq(extends, true);
+ highlight.extends = array.uniq(bases, true);
if (force)
highlight.style.enabled = true;
this.highlight[highlight.class] = highlight;
diff --git a/common/modules/io.jsm b/common/modules/io.jsm
index 0aaa3c9e..a60c4ea5 100644
--- a/common/modules/io.jsm
+++ b/common/modules/io.jsm
@@ -836,7 +836,7 @@ unlet s:cpo_save
let result = io.system(arg);
if (result.returnValue != 0)
- result.output += "\nshell returned " + res;
+ result.output += "\nshell returned " + result.returnValue;
modules.commandline.command = "!" + arg;
modules.commandline.commandOutput({result.output});
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index 3f521db7..f66fac87 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -1179,7 +1179,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
}
}
if (post)
- return [url, elems.join('&'), elems, charset];
+ return [url, elems.join('&'), charset, elems];
return [url + "?" + elems.join('&'), null, charset];
},
diff --git a/pentadactyl/regressions.js b/pentadactyl/regressions.js
deleted file mode 100644
index bea1a864..00000000
--- a/pentadactyl/regressions.js
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright (c) 2009 by Martin Stubenschrott
-
- It should not do any harm to your profile, but your current settings like options,
- abbreviations or mappings might not be in the same state as before running the tests.
- Just make sure, you don't :mkpentadactylrc, after running the tests.
-
-
- Use :regressions! to skip this prompt.
-