Commit 2d39359f authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Skip the "jsshell" test variant in WPT

This CL skips all the testharness tests with the extra property
"jsshell" set to true when parsing the WPT manifest. These tests are
generated from .any.js files with the optional "jsshell" global scope.
They are intended to run in a JavaScript shell; when running in a
browser, they behave the same as the default variant (i.e. the window
scope, .any.html).

Besides, the generated test names for the jsshell variant have the same
basenames as the default varaint (*.any.js and *.any.html respectively),
which breaks our infra.

Bug: 871950
Change-Id: I9f8e81251550399a5d6566b49998aa79209dcf34
Reviewed-on: https://chromium-review.googlesource.com/1166332
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581544}
parent e41039e1
......@@ -88,6 +88,17 @@ class WPTManifest(object):
def _get_extras_from_item(item):
return item[-1]
@staticmethod
def _is_not_jsshell(item):
"""Returns True if the manifest item isn't a jsshell test.
"jsshell" is one of the scopes automatically generated from .any.js
tests. It is intended to run in a thin JavaScript shell instead of a
full browser, so we simply ignore it in web tests. (crbug.com/871950)
"""
extras = WPTManifest._get_extras_from_item(item)
return not extras.get('jsshell', False)
@memoized
def all_url_items(self):
"""Returns a dict mapping every URL in the manifest to its item."""
......@@ -96,7 +107,7 @@ class WPTManifest(object):
return url_items
for test_type in self.test_types:
for records in self.raw_dict['items'][test_type].itervalues():
for item in records:
for item in filter(self._is_not_jsshell, records):
url_items[self._get_url_from_item(item)] = item
return url_items
......@@ -121,7 +132,8 @@ class WPTManifest(object):
manifest_items = self._items_for_file_path(path_in_wpt)
assert manifest_items is not None
# Remove the leading slashes when returning.
return [self._get_url_from_item(item)[1:] for item in manifest_items]
return [self._get_url_from_item(item)[1:]
for item in manifest_items if self._is_not_jsshell(item)]
def is_slow_test(self, url):
"""Checks if a WPT is slow (long timeout) according to the manifest.
......
......@@ -66,3 +66,43 @@ class WPTManifestUnitTest(unittest.TestCase):
with self.assertRaises(ScriptError):
WPTManifest.ensure_manifest(host)
def test_all_url_items_skips_jsshell_tests(self):
manifest_json = '''
{
"items": {
"manual": {},
"reftest": {},
"testharness": {
"test.any.js": [
["/test.any.html", {}],
["/test.any.js", {"jsshell": true}]
]
}
}
}
'''
manifest = WPTManifest(manifest_json)
self.assertEqual(manifest.all_url_items(),
{u'/test.any.html': [u'/test.any.html', {}]})
def test_file_path_to_url_paths(self):
manifest_json = '''
{
"items": {
"manual": {},
"reftest": {},
"testharness": {
"test.any.js": [
["/test.any.html", {}],
["/test.any.js", {"jsshell": true}]
]
}
}
}
'''
manifest = WPTManifest(manifest_json)
# Leading slashes should be stripped; and jsshell tests shouldn't be
# included.
self.assertEqual(manifest.file_path_to_url_paths('test.any.js'),
[u'test.any.html'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment