summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/harness/wptrunner/products.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/harness/wptrunner/products.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/harness/wptrunner/products.py')
-rw-r--r--testing/web-platform/harness/wptrunner/products.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/harness/wptrunner/products.py b/testing/web-platform/harness/wptrunner/products.py
new file mode 100644
index 000000000..25fc7a49d
--- /dev/null
+++ b/testing/web-platform/harness/wptrunner/products.py
@@ -0,0 +1,72 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import importlib
+import imp
+
+from .browsers import product_list
+
+def products_enabled(config):
+ names = config.get("products", {}).keys()
+ if not names:
+ return product_list
+ else:
+ return names
+
+def product_module(config, product):
+ here = os.path.join(os.path.split(__file__)[0])
+ product_dir = os.path.join(here, "browsers")
+
+ if product not in products_enabled(config):
+ raise ValueError("Unknown product %s" % product)
+
+ path = config.get("products", {}).get(product, None)
+ if path:
+ module = imp.load_source('wptrunner.browsers.' + product, path)
+ else:
+ module = importlib.import_module("wptrunner.browsers." + product)
+
+ if not hasattr(module, "__wptrunner__"):
+ raise ValueError("Product module does not define __wptrunner__ variable")
+
+ return module
+
+
+def load_product(config, product):
+ module = product_module(config, product)
+ data = module.__wptrunner__
+
+ check_args = getattr(module, data["check_args"])
+ browser_cls = getattr(module, data["browser"])
+ browser_kwargs = getattr(module, data["browser_kwargs"])
+ executor_kwargs = getattr(module, data["executor_kwargs"])
+ env_options = getattr(module, data["env_options"])()
+ run_info_extras = (getattr(module, data["run_info_extras"])
+ if "run_info_extras" in data else lambda **kwargs:{})
+
+ executor_classes = {}
+ for test_type, cls_name in data["executor"].iteritems():
+ cls = getattr(module, cls_name)
+ executor_classes[test_type] = cls
+
+ return (check_args,
+ browser_cls, browser_kwargs,
+ executor_classes, executor_kwargs,
+ env_options, run_info_extras)
+
+
+def load_product_update(config, product):
+ """Return tuple of (property_order, boolean_properties) indicating the
+ run_info properties to use when constructing the expectation data for
+ this product. None for either key indicates that the default keys
+ appropriate for distinguishing based on platform will be used."""
+
+ module = product_module(config, product)
+ data = module.__wptrunner__
+
+ update_properties = (getattr(module, data["update_properties"])()
+ if "update_properties" in data else (None, None))
+
+ return update_properties