Bug 1451159 - [testing/profiles] Store profile data in actual profile look alike folders r=gbrown

This moves testing/profiles/prefs_general.js to
testing/profiles/common/user.js. It also adds an 'extensions' folder to the
common profile. Dropping extension files here will get them installed in all
test harnesses (useful for testing on try).

The idea is that all test harnesses will eventually use this 'common' profile.
We'll also create some new per harness profiles, e.g testing/profiles/mochitest
and testing/profiles/reftest. This way there will be a single location
developers can go to set preferences, both for a specific harness, and across
all harnesses.

MozReview-Commit-ID: 8sqBqLiypgU

--HG--
rename : testing/profiles/prefs_general.js => testing/profiles/common/user.js
extra : rebase_source : 7599913e547533f2f57b597ad0f238c6cd391c82
This commit is contained in:
Andrew Halberstadt 2018-04-19 16:12:26 -04:00
parent fe14ba967c
commit fd23fd839b
16 changed files with 25 additions and 34 deletions

View File

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Bug 1453317 - Update VS2017 used for builds in automation to version 15.6.6.
Bug 1451159 - Moved testing/profiles/prefs_general.js (prevents symlinked file does not exist)

View File

@ -76,8 +76,9 @@ async function pause(tab, options) {
ok(!tab.hasAttribute("soundplaying"), "The tab should not have the soundplaying attribute after the timeout has resolved");
} finally {
// Make sure other tests don't timeout if an exception gets thrown above.
// Need to use setIntPref instead of clearUserPref because prefs_general.js
// overrides the default value to help this and other tests run faster.
// Need to use setIntPref instead of clearUserPref because
// testing/profiles/common/user.js overrides the default value to help this and
// other tests run faster.
Services.prefs.setIntPref(TABATTR_REMOVAL_PREFNAME, INITIAL_TABATTR_REMOVAL_DELAY_MS);
}
}

View File

@ -16,10 +16,10 @@ add_task(async function test_disable_firefox_screenshots() {
// that pref is being watched, and it makes the Firefox Screenshots system add-on
// to start or stop, causing intermittency.
//
// Firefox Screenshots is disabled by default on tests (in prefs_general.js).
// What we do here to test this policy is to enable it on this specific
// test folder (through browser.ini) and then we let the policy engine
// be responsible for disabling Firefox Screenshots in this case.
// Firefox Screenshots is disabled by default on tests (in
// testing/profiles/common/user.js). What we do here to test this policy is to enable
// it on this specific test folder (through browser.ini) and then we let the policy
// engine be responsible for disabling Firefox Screenshots in this case.
is(Services.prefs.getBoolPref(PREF_DISABLE_FX_SCREENSHOTS), true, "Screenshots pref is disabled");

View File

@ -26,7 +26,7 @@ function promisePocketDisabled() {
return Promise.resolve(true);
}
info("reset pocket enabled pref");
// testing/profiles/prefs_general.js uses user_pref to disable pocket, set
// testing/profiles/common/user.js uses user_pref to disable pocket, set
// back to false.
Services.prefs.setBoolPref("extensions.pocket.enabled", false);
return BrowserTestUtils.waitForCondition(() => {

View File

@ -35,8 +35,6 @@ from mozscreenshot import printstatus, dump_screen
# ---------------------------------------------------------------
_DEFAULT_PREFERENCE_FILE = os.path.join(SCRIPT_DIR, 'prefs_general.js')
_DEFAULT_WEB_SERVER = "127.0.0.1"
_DEFAULT_HTTP_PORT = 8888
_DEFAULT_SSL_PORT = 4443

View File

@ -44,7 +44,7 @@ if __name__ == '__main__':
with TemporaryDirectory() as profilePath:
# TODO: refactor this into mozprofile
prefpath = os.path.join(
build.topsrcdir, "testing", "profiles", "prefs_general.js")
build.topsrcdir, "testing", "profiles", "common", "user.js")
overridepath = os.path.join(
build.topsrcdir, "build", "pgo", "prefs_override.js")

View File

@ -65,7 +65,7 @@ class MachCommands(MachCommandBase):
with TemporaryDirectory() as profilePath:
#TODO: refactor this into mozprofile
prefpath = os.path.join(self.topsrcdir, 'testing', 'profiles', 'prefs_general.js')
prefpath = os.path.join(self.topsrcdir, 'testing', 'profiles', 'common', 'user.js')
prefs = {}
prefs.update(Preferences.read_prefs(prefpath))
interpolation = { 'server': '%s:%d' % httpd.httpd.server_address,

View File

@ -72,7 +72,7 @@ mochitest-harness:
- 'testing/mozharness/mozharness/base/log.py'
- 'testing/mozharness/mozharness/mozilla/structuredlog.py'
- 'testing/mozharness/mozharness/mozilla/testing/errors.py'
- 'testing/profiles/prefs_general.js'
- 'testing/profiles/**'
mozbase:
description: testing/mozbase unit tests

View File

@ -99,12 +99,7 @@ class JUnitTestRunner(MochitestDesktop):
Create a local profile with test prefs and proxy definitions and
push it to the remote device.
"""
preferences = [
os.path.join(
here,
'profile_data',
'prefs_general.js')]
preferences = [os.path.join(here, 'profile_data', 'common', 'user.js')]
prefs = {}
for path in preferences:
prefs.update(Preferences.read_prefs(path))

View File

@ -1858,12 +1858,7 @@ toolbar#nav-bar {
extensions = self.getExtensionsToInstall(options)
# preferences
preferences = [
os.path.join(
SCRIPT_DIR,
'profile_data',
'prefs_general.js')]
preferences = [os.path.join(SCRIPT_DIR, 'profile_data', 'common', 'user.js')]
prefs = {}
for path in preferences:
prefs.update(Preferences.read_prefs(path))

View File

@ -0,0 +1,2 @@
Dropping extensions here will get them installed in all test harnesses
that make use of this profile.

View File

@ -4,12 +4,12 @@
# 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/.
mochitest_profile_files = [
'prefs_general.js',
profiles = [
'common/*',
]
TEST_HARNESS_FILES.testing.mochitest.profile_data += mochitest_profile_files
TEST_HARNESS_FILES['web-platform'].prefs += mochitest_profile_files
TEST_HARNESS_FILES.testing.mochitest.profile_data += profiles
TEST_HARNESS_FILES['web-platform'].prefs += ['common/user.js']
with Files("**"):
BUG_COMPONENT = ("Testing", "Mochitest")

View File

@ -243,7 +243,7 @@ stage-steeplechase: make-stage-dir
$(NSINSTALL) -D $(PKG_STAGE)/steeplechase/
cp -RL $(DEPTH)/_tests/steeplechase $(PKG_STAGE)/steeplechase/tests
cp -RL $(DIST)/xpi-stage/specialpowers $(PKG_STAGE)/steeplechase
cp -RL $(topsrcdir)/testing/profiles/prefs_general.js $(PKG_STAGE)/steeplechase
cp -RL $(topsrcdir)/testing/profiles/common/user.js $(PKG_STAGE)/steeplechase/prefs_general.js
TEST_EXTENSIONS := \
specialpowers@mozilla.org.xpi \

View File

@ -205,7 +205,7 @@ class Firefox(Browser):
# can get if we have an application.ini file
tag = "tip"
return "%s/raw-file/%s/testing/profiles/prefs_general.js" % (repo, tag)
return "%s/raw-file/%s/testing/profiles/common/user.js" % (repo, tag)
def install_prefs(self, binary, dest=None):
version, channel = self.get_version_number(binary)
@ -213,10 +213,10 @@ class Firefox(Browser):
if dest is None:
dest = os.pwd
dest = os.path.join(dest, "profiles")
dest = os.path.join(dest, "profiles", "common")
if not os.path.exists(dest):
os.makedirs(dest)
prefs_file = os.path.join(dest, "prefs_general.js")
prefs_file = os.path.join(dest, "user.js")
cache_file = os.path.join(dest,
"%s-%s.cache" % (version, channel)
if channel != "nightly"

View File

@ -245,7 +245,7 @@ class FirefoxBrowser(Browser):
def load_prefs(self):
prefs = Preferences()
prefs_path = os.path.join(self.prefs_root, "prefs_general.js")
prefs_path = os.path.join(self.prefs_root, "user.js")
if os.path.exists(prefs_path):
prefs.add(Preferences.read_prefs(prefs_path))
else: