Bug 1420514 - Replace app.update.enabled with app.update.disabledForTesting in the test harness draft
authorKirk Steuber <ksteuber@mozilla.com>
Tue, 22 May 2018 09:14:19 -0700
changeset 818955 588f5b801bc4e04dbe1396bd4012b747b6e99fba
parent 818954 8f49a1e77b56c2c02079f146f8ccedaeae59da8c
child 818956 be5c7b023eb4eab40e80fb6a398fe94f1199c8e1
push id116400
push userbmo:ksteuber@mozilla.com
push dateMon, 16 Jul 2018 20:42:55 +0000
bugs1420514
milestone63.0a1
Bug 1420514 - Replace app.update.enabled with app.update.disabledForTesting in the test harness MozReview-Commit-ID: GCGKQ5QCC7o
js/src/tests/user.js
testing/geckodriver/src/prefs.rs
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/components/marionette.js
testing/mozbase/mozprofile/mozprofile/profile.py
testing/profiles/common/user.js
testing/raptor/test/test_raptor.py
testing/talos/talos/unittests/test_talosconfig_browser_config.json
testing/tps/tps/testrunner.py
toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
--- a/js/src/tests/user.js
+++ b/js/src/tests/user.js
@@ -1,9 +1,9 @@
-user_pref("app.update.enabled", false);
+user_pref("app.update.disabledForTesting", true);
 user_pref("browser.dom.window.dump.enabled", true);
 user_pref("browser.sessionstore.resume_from_crash", false);
 user_pref("browser.shell.checkDefaultBrowser", false);
 user_pref("browser.xul.error_pages.enabled", true);
 user_pref("security.fileuri.strict_origin_policy", false);
 user_pref("dom.allow_scripts_to_close_windows", true);
 user_pref("dom.disable_open_during_load", false);
 user_pref("dom.max_script_run_time", 0);
--- a/testing/geckodriver/src/prefs.rs
+++ b/testing/geckodriver/src/prefs.rs
@@ -11,16 +11,19 @@ lazy_static! {
     pub static ref DEFAULT: Vec<(&'static str, Pref)> = vec![
         // Make sure Shield doesn't hit the network.
         ("app.normandy.api_url", Pref::new("")),
 
         // Disable automatic downloading of new releases
         ("app.update.auto", Pref::new(false)),
 
         // Disable automatically upgrading Firefox
+        ("app.update.disabledForTesting", Pref::new(true)),
+        // app.update.enabled is being removed. Once Firefox 62 becomes stable,
+        // the line below can be removed as well.
         ("app.update.enabled", Pref::new(false)),
 
         // Enable the dump function, which sends messages to the system
         // console
         ("browser.dom.window.dump.enabled", Pref::new(true)),
 
         // Disable safebrowsing components
         ("browser.safebrowsing.blockedURIs.enabled", Pref::new(false)),
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -499,16 +499,20 @@ class FennecInstance(GeckoInstance):
             except Exception:
                 self.unresponsive_count += 1
                 traceback.print_exception(*sys.exc_info())
 
 
 class DesktopInstance(GeckoInstance):
     desktop_prefs = {
         # Disable application updates
+        "app.update.disabledForTesting": True,
+        "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer": True,
+        # app.update.enabled is being removed. Once Firefox 62 becomes stable,
+        # the line below can be removed as well.
         "app.update.enabled": False,
 
         # Enable output of dump()
         "browser.dom.window.dump.enabled": True,
 
         # Indicate that the download panel has been shown once so that whichever
         # download test runs first doesn"t show the popup inconsistently
         "browser.download.panel.shown": True,
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -61,17 +61,18 @@ const RECOMMENDED_PREFS = new Map([
   // This should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
   ["app.update.auto", false],
 
   // Disable automatically upgrading Firefox.
   //
   // This should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
-  ["app.update.enabled", false],
+  ["app.update.disabledForTesting", true],
+  ["security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true],
 
   // Increase the APZ content response timeout in tests to 1 minute.
   // This is to accommodate the fact that test environments tends to be
   // slower than production environments (with the b2g emulator being
   // the slowest of them all), resulting in the production timeout value
   // sometimes being exceeded and causing false-positive test failures.
   //
   // (bug 1176798, bug 1177018, bug 1210465)
--- a/testing/mozbase/mozprofile/mozprofile/profile.py
+++ b/testing/mozbase/mozprofile/mozprofile/profile.py
@@ -426,17 +426,18 @@ class Profile(BaseProfile):
     def __unicode__(self):
         return self.summary()
 
 
 class FirefoxProfile(Profile):
     """Specialized Profile subclass for Firefox"""
 
     preferences = {  # Don't automatically update the application
-        'app.update.enabled': False,
+        'app.update.disabledForTesting': True,
+        'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer': True,
         # Don't restore the last open set of tabs if the browser has crashed
         'browser.sessionstore.resume_from_crash': False,
         # Don't check for the default web browser during startup
         'browser.shell.checkDefaultBrowser': False,
         # Don't warn on exit when multiple tabs are open
         'browser.tabs.warnOnClose': False,
         # Don't warn when exiting the browser
         'browser.warnOnQuit': False,
--- a/testing/profiles/common/user.js
+++ b/testing/profiles/common/user.js
@@ -1,11 +1,11 @@
 // Base preferences file used by both unittest and perf harnesses.
 /* globals user_pref */
-user_pref("app.update.enabled", false);
+user_pref("app.update.disabledForTesting", true);
 user_pref("browser.chrome.guess_favicon", false);
 user_pref("browser.dom.window.dump.enabled", true);
 // Use an empty list of sites to avoid fetching
 user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
 user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
 user_pref("browser.newtabpage.activity-stream.tippyTop.service.endpoint", "");
 // Tell the search service we are running in the US.  This also has the desired
 // side-effect of preventing our geoip lookup.
--- a/testing/raptor/test/test_raptor.py
+++ b/testing/raptor/test/test_raptor.py
@@ -17,25 +17,30 @@ from raptor.raptor import Raptor
 def test_create_profile(options, app, get_prefs):
     options['app'] = app
     raptor = Raptor(**options)
 
     assert isinstance(raptor.profile, BaseProfile)
     if app != 'firefox':
         return
 
-    # This pref is set in mozprofile
-    firefox_pref = 'user_pref("app.update.enabled", false);'
+    # These prefs are set in mozprofile
+    firefox_prefs = [
+        'user_pref("app.update.disabledForTesting", true);',
+        'user_pref("'
+        'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true);'
+    ]
     # This pref is set in raptor
     raptor_pref = 'user_pref("security.enable_java", false);'
 
     prefs_file = os.path.join(raptor.profile.profile, 'user.js')
     with open(prefs_file, 'r') as fh:
         prefs = fh.read()
-        assert firefox_pref in prefs
+        for firefox_pref in firefox_prefs:
+            assert firefox_pref in prefs
         assert raptor_pref in prefs
 
 
 def test_start_and_stop_server(raptor):
     assert raptor.control_server is None
 
     raptor.start_control_server()
 
--- a/testing/talos/talos/unittests/test_talosconfig_browser_config.json
+++ b/testing/talos/talos/unittests/test_talosconfig_browser_config.json
@@ -1,1 +1,1 @@
-{'deviceroot': '', 'dirs': {}, 'repository': 'http://hg.mozilla.org/releases/mozilla-release', 'buildid': '20131205075310', 'results_log': 'pathtoresults_log', 'symbols_path': None, 'bcontroller_config': 'pathtobcontroller', 'host': '', 'browser_name': 'Firefox', 'sourcestamp': '39faf812aaec', 'remote': False, 'child_process': 'plugin-container', 'branch_name': '', 'browser_version': '26.0', 'extra_args': '', 'develop': True, 'preferences': {'browser.display.overlaynavbuttons': False, 'extensions.getAddons.get.url': 'http://127.0.0.1/extensions-dummy/repositoryGetURL', 'dom.max_chrome_script_run_time': 0, 'network.proxy.type': 1, 'extensions.update.background.url': 'http://127.0.0.1/extensions-dummy/updateBackgroundURL', 'network.proxy.http': 'localhost', 'plugins.update.url': 'http://127.0.0.1/plugins-dummy/updateCheckURL', 'dom.max_script_run_time': 0, 'extensions.update.enabled': False, 'browser.safebrowsing.keyURL': 'http://127.0.0.1/safebrowsing-dummy/newkey', 'media.navigator.permission.disabled': True, 'app.update.enabled': False, 'extensions.blocklist.url': 'http://127.0.0.1/extensions-dummy/blocklistURL', 'browser.EULA.override': True, 'extensions.checkCompatibility': False, 'talos.logfile': 'pathtofile', 'browser.safebrowsing.gethashURL': 'http://127.0.0.1/safebrowsing-dummy/gethash', 'extensions.hotfix.url': 'http://127.0.0.1/extensions-dummy/hotfixURL', 'dom.disable_window_move_resize': True, 'network.proxy.http_port': 80, 'browser.dom.window.dump.enabled': True, 'extensions.update.url': 'http://127.0.0.1/extensions-dummy/updateURL', 'browser.chrome.dynamictoolbar': False,  'browser.link.open_newwindow': 2, 'browser.cache.disk.smart_size.first_run': False, 'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer': True, 'dom.disable_open_during_load': False, 'extensions.getAddons.search.browseURL': 'http://127.0.0.1/extensions-dummy/repositoryBrowseURL', 'browser.cache.disk.smart_size.enabled': False, 'extensions.getAddons.getWithPerformance.url': 'http://127.0.0.1/extensions-dummy/repositoryGetWithPerformanceURL', 'hangmonitor.timeout': 0, 'dom.send_after_paint_to_content': True, 'security.fileuri.strict_origin_policy': False, 'media.capturestream_hints.enabled': True, 'extensions.update.notifyUser': False, 'extensions.blocklist.enabled': False, 'browser.bookmarks.max_backups': 0, 'browser.shell.checkDefaultBrowser': False, 'media.peerconnection.enabled': True, 'dom.disable_window_flip': True, 'security.enable_java': False, 'browser.warnOnQuit': False, 'media.navigator.enabled': True, 'browser.safebrowsing.updateURL': 'http://127.0.0.1/safebrowsing-dummy/update', 'dom.allow_scripts_to_close_windows': True, 'extensions.webservice.discoverURL': 'http://127.0.0.1/extensions-dummy/discoveryURL'}, 'test_timeout': 1200, 'title': 'qm-pxp01', 'error_filename': 'pathtoerrorfile', 'webserver': 'localhost:15707', 'browser_path':ffox_path, 'port': 20701, 'browser_log': 'browser_output.txt', 'process': 'firefox.exe', 'xperf_path': 'C:/Program Files/Microsoft Windows Performance Toolkit/xperf.exe', 'extensions': ['pathtopageloader'], 'fennecIDs': '', 'env': {'NO_EM_RESTART': '1'}, 'init_url': 'http://localhost:15707/getInfo.html', 'browser_wait': 5}
+{'deviceroot': '', 'dirs': {}, 'repository': 'http://hg.mozilla.org/releases/mozilla-release', 'buildid': '20131205075310', 'results_log': 'pathtoresults_log', 'symbols_path': None, 'bcontroller_config': 'pathtobcontroller', 'host': '', 'browser_name': 'Firefox', 'sourcestamp': '39faf812aaec', 'remote': False, 'child_process': 'plugin-container', 'branch_name': '', 'browser_version': '26.0', 'extra_args': '', 'develop': True, 'preferences': {'browser.display.overlaynavbuttons': False, 'extensions.getAddons.get.url': 'http://127.0.0.1/extensions-dummy/repositoryGetURL', 'dom.max_chrome_script_run_time': 0, 'network.proxy.type': 1, 'extensions.update.background.url': 'http://127.0.0.1/extensions-dummy/updateBackgroundURL', 'network.proxy.http': 'localhost', 'plugins.update.url': 'http://127.0.0.1/plugins-dummy/updateCheckURL', 'dom.max_script_run_time': 0, 'extensions.update.enabled': False, 'browser.safebrowsing.keyURL': 'http://127.0.0.1/safebrowsing-dummy/newkey', 'media.navigator.permission.disabled': True, 'app.update.disabledForTesting': True, 'extensions.blocklist.url': 'http://127.0.0.1/extensions-dummy/blocklistURL', 'browser.EULA.override': True, 'extensions.checkCompatibility': False, 'talos.logfile': 'pathtofile', 'browser.safebrowsing.gethashURL': 'http://127.0.0.1/safebrowsing-dummy/gethash', 'extensions.hotfix.url': 'http://127.0.0.1/extensions-dummy/hotfixURL', 'dom.disable_window_move_resize': True, 'network.proxy.http_port': 80, 'browser.dom.window.dump.enabled': True, 'extensions.update.url': 'http://127.0.0.1/extensions-dummy/updateURL', 'browser.chrome.dynamictoolbar': False,  'browser.link.open_newwindow': 2, 'browser.cache.disk.smart_size.first_run': False, 'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer': True, 'dom.disable_open_during_load': False, 'extensions.getAddons.search.browseURL': 'http://127.0.0.1/extensions-dummy/repositoryBrowseURL', 'browser.cache.disk.smart_size.enabled': False, 'extensions.getAddons.getWithPerformance.url': 'http://127.0.0.1/extensions-dummy/repositoryGetWithPerformanceURL', 'hangmonitor.timeout': 0, 'dom.send_after_paint_to_content': True, 'security.fileuri.strict_origin_policy': False, 'media.capturestream_hints.enabled': True, 'extensions.update.notifyUser': False, 'extensions.blocklist.enabled': False, 'browser.bookmarks.max_backups': 0, 'browser.shell.checkDefaultBrowser': False, 'media.peerconnection.enabled': True, 'dom.disable_window_flip': True, 'security.enable_java': False, 'browser.warnOnQuit': False, 'media.navigator.enabled': True, 'browser.safebrowsing.updateURL': 'http://127.0.0.1/safebrowsing-dummy/update', 'dom.allow_scripts_to_close_windows': True, 'extensions.webservice.discoverURL': 'http://127.0.0.1/extensions-dummy/discoveryURL'}, 'test_timeout': 1200, 'title': 'qm-pxp01', 'error_filename': 'pathtoerrorfile', 'webserver': 'localhost:15707', 'browser_path':ffox_path, 'port': 20701, 'browser_log': 'browser_output.txt', 'process': 'firefox.exe', 'xperf_path': 'C:/Program Files/Microsoft Windows Performance Toolkit/xperf.exe', 'extensions': ['pathtopageloader'], 'fennecIDs': '', 'env': {'NO_EM_RESTART': '1'}, 'init_url': 'http://localhost:15707/getInfo.html', 'browser_wait': 5}
--- a/testing/tps/tps/testrunner.py
+++ b/testing/tps/tps/testrunner.py
@@ -51,17 +51,18 @@ class TPSTestRunner(object):
         'MOZ_CRASHREPORTER_DISABLE': '1',
         'GNOME_DISABLE_CRASH_DIALOG': '1',
         'XRE_NO_WINDOWS_CRASH_DIALOG': '1',
         'MOZ_NO_REMOTE': '1',
         'XPCOM_DEBUG_BREAK': 'warn',
     }
 
     default_preferences = {
-        'app.update.enabled': False,
+        'app.update.disabledForTesting': True,
+        'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer': True,
         'browser.dom.window.dump.enabled': True,
         'browser.sessionstore.resume_from_crash': False,
         'browser.shell.checkDefaultBrowser': False,
         'browser.tabs.warnOnClose': False,
         'browser.warnOnQuit': False,
         # Allow installing extensions dropped into the profile folder
         'extensions.autoDisableScopes': 10,
         'extensions.getAddons.get.url': 'http://127.0.0.1:4567/addons/api/%IDS%.json',
--- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
+++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
@@ -63,20 +63,16 @@ class TelemetryTestCase(PuppeteerMixin, 
         self.ping_list = [p for p in self.ping_list if ping_filter_func(p)]
 
         # TODO: Bug 1380748 - Pings are being cached between test
         # runs when using --repeat flag in marionette harness
         # Causes the assert to fail.
         # assert len(self.ping_list) == 1
         return self.ping_list.pop()
 
-    def toggle_update_pref(self):
-        value = self.marionette.get_pref('app.update.enabled')
-        self.marionette.enforce_gecko_prefs({'app.update.enabled': not value})
-
     def restart_browser(self):
         """Restarts browser while maintaining the same profile and session."""
         self.restart(clean=False, in_app=True)
 
     def install_addon(self):
         trigger = Process(target=self._install_addon)
         trigger.start()