Bug 1333303 - Remove the google4 dir from the test and relax the list comparison. r?whimboo draft
authorFrancois Marier <francois@mozilla.com>
Wed, 25 Jan 2017 15:45:12 -0800
changeset 470052 f261f6b2335b1296f3b9ab7eccc70fb818ea33bb
parent 466286 24d9eb148461bb4789848b9880867c63c783a2ca
child 544381 eb4563518014f803ad6dd9ba9954a4b015c84583
push id43925
push userfmarier@mozilla.com
push dateFri, 03 Feb 2017 07:24:03 +0000
reviewerswhimboo
bugs1333303
milestone54.0a1
Bug 1333303 - Remove the google4 dir from the test and relax the list comparison. r?whimboo MozReview-Commit-ID: 2KY6CEQZYOk
testing/firefox-ui/tests/functional/security/test_safe_browsing_initial_download.py
--- 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
@@ -51,41 +51,41 @@ class TestSafeBrowsingInitialDownload(Pu
     }
 
     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 my_file_extensions:
-                files.extend(['{file}.{ext}'.format(file=f, ext=ext)
+                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()
 
         # 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)
+        # Bug 1330253 - Leave the next line disabled until we have google API key
+        #               on the CI machines.
+        # self.safebrowsing_v4_files = self.get_safebrowsing_files(True)
+        self.safebrowsing_v4_files = []
 
     def tearDown(self):
         try:
             # Restart with a fresh profile
             self.restart(clean=True)
         finally:
             super(TestSafeBrowsingInitialDownload, self).tearDown()
 
@@ -93,14 +93,16 @@ class TestSafeBrowsingInitialDownload(Pu
         def check_downloaded(_):
             return reduce(lambda state, pref: state and int(self.marionette.get_pref(pref)) != 1,
                           self.prefs_provider_update_time.keys(), True)
 
         try:
             Wait(self.marionette, timeout=60).until(
                 check_downloaded, message='Not all safebrowsing files have been downloaded')
         finally:
-            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'))))
+            files_on_disk_toplevel = os.listdir(self.safebrowsing_path)
+            for f in self.safebrowsing_v2_files:
+                self.assertIn(f, files_on_disk_toplevel)
+
+            if len(self.safebrowsing_v4_files) > 0:
+                files_on_disk_google4 = os.listdir(os.path.join(self.safebrowsing_path, 'google4'))
+                for f in self.safebrowsing_v4_files:
+                    self.assertIn(f, files_on_disk_google4)