зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1142805 - Fix remaining traces for app.update.url.override. r=maja_zf,rail
MozReview-Commit-ID: BJvSjqippar --HG-- extra : rebase_source : 8c4a655bcf64f61b0d319c8a193d3cea849ac32e
This commit is contained in:
Родитель
1e727bf048
Коммит
d371faf694
|
@ -382,8 +382,7 @@ class UpdateTestCase(PuppeteerMixin, MarionetteTestCase):
|
||||||
if self.update_channel:
|
if self.update_channel:
|
||||||
self.software_update.update_channel = self.update_channel
|
self.software_update.update_channel = self.update_channel
|
||||||
if self.update_url:
|
if self.update_url:
|
||||||
self.puppeteer.prefs.set_pref("app.update.url", self.update_url,
|
self.software_update.update_url = self.update_url
|
||||||
default_branch=True)
|
|
||||||
|
|
||||||
def wait_for_download_finished(self, window, timeout=TIMEOUT_UPDATE_DOWNLOAD):
|
def wait_for_download_finished(self, window, timeout=TIMEOUT_UPDATE_DOWNLOAD):
|
||||||
""" Waits until download is completed.
|
""" Waits until download is completed.
|
||||||
|
|
|
@ -58,10 +58,10 @@ class TestSoftwareUpdate(PuppeteerMixin, MarionetteTestCase):
|
||||||
os.remove(status_file)
|
os.remove(status_file)
|
||||||
|
|
||||||
def test_get_update_url(self):
|
def test_get_update_url(self):
|
||||||
update_url = self.software_update.get_update_url()
|
update_url = self.software_update.get_formatted_update_url()
|
||||||
self.assertIn('Firefox', update_url)
|
self.assertIn('Firefox', update_url)
|
||||||
self.assertNotIn('force=1', update_url)
|
self.assertNotIn('force=1', update_url)
|
||||||
update_url = self.software_update.get_update_url(True)
|
update_url = self.software_update.get_formatted_update_url(True)
|
||||||
self.assertIn('Firefox', update_url)
|
self.assertIn('Firefox', update_url)
|
||||||
self.assertIn('force=1', update_url)
|
self.assertIn('force=1', update_url)
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,6 @@ class SoftwareUpdate(BaseLib):
|
||||||
PREF_APP_DISTRIBUTION_VERSION = 'distribution.version'
|
PREF_APP_DISTRIBUTION_VERSION = 'distribution.version'
|
||||||
PREF_APP_UPDATE_CHANNEL = 'app.update.channel'
|
PREF_APP_UPDATE_CHANNEL = 'app.update.channel'
|
||||||
PREF_APP_UPDATE_URL = 'app.update.url'
|
PREF_APP_UPDATE_URL = 'app.update.url'
|
||||||
PREF_APP_UPDATE_URL_OVERRIDE = 'app.update.url.override'
|
|
||||||
PREF_DISABLED_ADDONS = 'extensions.disabledAddons'
|
PREF_DISABLED_ADDONS = 'extensions.disabledAddons'
|
||||||
|
|
||||||
def __init__(self, marionette):
|
def __init__(self, marionette):
|
||||||
|
@ -219,7 +218,7 @@ class SoftwareUpdate(BaseLib):
|
||||||
|
|
||||||
:returns: A dictionary of build information
|
:returns: A dictionary of build information
|
||||||
"""
|
"""
|
||||||
update_url = self.get_update_url(True)
|
update_url = self.get_formatted_update_url(True)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'buildid': self.app_info.appBuildID,
|
'buildid': self.app_info.appBuildID,
|
||||||
|
@ -330,6 +329,20 @@ class SoftwareUpdate(BaseLib):
|
||||||
"""
|
"""
|
||||||
self.prefs.set_pref(self.PREF_APP_UPDATE_CHANNEL, channel, default_branch=True)
|
self.prefs.set_pref(self.PREF_APP_UPDATE_CHANNEL, channel, default_branch=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def update_url(self):
|
||||||
|
"""Return the update URL used for update checks."""
|
||||||
|
return self.prefs.get_pref(self.PREF_APP_UPDATE_URL, default_branch=True)
|
||||||
|
|
||||||
|
@update_url.setter
|
||||||
|
def update_url(self, url):
|
||||||
|
"""Set the update URL to be used for update checks.
|
||||||
|
|
||||||
|
:param url: New update URL to use
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.prefs.set_pref(self.PREF_APP_UPDATE_URL, url, default_branch=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def update_type(self):
|
def update_type(self):
|
||||||
"""Returns the type of the active update."""
|
"""Returns the type of the active update."""
|
||||||
|
@ -355,22 +368,18 @@ class SoftwareUpdate(BaseLib):
|
||||||
|
|
||||||
return snippet
|
return snippet
|
||||||
|
|
||||||
def get_update_url(self, force=False):
|
def get_formatted_update_url(self, force=False):
|
||||||
"""Retrieve the AUS update URL the update snippet is retrieved from.
|
"""Retrieve the formatted AUS update URL the update snippet is retrieved from.
|
||||||
|
|
||||||
:param force: Boolean flag to force an update check
|
:param force: Boolean flag to force an update check
|
||||||
|
|
||||||
:returns: The URL of the update snippet
|
:returns: The URL of the update snippet
|
||||||
"""
|
"""
|
||||||
url = self.prefs.get_pref(self.PREF_APP_UPDATE_URL_OVERRIDE)
|
|
||||||
if not url:
|
|
||||||
url = self.prefs.get_pref(self.PREF_APP_UPDATE_URL)
|
|
||||||
|
|
||||||
# Format the URL by replacing placeholders
|
# Format the URL by replacing placeholders
|
||||||
url = self.marionette.execute_script("""
|
url = self.marionette.execute_script("""
|
||||||
Components.utils.import("resource://gre/modules/UpdateUtils.jsm")
|
Components.utils.import("resource://gre/modules/UpdateUtils.jsm")
|
||||||
return UpdateUtils.formatUpdateURL(arguments[0]);
|
return UpdateUtils.formatUpdateURL(arguments[0]);
|
||||||
""", script_args=[url])
|
""", script_args=[self.update_url])
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
if '?' in url:
|
if '?' in url:
|
||||||
|
@ -380,4 +389,3 @@ class SoftwareUpdate(BaseLib):
|
||||||
url += 'force=1'
|
url += 'force=1'
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче