Bug 1305486 - Enable v4 tables on nightly build. r=francois

MozReview-Commit-ID: 4iGduuYqMQs

--HG--
extra : rebase_source : 49deb89d4fb3e4ec692ae933134e4b247734e980
This commit is contained in:
Henry Chang 2016-11-20 15:10:19 +08:00
Родитель ba3f6c6813
Коммит 55614c06db
7 изменённых файлов: 51 добавлений и 6 удалений

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

@ -58,6 +58,8 @@ DEFAULT_NO_CONNECTIONS_PREFS = {
'browser.safebrowsing.phishing.enabled' : False,
'browser.safebrowsing.provider.google.updateURL': 'http://localhost/safebrowsing-dummy/update',
'browser.safebrowsing.provider.google.gethashURL': 'http://localhost/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.google4.updateURL': 'http://localhost/safebrowsing4-dummy/update',
'browser.safebrowsing.provider.google4.gethashURL': 'http://localhost/safebrowsing4-dummy/gethash',
'browser.safebrowsing.malware.reportURL': 'http://localhost/safebrowsing-dummy/malwarereport',
'browser.selfsupport.url': 'https://localhost/selfsupport-dummy',
'browser.safebrowsing.provider.mozilla.gethashURL': 'http://localhost/safebrowsing-dummy/gethash',
@ -119,6 +121,8 @@ DEFAULT_FIREFOX_PREFS = {
# Point the url-classifier to a nonexistent local URL for fast failures.
'browser.safebrowsing.provider.google.gethashURL' : 'http://localhost/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.google.updateURL' : 'http://localhost/safebrowsing-dummy/update',
'browser.safebrowsing.provider.google4.gethashURL' : 'http://localhost/safebrowsing4-dummy/gethash',
'browser.safebrowsing.provider.google4.updateURL' : 'http://localhost/safebrowsing4-dummy/update',
'browser.safebrowsing.provider.mozilla.gethashURL': 'http://localhost/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.mozilla.updateURL': 'http://localhost/safebrowsing-dummy/update',
}

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

@ -6,6 +6,8 @@
"urlclassifier.updateinterval": 172800,
"browser.safebrowsing.provider.google.gethashURL": "http://localhost/safebrowsing-dummy/gethash",
"browser.safebrowsing.provider.google.updateURL": "http://localhost/safebrowsing-dummy/update",
"browser.safebrowsing.provider.google4.gethashURL": "http://localhost/safebrowsing4-dummy/gethash",
"browser.safebrowsing.provider.google4.updateURL": "http://localhost/safebrowsing4-dummy/update",
"browser.safebrowsing.provider.mozilla.gethashURL": "http://localhost/safebrowsing-dummy/gethash",
"browser.safebrowsing.provider.mozilla.updateURL": "http://localhost/safebrowsing-dummy/update"
}

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

@ -19,6 +19,9 @@
"browser.safebrowsing.provider.google.updateURL": "http://localhost/safebrowsing-dummy/update",
"browser.safebrowsing.provider.google.gethashURL": "http://localhost/safebrowsing-dummy/gethash",
"browser.safebrowsing.provider.google.reportURL": "http://localhost/safebrowsing-dummy/malwarereport",
"browser.safebrowsing.provider.google4.updateURL": "http://localhost/safebrowsing4-dummy/update",
"browser.safebrowsing.provider.google4.gethashURL": "http://localhost/safebrowsing4-dummy/gethash",
"browser.safebrowsing.provider.google4.reportURL": "http://localhost/safebrowsing4-dummy/malwarereport",
"browser.selfsupport.url": "https://localhost/selfsupport-dummy",
"browser.safebrowsing.provider.mozilla.gethashURL": "http://localhost/safebrowsing-dummy/gethash",
"browser.safebrowsing.provider.mozilla.updateURL": "http://localhost/safebrowsing-dummy/update",

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

@ -1565,3 +1565,9 @@ pref("services.sync.validation.enabled", true);
// Preferences for the form autofill system extension
pref("browser.formautofill.experimental", false);
// Enable safebrowsing v4 tables (suffixed by "-proto") update.
#ifdef NIGHTLY_BUILD
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,goog-malware-proto,goog-unwanted-proto,test-malware-simple,test-unwanted-simple");
pref("urlclassifier.phishTable", "goog-phish-shavar,goog-phish-proto,test-phish-simple");
#endif

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

