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:
Henrik Skupin 2016-11-22 13:29:22 +01:00
Родитель 1e727bf048
Коммит d371faf694
3 изменённых файлов: 21 добавлений и 14 удалений

Просмотреть файл

@ -382,8 +382,7 @@ class UpdateTestCase(PuppeteerMixin, MarionetteTestCase):
if self.update_channel:
self.software_update.update_channel = self.update_channel
if self.update_url:
self.puppeteer.prefs.set_pref("app.update.url", self.update_url,
default_branch=True)
self.software_update.update_url = self.update_url
def wait_for_download_finished(self, window, timeout=TIMEOUT_UPDATE_DOWNLOAD):
""" Waits until download is completed.

Просмотреть файл

@ -58,10 +58,10 @@ class TestSoftwareUpdate(PuppeteerMixin, MarionetteTestCase):
os.remove(status_file)
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.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('force=1', update_url)

Просмотреть файл

@ -165,7 +165,6 @@ class SoftwareUpdate(BaseLib):
PREF_APP_DISTRIBUTION_VERSION = 'distribution.version'
PREF_APP_UPDATE_CHANNEL = 'app.update.channel'
PREF_APP_UPDATE_URL = 'app.update.url'
PREF_APP_UPDATE_URL_OVERRIDE = 'app.update.url.override'
PREF_DISABLED_ADDONS = 'extensions.disabledAddons'
def __init__(self, marionette):
@ -219,7 +218,7 @@ class SoftwareUpdate(BaseLib):
:returns: A dictionary of build information
"""
update_url = self.get_update_url(True)
update_url = self.get_formatted_update_url(True)
return {
'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)
@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
def update_type(self):
"""Returns the type of the active update."""
@ -355,22 +368,18 @@ class SoftwareUpdate(BaseLib):
return snippet
def get_update_url(self, force=False):
"""Retrieve the AUS update URL the update snippet is retrieved from.
def get_formatted_update_url(self, force=False):
"""Retrieve the formatted AUS update URL the update snippet is retrieved from.
:param force: Boolean flag to force an update check
: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
url = self.marionette.execute_script("""
Components.utils.import("resource://gre/modules/UpdateUtils.jsm")
return UpdateUtils.formatUpdateURL(arguments[0]);
""", script_args=[url])
""", script_args=[self.update_url])
if force:
if '?' in url:
@ -380,4 +389,3 @@ class SoftwareUpdate(BaseLib):
url += 'force=1'
return url