Bug 1507532 - Add support for copying Ahem to the installed Firefox profile, r=gbrown
authorJames Graham <james@hoppipolla.co.uk>
Thu, 15 Nov 2018 17:33:37 +0000
changeset 503175 32fdcb91c2a51fb572e364d94180631d76a6fb33
parent 503174 9702f65efe224bcb14f64db9eeb99ca2ad5ef8f8
child 503176 294c7b9011c0a5657ea384d1328805ff48e60f43
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1507532, 1197716
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507532 - Add support for copying Ahem to the installed Firefox profile, r=gbrown Following the lead of bug 1197716, put the Ahem font into the firefox profile where it is read by Fennec. Depends on D12034 Differential Revision: https://phabricator.services.mozilla.com/D12035
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
@@ -103,17 +103,19 @@ def browser_kwargs(test_type, run_info_d
             "stackfix_dir": kwargs["stackfix_dir"],
             "binary_args": kwargs["binary_args"],
             "timeout_multiplier": get_timeout_multiplier(test_type,
                                                          run_info_data,
                                                          **kwargs),
             "leak_check": kwargs["leak_check"],
             "stylo_threads": kwargs["stylo_threads"],
             "chaos_mode_flags": kwargs["chaos_mode_flags"],
-            "config": config}
+            "config": config,
+            "install_fonts": kwargs["install_fonts"],
+            "tests_root": config.doc_root}
 
 
 def env_extras(**kwargs):
     return []
 
 
 def run_info_extras(**kwargs):
     return {"e10s": False,
@@ -149,16 +151,18 @@ class FennecBrowser(FirefoxBrowser):
     init_timeout = 300
     shutdown_timeout = 60
 
     def __init__(self, logger, prefs_root, test_type, package_name=None,
                  device_serial="emulator-5444", **kwargs):
         FirefoxBrowser.__init__(self, logger, None, prefs_root, test_type, **kwargs)
         self._package_name = package_name
         self.device_serial = device_serial
+        self.tests_root = kwargs["tests_root"]
+        self.install_fonts = kwargs["install_fonts"]
 
     @property
     def package_name(self):
         """
         Name of app to run on emulator.
         """
         if self._package_name is None:
             self._package_name = "org.mozilla.fennec"
@@ -184,16 +188,25 @@ class FennecBrowser(FirefoxBrowser):
 
         self.profile = FennecProfile(preferences=preferences)
         self.profile.set_preferences({"marionette.port": self.marionette_port,
                                       "dom.disable_open_during_load": False,
                                       "places.history.enabled": False,
                                       "dom.send_after_paint_to_content": True,
                                       "network.preload": True})
 
+        if self.install_fonts:
+            self.logger.debug("Copying Ahem font to profile")
+            font_dir = os.path.join(self.profile.profile, "fonts")
+            if not os.path.exists(font_dir):
+                os.makedirs(font_dir)
+            with open(os.path.join(self.tests_root, "fonts", "Ahem.ttf"), "rb") as src:
+                with open(os.path.join(font_dir, "Ahem.ttf"), "wb") as dest:
+                    dest.write(src.read())
+
         if self.leak_check and kwargs.get("check_leaks", True):
             self.leak_report_file = os.path.join(self.profile.profile, "runtests_leaks.log")
             if os.path.exists(self.leak_report_file):
                 os.remove(self.leak_report_file)
             env["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file
         else:
             self.leak_report_file = None
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -164,17 +164,17 @@ class FirefoxBrowser(Browser):
     used_ports = set()
     init_timeout = 70
     shutdown_timeout = 70
 
     def __init__(self, logger, binary, prefs_root, test_type, extra_prefs=None, debug_info=None,
                  symbols_path=None, stackwalk_binary=None, certutil_binary=None,
                  ca_certificate_path=None, e10s=False, stackfix_dir=None,
                  binary_args=None, timeout_multiplier=None, leak_check=False, asan=False,
-                 stylo_threads=1, chaos_mode_flags=None, config=None, headless=None):
+                 stylo_threads=1, chaos_mode_flags=None, config=None, headless=None, **kwargs):
         Browser.__init__(self, logger)
         self.binary = binary
         self.prefs_root = prefs_root
         self.test_type = test_type
         self.extra_prefs = extra_prefs
         self.marionette_port = None
         self.runner = None
         self.debug_info = debug_info