[:has() pseudo-class] id invalidation support
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / browser_driver / browser_driver_factory.py
1 #!/usr/bin/env python
2
3
4 class BrowserDriverFactory(object):
5
6     browser_drivers = {}
7     platforms = set()
8     browsers = set()
9
10     @classmethod
11     def available_platforms(cls):
12         return list(cls.platforms)
13
14     @classmethod
15     def available_browsers(cls):
16         return list(cls.browsers)
17
18     @classmethod
19     def add_browser_driver(cls, platform, browser_name, browser_driver_class):
20         cls.platforms.add(platform)
21         cls.browsers.add(browser_name)
22         if platform not in cls.browser_drivers:
23             cls.browser_drivers[platform] = {}
24         cls.browser_drivers[platform][browser_name] = browser_driver_class
25
26     @classmethod
27     def create(cls, platform, browser_name):
28         if browser_name not in cls.browser_drivers[platform]:
29             raise ValueError("Browser \"%s\" is not available on platform \"%s\"" % (browser_name, platform))
30         return cls.browser_drivers[platform][browser_name]()