зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1673034 [wpt PR 26263] - Fixes #20932 - Add a `.www` filename flag, a=testonly
Automatic update from web-platform-tests Issue #20932 - Part 1. Add a subdomain property getter to URLManifestItem -- Issue #20932 - Part 2. Add subdomain as an optional arg for server_url And pipe it through accordingly. -- Issue #20932 - Part 3. Add tests for the simple "www" subdomain case -- Issue #20932 - Part 4. Update file-names.md documentation -- Issue #20932 - Part 5. Add server infrastructure test for www filename flag -- wpt-commits: 4963140747962d11e715955a046f7f6f07709f1d, 55645b24f6f775fd232e3bd0cee4ee0385f88d63, f6352c9b43ac8c8cf261caaa0b62a9689a891cc5, 5ea5a8a9af11548a3f5ef9c2d1c377f2886abcb7, 6aeae52f01c6f1ed528fd03cc1b3832cda9d2a65 wpt-pr: 26263
This commit is contained in:
Родитель
7b1856cc58
Коммит
afb303be94
|
@ -36,6 +36,9 @@ themselves precede any test type flag, but are otherwise unordered.
|
|||
`.h2`
|
||||
: Indicates that a test is loaded over HTTP/2.
|
||||
|
||||
`.www`
|
||||
: Indicates that a test is run on the `www` subdomain.
|
||||
|
||||
`.sub`
|
||||
: Indicates that a test uses the [server-side substitution](server-pipes.html#sub)
|
||||
feature.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
test(() => {
|
||||
assert_equals(location.hostname, "{{domains[www]}}");
|
||||
}, "Use of .www. file name flag implies www subdomain");
|
||||
|
||||
done();
|
|
@ -147,6 +147,14 @@ class URLManifestItem(ManifestItem):
|
|||
flags = set(urlparse(self.url).path.rsplit("/", 1)[1].split(".")[1:-1])
|
||||
return "h2" in flags
|
||||
|
||||
@property
|
||||
def subdomain(self):
|
||||
# type: () -> bool
|
||||
flags = set(urlparse(self.url).path.rsplit("/", 1)[1].split(".")[1:-1])
|
||||
# Note: this is currently hard-coded to check for `www`, rather than
|
||||
# all possible valid subdomains. It can be extended if needed.
|
||||
return "www" in flags
|
||||
|
||||
def to_json(self):
|
||||
# type: () -> Tuple[Optional[Text], Dict[Any, Any]]
|
||||
rel_url = None if self._url == self.path.replace(os.path.sep, u"/") else self._url
|
||||
|
|
|
@ -47,6 +47,37 @@ def test_url_not_https(path):
|
|||
assert m.https is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
"a.www.c",
|
||||
"a.b.www.c",
|
||||
"a.www.b.c",
|
||||
"a.b.www.c.d",
|
||||
"a.https.www.c",
|
||||
"a.b.https.www.c",
|
||||
"a.https.www.b.c",
|
||||
"a.b.https.www.c.d",
|
||||
])
|
||||
def test_url_subdomain(path):
|
||||
m = HarnessTest("/foo", "bar/" + path, "/", "bar/" + path)
|
||||
|
||||
assert m.subdomain is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
"www",
|
||||
"a.www",
|
||||
"a.b.www",
|
||||
"www.a",
|
||||
"www.a.b",
|
||||
"a.bwwww.c",
|
||||
"a.wwwwb.c",
|
||||
])
|
||||
def test_url_not_subdomain(path):
|
||||
m = HarnessTest("/foo", "bar/" + path, "/", "bar/" + path)
|
||||
|
||||
assert m.subdomain is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fuzzy", [
|
||||
{('/foo/test.html', u'/foo/ref.html', '=='): [[1, 1], [200, 200]]},
|
||||
{('/foo/test.html', u'/foo/ref.html', '=='): [[0, 1], [100, 200]]},
|
||||
|
|
|
@ -307,14 +307,18 @@ class TestExecutor(object):
|
|||
|
||||
self.runner.send_message("test_ended", test, result)
|
||||
|
||||
def server_url(self, protocol):
|
||||
def server_url(self, protocol, subdomain=False):
|
||||
scheme = "https" if protocol == "h2" else protocol
|
||||
return "%s://%s:%s" % (scheme,
|
||||
self.server_config["browser_host"],
|
||||
self.server_config["ports"][protocol][0])
|
||||
host = self.server_config["browser_host"]
|
||||
if subdomain:
|
||||
# The only supported subdomain filename flag is "www".
|
||||
host = "{subdomain}.{host}".format(subdomain="www", host=host)
|
||||
return "{scheme}://{host}:{port}".format(scheme=scheme, host=host,
|
||||
port=self.server_config["ports"][protocol][0])
|
||||
|
||||
def test_url(self, test):
|
||||
return urljoin(self.server_url(test.environment["protocol"]), test.url)
|
||||
return urljoin(self.server_url(test.environment["protocol"],
|
||||
test.subdomain), test.url)
|
||||
|
||||
@abstractmethod
|
||||
def do_test(self, test):
|
||||
|
|
|
@ -158,7 +158,8 @@ class Test(object):
|
|||
long_timeout = 60 # seconds
|
||||
|
||||
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata,
|
||||
timeout=None, path=None, protocol="http", quic=False):
|
||||
timeout=None, path=None, protocol="http", subdomain=False,
|
||||
quic=False):
|
||||
self.url_base = url_base
|
||||
self.tests_root = tests_root
|
||||
self.url = url
|
||||
|
@ -166,6 +167,8 @@ class Test(object):
|
|||
self._test_metadata = test_metadata
|
||||
self.timeout = timeout if timeout is not None else self.default_timeout
|
||||
self.path = path
|
||||
|
||||
self.subdomain = subdomain
|
||||
self.environment = {"url_base": url_base,
|
||||
"protocol": protocol,
|
||||
"prefs": self.prefs,
|
||||
|
@ -195,7 +198,8 @@ class Test(object):
|
|||
test_metadata,
|
||||
timeout=timeout,
|
||||
path=os.path.join(manifest_file.tests_root, manifest_item.path),
|
||||
protocol=server_protocol(manifest_item))
|
||||
protocol=server_protocol(manifest_item),
|
||||
subdomain=manifest_item.subdomain)
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
@ -400,9 +404,9 @@ class TestharnessTest(Test):
|
|||
|
||||
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata,
|
||||
timeout=None, path=None, protocol="http", testdriver=False,
|
||||
jsshell=False, scripts=None, quic=False):
|
||||
jsshell=False, scripts=None, subdomain=False, quic=False):
|
||||
Test.__init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, timeout,
|
||||
path, protocol, quic)
|
||||
path, protocol, subdomain, quic)
|
||||
|
||||
self.testdriver = testdriver
|
||||
self.jsshell = jsshell
|
||||
|
@ -428,6 +432,7 @@ class TestharnessTest(Test):
|
|||
testdriver=testdriver,
|
||||
jsshell=jsshell,
|
||||
scripts=scripts,
|
||||
subdomain=manifest_item.subdomain,
|
||||
quic=quic)
|
||||
|
||||
@property
|
||||
|
@ -459,8 +464,8 @@ class ReftestTest(Test):
|
|||
test_type = "reftest"
|
||||
|
||||
def __init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, references,
|
||||
timeout=None, path=None, viewport_size=None, dpi=None, fuzzy=None, protocol="http",
|
||||
quic=False):
|
||||
timeout=None, path=None, viewport_size=None, dpi=None, fuzzy=None,
|
||||
protocol="http", quic=False):
|
||||
Test.__init__(self, url_base, tests_root, url, inherit_metadata, test_metadata, timeout,
|
||||
path, protocol, quic)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче