mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Update web-platform-tests to revision b382ac7192087da0a7439902e20be76ab7587ee8
This commit is contained in:
parent
3e96a322ae
commit
defee2aae0
45 changed files with 645 additions and 189 deletions
|
@ -1,4 +1,4 @@
|
|||
from six.moves.urllib.parse import urljoin
|
||||
from six.moves.urllib.parse import urljoin, urlparse
|
||||
from abc import ABCMeta, abstractproperty
|
||||
|
||||
|
||||
|
@ -46,6 +46,10 @@ class ManifestItem(object):
|
|||
"""The test's id (usually its url)"""
|
||||
pass
|
||||
|
||||
@property
|
||||
def meta_flags(self):
|
||||
return set(self.source_file.meta_flags)
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
"""The test path relative to the test_root"""
|
||||
|
@ -53,7 +57,8 @@ class ManifestItem(object):
|
|||
|
||||
@property
|
||||
def https(self):
|
||||
return "https" in self.source_file.meta_flags
|
||||
flags = self.meta_flags
|
||||
return ("https" in flags or "serviceworker" in flags)
|
||||
|
||||
def key(self):
|
||||
"""A unique identifier for the test"""
|
||||
|
@ -95,6 +100,10 @@ class URLManifestItem(ManifestItem):
|
|||
def id(self):
|
||||
return self.url
|
||||
|
||||
@property
|
||||
def meta_flags(self):
|
||||
return set(urlparse(self.url).path.rsplit("/", 1)[1].split(".")[1:-1])
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return urljoin(self.url_base, self._url)
|
||||
|
|
|
@ -113,8 +113,6 @@ def global_suffixes(value):
|
|||
for global_type in global_types:
|
||||
variant = _any_variants[global_type]
|
||||
suffix = variant.get("suffix", ".any.%s.html" % global_type.decode("utf-8"))
|
||||
if variant.get("force_https", False):
|
||||
suffix = ".https" + suffix
|
||||
rv.add((suffix, global_type == b"jsshell"))
|
||||
|
||||
return rv
|
||||
|
@ -623,7 +621,8 @@ class SourceFile(object):
|
|||
break
|
||||
|
||||
tests = [
|
||||
TestharnessTest(self, global_variant_url(self.url, suffix) + variant, timeout=self.timeout, jsshell=jsshell)
|
||||
TestharnessTest(self, global_variant_url(self.url, suffix) + variant, timeout=self.timeout,
|
||||
jsshell=jsshell)
|
||||
for (suffix, jsshell) in sorted(global_suffixes(globals))
|
||||
for variant in self.test_variants
|
||||
]
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
from ..item import SupportFile, URLManifestItem
|
||||
from ..sourcefile import SourceFile
|
||||
|
||||
|
||||
def test_base_meta_flags():
|
||||
s = SourceFile("/", "a.b.c.d", "/", contents="")
|
||||
m = SupportFile(s)
|
||||
|
||||
assert m.meta_flags == {"b", "c"}
|
||||
|
||||
|
||||
def test_url_meta_flags():
|
||||
s = SourceFile("/", "a.b.c", "/", contents="")
|
||||
m = URLManifestItem(s, "/foo.bar/a.b.d.e")
|
||||
|
||||
assert m.meta_flags == {"b", "d"}
|
||||
|
||||
|
||||
def test_url_empty_meta_flags():
|
||||
s = SourceFile("/", "a.b.c", "/", contents="")
|
||||
m = URLManifestItem(s, "/foo.bar/abcde")
|
||||
|
||||
assert m.meta_flags == set()
|
|
@ -366,7 +366,7 @@ test()""" % input
|
|||
|
||||
urls = {
|
||||
"dedicatedworker": "/html/test.any.worker.html",
|
||||
"serviceworker": "/html/test.https.any.serviceworker.html",
|
||||
"serviceworker": "/html/test.any.serviceworker.html",
|
||||
"sharedworker": "/html/test.any.sharedworker.html",
|
||||
"window": "/html/test.any.html",
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ test()"""
|
|||
|
||||
urls = {
|
||||
"dedicatedworker": "/html/test.any.worker.html",
|
||||
"serviceworker": "/html/test.https.any.serviceworker.html",
|
||||
"serviceworker": "/html/test.any.serviceworker.html",
|
||||
"sharedworker": "/html/test.any.sharedworker.html",
|
||||
"window": "/html/test.any.html",
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ fetch_tests_from_worker(new SharedWorker("%(path)s%(query)s"));
|
|||
|
||||
class ServiceWorkersHandler(HtmlWrapperHandler):
|
||||
global_type = b"serviceworker"
|
||||
path_replace = [(".https.any.serviceworker.html", ".any.js", ".any.worker.js")]
|
||||
path_replace = [(".any.serviceworker.html", ".any.js", ".any.worker.js")]
|
||||
wrapper = """<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
%(meta)s
|
||||
|
@ -342,7 +342,7 @@ class RoutesBuilder(object):
|
|||
("GET", "*.window.html", WindowHandler),
|
||||
("GET", "*.any.html", AnyHtmlHandler),
|
||||
("GET", "*.any.sharedworker.html", SharedWorkersHandler),
|
||||
("GET", "*.https.any.serviceworker.html", ServiceWorkersHandler),
|
||||
("GET", "*.any.serviceworker.html", ServiceWorkersHandler),
|
||||
("GET", "*.any.worker.js", AnyWorkerHandler),
|
||||
("GET", "*.asis", handlers.AsIsHandler),
|
||||
("*", "*.py", handlers.PythonScriptHandler),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue