Bug 1371923 - Only check safebrowsing files when they are in preference in test_safe_browsing_initial_download.py. r?francois
Ensure that we only wait for the providers that are enabled (i.e. have active lists) to avoid waiting forever
and timing out.
In order to check whether or not the google and google4 providers are enabled, we look for lists that start
with "goog" in both the V2 files and the V4 files. We use 'goog' here instead of 'goog-' because there are
both 'goog-xxx-xxx' and 'googpub-xxx-xxx' tables
MozReview-Commit-ID: 72JWZRs3Qxd
--- a/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py
+++ b/testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py
@@ -28,17 +28,16 @@ class TestSafeBrowsingInitialDownload(Pu
'urlclassifier.malwareTable',
'urlclassifier.phishTable',
'urlclassifier.trackingTable',
'urlclassifier.trackingWhitelistTable',
]
prefs_provider_update_time = {
# Force an immediate download of the safebrowsing files
- 'browser.safebrowsing.provider.google4.nextupdatetime': 1,
'browser.safebrowsing.provider.mozilla.nextupdatetime': 1,
}
prefs_safebrowsing = {
'browser.safebrowsing.debug': True,
'browser.safebrowsing.blockedURIs.enabled': True,
'browser.safebrowsing.downloads.enabled': True,
'browser.safebrowsing.phishing.enabled': True,
@@ -61,25 +60,35 @@ class TestSafeBrowsingInitialDownload(Pu
files.extend(['{name}.{ext}'.format(name=f, ext=ext)
for f in base_names if f and f.endswith('-proto') == is_v4])
return set(sorted(files))
def setUp(self):
super(TestSafeBrowsingInitialDownload, self).setUp()
+ self.safebrowsing_v2_files = self.get_safebrowsing_files(False)
+ if any(f.startswith('goog') for f in self.safebrowsing_v2_files):
+ self.prefs_provider_update_time.update({
+ 'browser.safebrowsing.provider.google.nextupdatetime': 1,
+ })
+
+ self.safebrowsing_v4_files = self.get_safebrowsing_files(True)
+ if any(f.startswith('goog') for f in self.safebrowsing_v4_files):
+ self.prefs_provider_update_time.update({
+ 'browser.safebrowsing.provider.google4.nextupdatetime': 1,
+ })
+
# Force the preferences for the new profile
enforce_prefs = self.prefs_safebrowsing
enforce_prefs.update(self.prefs_provider_update_time)
self.marionette.enforce_gecko_prefs(enforce_prefs)
self.safebrowsing_path = os.path.join(self.marionette.instance.profile.profile,
'safebrowsing')
- self.safebrowsing_v2_files = self.get_safebrowsing_files(False)
- self.safebrowsing_v4_files = self.get_safebrowsing_files(True)
def tearDown(self):
try:
# Restart with a fresh profile
self.restart(clean=True)
finally:
super(TestSafeBrowsingInitialDownload, self).tearDown()