Bug 986807 patch 3 - Use preprocessor to avoid duplicating reftest default preference lists. r=ted

Note that the reordering in Makefile.in is because the addition to
PP_TARGETS must be before including rules.mk.  (Logically, I was moving
_DEST_DIR, _HARNESS_FILES, and the _HARNESS_PP_FILES chunk up, but diff
shows it the other way around.)
This commit is contained in:
L. David Baron 2014-03-28 20:13:25 -07:00
parent ced90ac096
commit e9a0af4985
6 changed files with 76 additions and 158 deletions

View File

@ -23,30 +23,13 @@ else
EXTRA_COMPONENTS += reftest-cmdline.manifest
endif
include $(topsrcdir)/config/rules.mk
# We're installing to _tests/reftest
TARGET_DEPTH = ../..
include $(topsrcdir)/build/automation-build.mk
_DEST_DIR = $(DEPTH)/_tests/reftest
# We want to get an extension-packaged version of reftest as well,
# so this seems to be the simplest way to make that happen.
ifndef XPI_NAME
make-xpi:
+$(MAKE) -C $(DEPTH)/netwerk/test/httpserver libs XPI_NAME=reftest
+$(MAKE) libs XPI_NAME=reftest
copy-harness: make-xpi
libs:: copy-harness
endif
_HARNESS_FILES = \
$(srcdir)/runreftest.py \
$(srcdir)/remotereftest.py \
$(srcdir)/runreftestb2g.py \
$(srcdir)/b2g_desktop.py \
$(srcdir)/b2g_start_script.js \
automation.py \
$(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanager.py \
$(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py \
@ -60,13 +43,35 @@ _HARNESS_FILES = \
$(topsrcdir)/build/pgo/server-locations.txt \
$(NULL)
_HARNESS_PP_FILES = \
b2g_start_script.js \
$(NULL)
_HARNESS_PP_FILES_PATH = $(_DEST_DIR)
PP_TARGETS += _HARNESS_PP_FILES
include $(topsrcdir)/config/rules.mk
# We're installing to _tests/reftest
TARGET_DEPTH = ../..
include $(topsrcdir)/build/automation-build.mk
# We want to get an extension-packaged version of reftest as well,
# so this seems to be the simplest way to make that happen.
ifndef XPI_NAME
make-xpi:
+$(MAKE) -C $(DEPTH)/netwerk/test/httpserver libs XPI_NAME=reftest
+$(MAKE) libs XPI_NAME=reftest
copy-harness: make-xpi
libs:: copy-harness
endif
$(_DEST_DIR):
$(NSINSTALL) -D $@
$(_HARNESS_FILES): $(_DEST_DIR)
# copy harness and the reftest extension bits to $(_DEST_DIR)
copy-harness: $(_HARNESS_FILES)
copy-harness: $(_HARNESS_FILES) $(addprefix $(_DEST_DIR)/,$(_HARNESS_PP_FILES))
$(INSTALL) $(_HARNESS_FILES) $(_DEST_DIR)
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - reftest) | (cd $(_DEST_DIR) && tar -xf -)

View File

@ -3,52 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function setDefaultPrefs() {
// This code sets the preferences for extension-based reftest; for
// command-line based reftest they are set in function handler_handle in
// reftest-cmdline.js. These two locations should stay in sync.
//
// FIXME: These should be in only one place.
// This code sets the preferences for extension-based reftest.
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
var branch = prefs.getDefaultBranch("");
branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
branch.setBoolPref("gfx.color_management.force_srgb", true);
branch.setBoolPref("browser.dom.window.dump.enabled", true);
branch.setIntPref("ui.caretBlinkTime", -1);
branch.setBoolPref("dom.send_after_paint_to_content", true);
// no slow script dialogs
branch.setIntPref("dom.max_script_run_time", 0);
branch.setIntPref("dom.max_chrome_script_run_time", 0);
branch.setIntPref("hangmonitor.timeout", 0);
// Ensure autoplay is enabled for all platforms.
branch.setBoolPref("media.autoplay.enabled", true);
// Disable updates
branch.setBoolPref("app.update.enabled", false);
// Disable addon updates and prefetching so we don't leak them
branch.setBoolPref("extensions.update.enabled", false);
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
// Disable blocklist updates so we don't have them reported as leaks
branch.setBoolPref("extensions.blocklist.enabled", false);
// Make url-classifier updates so rare that they won't affect tests
branch.setIntPref("urlclassifier.updateinterval", 172800);
// Disable high-quality downscaling, since it makes reftests more difficult.
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
// Checking whether two files are the same is slow on Windows.
// Setting this pref makes tests run much faster there.
branch.setBoolPref("security.fileuri.strict_origin_policy", false);
// Disable the thumbnailing service
branch.setBoolPref("browser.pagethumbnails.capturing_disabled", true);
// Enable APZC so we can test it
branch.setBoolPref("layers.async-pan-zoom.enabled", true);
// Since our tests are 800px wide, set the assume-designed-for width of all
// pages to be 800px (instead of the default of 980px). This ensures that
// in our 800px window we don't zoom out by default to try to fit the
// assumed 980px content.
branch.setIntPref("browser.viewport.desktopWidth", 800);
// Disable the fade out (over time) of overlay scrollbars, since we
// can't guarantee taking both reftest snapshots at the same point
// during the fade.
branch.setBoolPref("layout.testing.overlay-scrollbars.always-visible", true);
#include reftest-preferences.js
}
function setPermissions() {

View File

@ -4,56 +4,12 @@ function loadIntoWindow(window) {}
function unloadFromWindow(window) {}
function setDefaultPrefs() {
// This code sets the preferences for extension-based reftest; for
// command-line based reftest they are set in function handler_handle in
// reftest-cmdline.js. These two locations should stay in sync.
//
// FIXME: These should be in only one place.
// This code sets the preferences for extension-based reftest.
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefService);
var branch = prefs.getDefaultBranch("");
// For mochitests, we're more interested in testing the behavior of in-
// content XBL bindings, so we set this pref to true. In reftests, we're
// more interested in testing the behavior of XBL as it works in chrome,
// so we want this pref to be false.
branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
branch.setBoolPref("gfx.color_management.force_srgb", true);
branch.setBoolPref("browser.dom.window.dump.enabled", true);
branch.setIntPref("ui.caretBlinkTime", -1);
branch.setBoolPref("dom.send_after_paint_to_content", true);
// no slow script dialogs
branch.setIntPref("dom.max_script_run_time", 0);
branch.setIntPref("dom.max_chrome_script_run_time", 0);
branch.setIntPref("hangmonitor.timeout", 0);
// Ensure autoplay is enabled for all platforms.
branch.setBoolPref("media.autoplay.enabled", true);
// Disable updates
branch.setBoolPref("app.update.enabled", false);
// Disable addon updates and prefetching so we don't leak them
branch.setBoolPref("extensions.update.enabled", false);
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
// Disable blocklist updates so we don't have them reported as leaks
branch.setBoolPref("extensions.blocklist.enabled", false);
// Make url-classifier updates so rare that they won't affect tests
branch.setIntPref("urlclassifier.updateinterval", 172800);
// Disable high-quality downscaling, since it makes reftests more difficult.
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
// Checking whether two files are the same is slow on Windows.
// Setting this pref makes tests run much faster there.
branch.setBoolPref("security.fileuri.strict_origin_policy", false);
// Disable the thumbnailing service
branch.setBoolPref("browser.pagethumbnails.capturing_disabled", true);
// Enable APZC so we can test it
branch.setBoolPref("layers.async-pan-zoom.enabled", true);
// Since our tests are 800px wide, set the assume-designed-for width of all
// pages to be 800px (instead of the default of 980px). This ensures that
// in our 800px window we don't zoom out by default to try to fit the
// assumed 980px content.
branch.setIntPref("browser.viewport.desktopWidth", 800);
// Disable the fade out (over time) of overlay scrollbars, since we
// can't guarantee taking both reftest snapshots at the same point
// during the fade.
branch.setBoolPref("layout.testing.overlay-scrollbars.always-visible", true);
#include reftest-preferences.js
}
var windowListener = {

View File

@ -4,8 +4,8 @@
# 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/.
EXTRA_COMPONENTS += [
EXTRA_PP_COMPONENTS += [
'reftest-cmdline.js',
]
JAR_MANIFESTS += ['jar.mn']
JAR_MANIFESTS += ['jar.mn']

View File

@ -66,58 +66,12 @@ RefTestCmdLineHandler.prototype =
* We want to do this here rather than in reftest.js because it's
* important to force sRGB as an output profile for color management
* before we load a window.
*
* If you change these, please adjust them in the bootstrap.js function
* setDefaultPrefs(). These are duplicated there so we can have a
* restartless addon for reftest on native Android.
*
* FIXME: These should be in only one place.
*/
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefService);
var branch = prefs.getDefaultBranch("");
// For mochitests, we're more interested in testing the behavior of in-
// content XBL bindings, so we set this pref to true. In reftests, we're
// more interested in testing the behavior of XBL as it works in chrome,
// so we want this pref to be false.
branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
branch.setBoolPref("gfx.color_management.force_srgb", true);
branch.setBoolPref("browser.dom.window.dump.enabled", true);
branch.setIntPref("ui.caretBlinkTime", -1);
branch.setBoolPref("dom.send_after_paint_to_content", true);
// no slow script dialogs
branch.setIntPref("dom.max_script_run_time", 0);
branch.setIntPref("dom.max_chrome_script_run_time", 0);
branch.setIntPref("hangmonitor.timeout", 0);
// Ensure autoplay is enabled for all platforms.
branch.setBoolPref("media.autoplay.enabled", true);
// Disable updates
branch.setBoolPref("app.update.enabled", false);
// Disable addon updates and prefetching so we don't leak them
branch.setBoolPref("extensions.update.enabled", false);
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
// Disable blocklist updates so we don't have them reported as leaks
branch.setBoolPref("extensions.blocklist.enabled", false);
// Make url-classifier updates so rare that they won't affect tests
branch.setIntPref("urlclassifier.updateinterval", 172800);
// Disable high-quality downscaling, since it makes reftests more difficult.
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
// Checking whether two files are the same is slow on Windows.
// Setting this pref makes tests run much faster there.
branch.setBoolPref("security.fileuri.strict_origin_policy", false);
// Disable the thumbnailing service
branch.setBoolPref("browser.pagethumbnails.capturing_disabled", true);
// Enable APZC so we can test it
branch.setBoolPref("layers.async-pan-zoom.enabled", true);
// Since our tests are 800px wide, set the assume-designed-for width of all
// pages to be 800px (instead of the default of 980px). This ensures that
// in our 800px window we don't zoom out by default to try to fit the
// assumed 980px content.
branch.setIntPref("browser.viewport.desktopWidth", 800);
// Disable the fade out (over time) of overlay scrollbars, since we
// can't guarantee taking both reftest snapshots at the same point
// during the fade.
branch.setBoolPref("layout.testing.overlay-scrollbars.always-visible", true);
#include reftest-preferences.js
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher);

View File

@ -0,0 +1,43 @@
// For mochitests, we're more interested in testing the behavior of in-
// content XBL bindings, so we set this pref to true. In reftests, we're
// more interested in testing the behavior of XBL as it works in chrome,
// so we want this pref to be false.
branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
branch.setBoolPref("gfx.color_management.force_srgb", true);
branch.setBoolPref("browser.dom.window.dump.enabled", true);
branch.setIntPref("ui.caretBlinkTime", -1);
branch.setBoolPref("dom.send_after_paint_to_content", true);
// no slow script dialogs
branch.setIntPref("dom.max_script_run_time", 0);
branch.setIntPref("dom.max_chrome_script_run_time", 0);
branch.setIntPref("hangmonitor.timeout", 0);
// Ensure autoplay is enabled for all platforms.
branch.setBoolPref("media.autoplay.enabled", true);
// Disable updates
branch.setBoolPref("app.update.enabled", false);
// Disable addon updates and prefetching so we don't leak them
branch.setBoolPref("extensions.update.enabled", false);
branch.setBoolPref("extensions.getAddons.cache.enabled", false);
// Disable blocklist updates so we don't have them reported as leaks
branch.setBoolPref("extensions.blocklist.enabled", false);
// Make url-classifier updates so rare that they won't affect tests
branch.setIntPref("urlclassifier.updateinterval", 172800);
// Disable high-quality downscaling, since it makes reftests more difficult.
branch.setBoolPref("image.high_quality_downscaling.enabled", false);
// Checking whether two files are the same is slow on Windows.
// Setting this pref makes tests run much faster there.
branch.setBoolPref("security.fileuri.strict_origin_policy", false);
// Disable the thumbnailing service
branch.setBoolPref("browser.pagethumbnails.capturing_disabled", true);
// Enable APZC so we can test it
branch.setBoolPref("layers.async-pan-zoom.enabled", true);
// Since our tests are 800px wide, set the assume-designed-for width of all
// pages to be 800px (instead of the default of 980px). This ensures that
// in our 800px window we don't zoom out by default to try to fit the
// assumed 980px content.
branch.setIntPref("browser.viewport.desktopWidth", 800);
// Disable the fade out (over time) of overlay scrollbars, since we
// can't guarantee taking both reftest snapshots at the same point
// during the fade.
branch.setBoolPref("layout.testing.overlay-scrollbars.always-visible", true);