@ -11,11 +11,16 @@ from marionette_harness import MarionetteTestCase
class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase):
file_extensions = [
v2_file_extensions = [
'pset',
'sbstore',
]
v4_file_extensions = [
'pset',
'metadata',
]
prefs_download_lists = [
'urlclassifier.blockedTable',
'urlclassifier.downloadAllowTable',
@ -28,6 +33,9 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase):
prefs_provider_update_time = {
# Force an immediate download of the safebrowsing files
# Bug 1330253 - Leave the next line disabled until we have google API key
# on the CI machines.
# 'browser.safebrowsing.provider.google4.nextupdatetime': 1,
'browser.safebrowsing.provider.google.nextupdatetime': 1,
'browser.safebrowsing.provider.mozilla.nextupdatetime': 1,
}
@ -42,12 +50,22 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase):
'privacy.trackingprotection.pbmode.enabled': True,
}
def get_safebrowsing_files(self):
def get_safebrowsing_files(self, is_v4):
files = []
if is_v4:
my_file_extensions = self.v4_file_extensions
else: # v2
# safebrowsing dir should have a 'google4' directory where
# v4 databases exist.
files.append('google4')
my_file_extensions = self.v2_file_extensions
for pref_name in self.prefs_download_lists:
base_names = self.marionette.get_pref(pref_name).split(',')
for ext in self.file_extensions:
files.extend(['{file}.{ext}'.format(file=f, ext=ext) for f in base_names if f])
for ext in my_file_extensions:
files.extend(['{file}.{ext}'.format(file=f, ext=ext)
for f in base_names if f and f.endswith('-proto') == is_v4])
return set(sorted(files))
@ -61,7 +79,8 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase):
self.safebrowsing_path = os.path.join(self.marionette.instance.profile.profile,
'safebrowsing')
self.safebrowsing_files = self.get_safebrowsing_files()
self.safebrowsing_v2_files = self.get_safebrowsing_files(False)
self.safebrowsing_v4_files = self.get_safebrowsing_files(True)
def tearDown(self):
try:
@ -79,4 +98,9 @@ class TestSafeBrowsingInitialDownload(PuppeteerMixin, MarionetteTestCase):
Wait(self.marionette, timeout=60).until(
check_downloaded, message='Not all safebrowsing files have been downloaded')
finally:
self.assertSetEqual(self.safebrowsing_files, set(os.listdir(self.safebrowsing_path)))
self.assertSetEqual(self.safebrowsing_v2_files,
set(os.listdir(self.safebrowsing_path)))
# Bug 1330253 - Leave the next test disabled until we have google api key
# on the CI machines.
# self.assertSetEqual(self.safebrowsing_v4_files,
# set(os.listdir(os.path.join(self.safebrowsing_path, 'google4'))))

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

@ -99,6 +99,8 @@ user_pref("urlclassifier.updateinterval", 172800);
user_pref("browser.safebrowsing.downloads.remote.url", "http://%(server)s/safebrowsing-dummy/update");
user_pref("browser.safebrowsing.provider.google.gethashURL", "http://%(server)s/safebrowsing-dummy/gethash");
user_pref("browser.safebrowsing.provider.google.updateURL", "http://%(server)s/safebrowsing-dummy/update");
user_pref("browser.safebrowsing.provider.google4.gethashURL", "http://%(server)s/safebrowsing4-dummy/gethash");
user_pref("browser.safebrowsing.provider.google4.updateURL", "http://%(server)s/safebrowsing4-dummy/update");
user_pref("browser.safebrowsing.provider.mozilla.gethashURL", "http://%(server)s/safebrowsing-dummy/gethash");
user_pref("browser.safebrowsing.provider.mozilla.updateURL", "http://%(server)s/safebrowsing-dummy/update");
user_pref("privacy.trackingprotection.introURL", "http://%(server)s/trackingprotection/tour");

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

@ -100,6 +100,10 @@ DEFAULTS = dict(
'http://127.0.0.1/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.google.updateURL':
'http://127.0.0.1/safebrowsing-dummy/update',
'browser.safebrowsing.provider.google4.gethashURL':
'http://127.0.0.1/safebrowsing4-dummy/gethash',
'browser.safebrowsing.provider.google4.updateURL':
'http://127.0.0.1/safebrowsing4-dummy/update',
'browser.safebrowsing.provider.mozilla.gethashURL':
'http://127.0.0.1/safebrowsing-dummy/gethash',
'browser.safebrowsing.provider.mozilla.updateURL':