summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/tools/blinkpy/third_party
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-16 11:45:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-07-17 08:59:23 +0000
commit552906b0f222c5d5dd11b9fd73829d510980461a (patch)
tree3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/blink/tools/blinkpy/third_party
parent1b05827804eaf047779b597718c03e7d38344261 (diff)
downloadqtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/tools/blinkpy/third_party')
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/README.chromium7
-rwxr-xr-xchromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh7
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/chromium.patch49
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/ci/commands.json24
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/lint.py17
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/rules.py153
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/localpaths.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py52
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py143
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py23
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py36
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py26
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/taskcluster/commands.json4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/LICENSE2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py80
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py13
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py3
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py160
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py29
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/paths1
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py35
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/wpt.py3
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py25
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py28
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py12
-rwxr-xr-xchromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt9
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt.py2
31 files changed, 610 insertions, 349 deletions
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/README.chromium b/chromium/third_party/blink/tools/blinkpy/third_party/README.chromium
index a29e81d4e99..4ae445d81dd 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/README.chromium
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/README.chromium
@@ -32,7 +32,7 @@ Local Modifications: None
Name: web-platform-tests - Test Suites for Web Platform specifications
Short Name: wpt
URL: https://github.com/web-platform-tests/wpt/
-Version: 3ee67ef03aeee31247ee1b5aca3e91ddef4fdfd8
+Version: 3061f228d3d8b900b3aec8c7642ff58fc04ea011
License: LICENSES FOR W3C TEST SUITES (https://www.w3.org/Consortium/Legal/2008/03-bsd-license.html)
License File: wpt/wpt/LICENSE.md
Security Critical: no
@@ -43,4 +43,7 @@ Description: This includes code for the manifest tool, lint tool, and wptserve.
for more details on maintenance.
Local Modifications:
- Removed all files except for those listed in wpt/WPTWhiteList.
-- Added --ignore-glob option for ignoring an extra glob of files (used for ignoring *-expected.txt).
+- Cherry-picked the server part of https://github.com/web-platform-tests/wpt/pull/21705
+ (we cannot yet directly roll to that revision because of MANIFEST v8 changes).
+- Cherry-picked the server part of https://github.com/web-platform-tests/wpt/pull/21845
+ (Same reason with the previous cherry-pick. This enables pywebsocket3 usage).
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh
index f0c4c8243bd..e043ecb7a32 100755
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh
@@ -9,7 +9,7 @@ cd $DIR
TARGET_DIR=$DIR/wpt
REMOTE_REPO="https://github.com/web-platform-tests/wpt.git"
-WPT_HEAD=3ee67ef03aeee31247ee1b5aca3e91ddef4fdfd8
+WPT_HEAD=3061f228d3d8b900b3aec8c7642ff58fc04ea011
function clone {
# Remove existing repo if already exists.
@@ -21,9 +21,8 @@ function clone {
echo "WPTHead: " `git rev-parse HEAD`
# Apply local changes.
- git apply $DIR/chromium.patch
- # Chromium presubmit requires scripts with shebang to be executable.
- chmod 755 tools/manifest/update.py
+ git cherry-pick 644a206e8ace488eac7e2b2a58a4b5354b02363a
+ git cherry-pick 7e52ecb9b61b73425093d39dbadceb9c6e10b754
}
function reduce {
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/chromium.patch b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/chromium.patch
deleted file mode 100644
index c65fd3b6eba..00000000000
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/chromium.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-diff --git a/tools/lint/lint.py b/tools/lint/lint.py
-index 6a71dc860f..5b156b1c45 100644
---- a/tools/lint/lint.py
-+++ b/tools/lint/lint.py
-@@ -818,6 +818,7 @@ def create_parser():
- help="Output markdown")
- parser.add_argument("--repo-root", help="The WPT directory. Use this"
- "option if the lint script exists outside the repository")
-+ parser.add_argument("--ignore-glob", help="Additional file glob to ignore.")
- parser.add_argument("--all", action="store_true", help="If no paths are passed, try to lint the whole "
- "working directory, not just files that changed")
- return parser
-@@ -841,17 +842,22 @@ def main(**kwargs):
-
- paths = lint_paths(kwargs, repo_root)
-
-- return lint(repo_root, paths, output_format)
-+ ignore_glob = kwargs.get("ignore_glob")
-
-+ return lint(repo_root, paths, output_format, ignore_glob)
-
--def lint(repo_root, paths, output_format):
-- # type: (str, List[str], str) -> int
-+
-+def lint(repo_root, paths, output_format, ignore_glob):
-+ # type: (str, List[str], str, str) -> int
- error_count = defaultdict(int) # type: Dict[Text, int]
- last = None
-
- with open(os.path.join(repo_root, "lint.whitelist")) as f:
- whitelist, ignored_files = parse_whitelist(f)
-
-+ if ignore_glob:
-+ ignored_files.add(ignore_glob)
-+
- output_errors = {"json": output_errors_json,
- "markdown": output_errors_markdown,
- "normal": output_errors_text}[output_format]
-diff --git a/tools/wpt/paths b/tools/wpt/paths
-index 4528222fbf..93c97dc02b 100644
---- a/tools/wpt/paths
-+++ b/tools/wpt/paths
-@@ -1,6 +1,4 @@
--tools/ci/
- tools/lint/
- tools/manifest/
- tools/serve/
--tools/taskcluster/
- tools/wpt/
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/ci/commands.json b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/ci/commands.json
index 841fd855c80..c9cd7c45898 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/ci/commands.json
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/ci/commands.json
@@ -14,7 +14,7 @@
"virtualenv": false
},
"tc-download": {
- "path": "tcdownload.py",
+ "path": "tc/download.py",
"script": "run",
"parser": "get_parser",
"parse_known": true,
@@ -24,5 +24,27 @@
"requests",
"pygithub"
]
+ },
+ "tc-taskgraph": {
+ "path": "tc/taskgraph.py",
+ "script": "run",
+ "help": "Build the taskgraph",
+ "virtualenv": true,
+ "install": [
+ "requests",
+ "pyyaml"
+ ]
+ },
+ "tc-decision": {
+ "path": "tc/decision.py",
+ "parser": "get_parser",
+ "script": "run",
+ "help": "Run the decision task",
+ "virtualenv": true,
+ "install": [
+ "requests",
+ "pyyaml",
+ "taskcluster"
+ ]
}
}
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py
index d5ea4a6a8f3..0f3d9450d12 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py
@@ -269,7 +269,7 @@ class PathFilter(object):
target.append(item)
dirnames[:] = keep_dirs
- assert ".git" not in dirnames
+ assert not any(".git" == name for name, _ in dirnames)
yield orig_dirpath, dirnames, keep_files
def __call__(self,
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/lint.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/lint.py
index 39d78c032cd..4090f2628a6 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/lint.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/lint.py
@@ -392,6 +392,7 @@ regexps = [item() for item in # type: ignore
rules.MissingDepsRegexp,
rules.SpecialPowersRegexp]]
+
def check_regexp_line(repo_root, path, f):
# type: (str, str, IO[bytes]) -> List[rules.Error]
errors = [] # type: List[rules.Error]
@@ -405,6 +406,7 @@ def check_regexp_line(repo_root, path, f):
return errors
+
def check_parsed(repo_root, path, f):
# type: (str, str, IO[bytes]) -> List[rules.Error]
source_file = SourceFile(repo_root, path, "/", contents=f.read())
@@ -474,6 +476,9 @@ def check_parsed(repo_root, path, f):
errors.append(rules.InvalidTimeout.error(path, (timeout_value,)))
if source_file.testharness_nodes:
+ test_type = source_file.manifest_items()[0]
+ if test_type not in ("testharness", "manual"):
+ errors.append(rules.TestharnessInOtherType.error(path, (test_type,)))
if len(source_file.testharness_nodes) > 1:
errors.append(rules.MultipleTestharness.error(path))
@@ -484,10 +489,6 @@ def check_parsed(repo_root, path, f):
if len(testharnessreport_nodes) > 1:
errors.append(rules.MultipleTestharnessReport.error(path))
- testharnesscss_nodes = source_file.root.findall(".//{http://www.w3.org/1999/xhtml}link[@href='/resources/testharness.css']")
- if testharnesscss_nodes:
- errors.append(rules.PresentTestharnessCSS.error(path))
-
for element in source_file.variant_nodes:
if "content" not in element.attrib:
errors.append(rules.VariantMissing.error(path))
@@ -842,7 +843,7 @@ def create_parser():
help="Output machine-readable JSON format")
parser.add_argument("--markdown", action="store_true",
help="Output markdown")
- parser.add_argument("--repo-root", help="The WPT directory. Use this"
+ parser.add_argument("--repo-root", help="The WPT directory. Use this "
"option if the lint script exists outside the repository")
parser.add_argument("--ignore-glob", help="Additional file glob to ignore.")
parser.add_argument("--all", action="store_true", help="If no paths are passed, try to lint the whole "
@@ -868,12 +869,12 @@ def main(**kwargs):
paths = lint_paths(kwargs, repo_root)
- ignore_glob = kwargs.get("ignore_glob")
+ ignore_glob = kwargs.get(str("ignore_glob")) or str()
- return lint(repo_root, paths, output_format, ignore_glob)
+ return lint(repo_root, paths, output_format, str(ignore_glob))
-def lint(repo_root, paths, output_format, ignore_glob):
+def lint(repo_root, paths, output_format, ignore_glob=str()):
# type: (str, List[str], str, str) -> int
error_count = defaultdict(int) # type: Dict[Text, int]
last = None
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/rules.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/rules.py
index c6f416e90ed..faa285fd7cd 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/rules.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/lint/rules.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import abc
+import inspect
import os
import re
@@ -13,6 +14,11 @@ if MYPY:
Error = Tuple[Text, Text, Text, Optional[int]]
+def collapse(text):
+ # type: (Text) -> Text
+ return inspect.cleandoc(str(text)).replace("\n", " ")
+
+
class Rule(six.with_metaclass(abc.ABCMeta)):
@abc.abstractproperty
def name(self):
@@ -55,6 +61,7 @@ class MissingLink(Rule):
class PathLength(Rule):
name = "PATH LENGTH"
description = "/%s longer than maximum path length (%d > 150)"
+ to_fix = "use shorter filename to rename the test file"
class FileType(Rule):
@@ -64,8 +71,9 @@ class FileType(Rule):
class WorkerCollision(Rule):
name = "WORKER COLLISION"
- description = ("path ends with %s which collides with generated tests "
- "from %s files")
+ description = collapse("""
+ path ends with %s which collides with generated tests from %s files
+ """)
class GitIgnoreFile(Rule):
@@ -86,8 +94,10 @@ class AhemSystemFont(Rule):
# TODO: Add tests for this rule
class IgnoredPath(Rule):
name = "IGNORED PATH"
- description = ("%s matches an ignore filter in .gitignore - "
- "please add a .gitignore exception")
+ description = collapse("""
+ %s matches an ignore filter in .gitignore - please add a .gitignore
+ exception
+ """)
class CSSCollidingTestName(Rule):
@@ -113,6 +123,9 @@ class SupportWrongDir(Rule):
class ParseFailed(Rule):
name = "PARSE-FAILED"
description = "Unable to parse file"
+ to_fix = """
+ examine the file to find the causes of any parse errors, and fix them.
+ """
class ContentManual(Rule):
@@ -127,8 +140,10 @@ class ContentVisual(Rule):
class AbsoluteUrlRef(Rule):
name = "ABSOLUTE-URL-REF"
- description = ("Reference test with a reference file specified via an "
- "absolute URL: '%s'")
+ description = collapse("""
+ Reference test with a reference file specified via an absolute URL:
+ '%s'
+ """)
class SameFileRef(Rule):
@@ -138,74 +153,108 @@ class SameFileRef(Rule):
class NonexistentRef(Rule):
name = "NON-EXISTENT-REF"
- description = ("Reference test with a non-existent '%s' relationship "
- "reference: '%s'")
+ description = collapse("""
+ Reference test with a non-existent '%s' relationship reference: '%s'
+ """)
class MultipleTimeout(Rule):
name = "MULTIPLE-TIMEOUT"
description = "More than one meta name='timeout'"
+ to_fix = """
+ ensure each test file has only one instance of a `<meta
+ name="timeout"...>` element
+ """
class InvalidTimeout(Rule):
name = "INVALID-TIMEOUT"
- description = "Invalid timeout value %s"
+ description = collapse("""
+ Test file with `<meta name='timeout'...>` element that has a `content`
+ attribute whose value is not `long`: %s
+ """)
+ to_fix = "replace the value of the `content` attribute with `long`"
class MultipleTestharness(Rule):
name = "MULTIPLE-TESTHARNESS"
- description = "More than one <script src='/resources/testharness.js'>"
+ description = "More than one `<script src='/resources/testharness.js'>`"
+ to_fix = """
+ ensure each test has only one `<script
+ src='/resources/testharnessreport.js'>` instance
+ """
class MissingTestharnessReport(Rule):
name = "MISSING-TESTHARNESSREPORT"
- description = "Missing <script src='/resources/testharnessreport.js'>"
+ description = "Missing `<script src='/resources/testharnessreport.js'>`"
+ to_fix = """
+ ensure each test file contains `<script
+ src='/resources/testharnessreport.js'>`
+ """
class MultipleTestharnessReport(Rule):
name = "MULTIPLE-TESTHARNESSREPORT"
- description = "More than one <script src='/resources/testharnessreport.js'>"
-
-
-class PresentTestharnessCSS(Rule):
- name = "PRESENT-TESTHARNESSCSS"
- description = "Explicit link to testharness.css present"
+ description = "More than one `<script src='/resources/testharnessreport.js'>`"
class VariantMissing(Rule):
name = "VARIANT-MISSING"
- description = "<meta name=variant> missing 'content' attribute"
+ description = collapse("""
+ Test file with a `<meta name='variant'...>` element that's missing a
+ `content` attribute
+ """)
+ to_fix = """
+ add a `content` attribute with an appropriate value to the `<meta
+ name='variant'...>` element
+ """
class MalformedVariant(Rule):
name = "MALFORMED-VARIANT"
- description = ("%s <meta name=variant> 'content' attribute must be the "
- "empty string or start with '?' or '#'")
+ description = collapse("""
+ %s `<meta name=variant>` 'content' attribute must be the empty string
+ or start with '?' or '#'
+ """)
class LateTimeout(Rule):
name = "LATE-TIMEOUT"
- description = "<meta name=timeout> seen after testharness.js script"
+ description = "`<meta name=timeout>` seen after testharness.js script"
+ description = collapse("""
+ Test file with `<meta name='timeout'...>` element after `<script
+ src='/resources/testharnessreport.js'>` element
+ """)
+ to_fix = """
+ move the `<meta name="timeout"...>` element to precede the `script`
+ element.
+ """
class EarlyTestharnessReport(Rule):
name = "EARLY-TESTHARNESSREPORT"
- description = "testharnessreport.js script seen before testharness.js script"
+ description = collapse("""
+ Test file has an instance of
+ `<script src='/resources/testharnessreport.js'>` prior to
+ `<script src='/resources/testharness.js'>`
+ """)
+ to_fix = "flip the order"
class MultipleTestdriver(Rule):
name = "MULTIPLE-TESTDRIVER"
- description = "More than one <script src='/resources/testdriver.js'>"
+ description = "More than one `<script src='/resources/testdriver.js'>`"
class MissingTestdriverVendor(Rule):
name = "MISSING-TESTDRIVER-VENDOR"
- description = "Missing <script src='/resources/testdriver-vendor.js'>"
+ description = "Missing `<script src='/resources/testdriver-vendor.js'>`"
class MultipleTestdriverVendor(Rule):
name = "MULTIPLE-TESTDRIVER-VENDOR"
- description = "More than one <script src='/resources/testdriver-vendor.js'>"
+ description = "More than one `<script src='/resources/testdriver-vendor.js'>`"
class TestharnessPath(Rule):
@@ -268,6 +317,11 @@ class BrokenMetadata(Rule):
description = "Metadata comment is not formatted correctly"
+class TestharnessInOtherType(Rule):
+ name = "TESTHARNESS-IN-OTHER-TYPE"
+ description = "testharness.js included in a %s test"
+
+
class Regexp(six.with_metaclass(abc.ABCMeta)):
@abc.abstractproperty
def pattern(self):
@@ -303,51 +357,83 @@ class Regexp(six.with_metaclass(abc.ABCMeta)):
class TabsRegexp(Regexp):
pattern = b"^\t"
name = "INDENT TABS"
- description = "Tabs used for indentation"
+ description = "Test-file line starts with one or more tab characters"
+ to_fix = "use spaces to replace any tab characters at beginning of lines"
+
class CRRegexp(Regexp):
pattern = b"\r$"
name = "CR AT EOL"
- description = "CR character in line separator"
+ description = "Test-file line ends with CR (U+000D) character"
+ to_fix = """
+ reformat file so each line just has LF (U+000A) line ending (standard,
+ cross-platform "Unix" line endings instead of, e.g., DOS line endings).
+ """
+
class SetTimeoutRegexp(Regexp):
pattern = br"setTimeout\s*\("
name = "SET TIMEOUT"
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
- description = "setTimeout used; step_timeout should typically be used instead"
+ description = "setTimeout used"
+ to_fix = """
+ replace all `setTimeout(...)` calls with `step_timeout(...)` calls
+ """
+
class W3CTestOrgRegexp(Regexp):
pattern = br"w3c\-test\.org"
name = "W3C-TEST.ORG"
- description = "External w3c-test.org domain used"
+ description = "Test-file line has the string `w3c-test.org`"
+ to_fix = """
+ either replace the `w3c-test.org` string with the expression
+ `{{host}}:{{ports[http][0]}}` or a generic hostname like `example.org`
+ """
+
class WebPlatformTestRegexp(Regexp):
pattern = br"web\-platform\.test"
name = "WEB-PLATFORM.TEST"
description = "Internal web-platform.test domain used"
+
class Webidl2Regexp(Regexp):
pattern = br"webidl2\.js"
name = "WEBIDL2.JS"
description = "Legacy webidl2.js script used"
+
class ConsoleRegexp(Regexp):
pattern = br"console\.[a-zA-Z]+\s*\("
name = "CONSOLE"
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
- description = "Console logging API used"
+ description = "Test-file line has a `console.*(...)` call"
+ to_fix = """
+ remove the `console.*(...)` call (and in some cases, consider adding an
+ `assert_*` of some kind in place of it)
+ """
+
class GenerateTestsRegexp(Regexp):
pattern = br"generate_tests\s*\("
name = "GENERATE_TESTS"
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
- description = "generate_tests used"
+ description = "Test file line has a generate_tests call"
+ to_fix = "remove the call and call `test()` a number of times instead"
+
class PrintRegexp(Regexp):
pattern = br"print(?:\s|\s*\()"
name = "PRINT STATEMENT"
file_extensions = [".py"]
- description = "Print function used"
+ description = collapse("""
+ A server-side python support file contains a `print` statement
+ """)
+ to_fix = """
+ remove the `print` statement or replace it with something else that
+ achieves the intended effect (e.g., a logging call)
+ """
+
class LayoutTestsRegexp(Regexp):
pattern = br"(eventSender|testRunner|internals)\."
@@ -355,6 +441,7 @@ class LayoutTestsRegexp(Regexp):
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
description = "eventSender/testRunner/internals used; these are LayoutTests-specific APIs (WebKit/Blink)"
+
class MissingDepsRegexp(Regexp):
pattern = br"[^\w]/gen/"
name = "MISSING DEPENDENCY"
@@ -362,12 +449,14 @@ class MissingDepsRegexp(Regexp):
description = "Chromium-specific content referenced"
to_fix = "Reimplement the test to use well-documented testing interfaces"
+
class SpecialPowersRegexp(Regexp):
pattern = b"SpecialPowers"
name = "SPECIALPOWERS API"
file_extensions = [".html", ".htm", ".js", ".xht", ".xhtml", ".svg"]
description = "SpecialPowers used; this is gecko-specific and not supported in wpt"
+
class TrailingWhitespaceRegexp(Regexp):
name = "TRAILING WHITESPACE"
description = "Whitespace at EOL"
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/localpaths.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/localpaths.py
index f6e24b486d5..ce3b41e300c 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/localpaths.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/localpaths.py
@@ -6,7 +6,7 @@ repo_root = os.path.abspath(os.path.join(here, os.pardir))
sys.path.insert(0, os.path.join(here))
sys.path.insert(0, os.path.join(here, "wptserve"))
-sys.path.insert(0, os.path.join(here, "pywebsocket"))
+sys.path.insert(0, os.path.join(here, "third_party", "pywebsocket3"))
sys.path.insert(0, os.path.join(here, "third_party", "atomicwrites"))
sys.path.insert(0, os.path.join(here, "third_party", "attrs", "src"))
sys.path.insert(0, os.path.join(here, "third_party", "funcsigs"))
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py
index 217f6cac262..fd3564bbe27 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py
@@ -1,4 +1,3 @@
-from copy import copy
from inspect import isabstract
from six import iteritems, with_metaclass
from six.moves.urllib.parse import urljoin, urlparse
@@ -196,9 +195,11 @@ class TestharnessTest(URLManifestItem):
return rv
-class RefTestBase(URLManifestItem):
+class RefTest(URLManifestItem):
__slots__ = ("references",)
+ item_type = "reftest"
+
def __init__(self,
tests_root, # type: Text
path, # type: Text
@@ -207,7 +208,7 @@ class RefTestBase(URLManifestItem):
references=None, # type: Optional[List[Tuple[Text, Text]]]
**extras # type: Any
):
- super(RefTestBase, self).__init__(tests_root, path, url_base, url, **extras)
+ super(RefTest, self).__init__(tests_root, path, url_base, url, **extras)
if references is None:
self.references = [] # type: List[Tuple[Text, Text]]
else:
@@ -266,7 +267,7 @@ class RefTestBase(URLManifestItem):
path, # type: Text
obj # type: Tuple[Text, List[Tuple[Text, Text]], Dict[Any, Any]]
):
- # type: (...) -> RefTestBase
+ # type: (...) -> RefTest
tests_root = manifest.tests_root
assert tests_root is not None
path = to_os_path(path)
@@ -278,38 +279,6 @@ class RefTestBase(URLManifestItem):
references,
**extras)
- def to_RefTest(self):
- # type: () -> RefTest
- if type(self) == RefTest:
- assert isinstance(self, RefTest)
- return self
- rv = copy(self)
- rv.__class__ = RefTest
- assert isinstance(rv, RefTest)
- return rv
-
- def to_RefTestNode(self):
- # type: () -> RefTestNode
- if type(self) == RefTestNode:
- assert isinstance(self, RefTestNode)
- return self
- rv = copy(self)
- rv.__class__ = RefTestNode
- assert isinstance(rv, RefTestNode)
- return rv
-
-
-class RefTestNode(RefTestBase):
- __slots__ = ()
-
- item_type = "reftest_node"
-
-
-class RefTest(RefTestBase):
- __slots__ = ()
-
- item_type = "reftest"
-
class ManualTest(URLManifestItem):
__slots__ = ()
@@ -329,6 +298,17 @@ class VisualTest(URLManifestItem):
item_type = "visual"
+class CrashTest(URLManifestItem):
+ __slots__ = ()
+
+ item_type = "crashtest"
+
+ @property
+ def timeout(self):
+ # type: () -> Optional[Text]
+ return None
+
+
class WebDriverSpecTest(URLManifestItem):
__slots__ = ()
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py
index 6fb591b9c31..bfac309c86a 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py
@@ -1,12 +1,11 @@
-import itertools
import json
import os
-from collections import MutableMapping, defaultdict
+from collections import MutableMapping
from six import iteritems, iterkeys, itervalues, string_types, binary_type, text_type
from . import vcs
-from .item import (ConformanceCheckerTest, ManifestItem, ManualTest, RefTest, RefTestNode,
- SupportFile, TestharnessTest, VisualTest, WebDriverSpecTest)
+from .item import (ConformanceCheckerTest, ManifestItem, ManualTest, RefTest, SupportFile,
+ TestharnessTest, VisualTest, WebDriverSpecTest, CrashTest)
from .log import get_logger
from .sourcefile import SourceFile
from .utils import from_os_path, to_os_path
@@ -28,7 +27,6 @@ if MYPY:
from typing import Tuple
from typing import Type
from typing import Union
- from typing import cast
try:
import ujson
@@ -36,7 +34,7 @@ try:
except ImportError:
fast_json = json # type: ignore
-CURRENT_VERSION = 6
+CURRENT_VERSION = 7
class ManifestError(Exception):
@@ -49,7 +47,7 @@ class ManifestVersionMismatch(ManifestError):
item_classes = {"testharness": TestharnessTest,
"reftest": RefTest,
- "reftest_node": RefTestNode,
+ "crashtest": CrashTest,
"manual": ManualTest,
"wdspec": WebDriverSpecTest,
"conformancechecker": ConformanceCheckerTest,
@@ -246,7 +244,6 @@ class Manifest(object):
assert url_base is not None
self._path_hash = {} # type: Dict[Text, Tuple[Text, Text]]
self._data = ManifestData(self) # type: ManifestData
- self._reftest_nodes_by_url = None # type: Optional[Dict[Text, Union[RefTest, RefTestNode]]]
self.tests_root = tests_root # type: Optional[str]
self.url_base = url_base # type: Text
@@ -279,23 +276,6 @@ class Manifest(object):
for test in tests:
yield test
- @property
- def reftest_nodes_by_url(self):
- # type: () -> Dict[Text, Union[RefTest, RefTestNode]]
- if self._reftest_nodes_by_url is None:
- by_url = {}
- for path, nodes in itertools.chain(iteritems(self._data["reftest"]),
- iteritems(self._data["reftest_node"])):
- for node in nodes:
- assert isinstance(node, (RefTest, RefTestNode))
- by_url[node.url] = node
- self._reftest_nodes_by_url = by_url
- return self._reftest_nodes_by_url
-
- def get_reference(self, url):
- # type: (Text) -> Optional[ManifestItem]
- return self.reftest_nodes_by_url.get(url)
-
def update(self, tree):
# type: (Iterable[Tuple[Union[SourceFile, bytes], bool]]) -> bool
"""Update the manifest given an iterable of items that make up the updated manifest.
@@ -305,11 +285,9 @@ class Manifest(object):
unusual API is designed as an optimistaion meaning that SourceFile items need not be
constructed in the case we are not updating a path, but the absence of an item from
the iterator may be used to remove defunct entries from the manifest."""
- all_reftest_nodes = [] # type: List[Tuple[ManifestItem, Text]]
seen_files = set() # type: Set[Text]
changed = False
- reftest_changes = False
# Create local variable references to these dicts so we avoid the
# attribute access in the hot loop below
@@ -318,8 +296,6 @@ class Manifest(object):
prev_files = data.paths() # type: Set[Text]
- reftest_types = ("reftest", "reftest_node")
-
for source_file, update in tree:
if not update:
assert isinstance(source_file, (binary_type, text_type))
@@ -327,9 +303,6 @@ class Manifest(object):
seen_files.add(rel_path)
assert rel_path in path_hash
old_hash, old_type = path_hash[rel_path] # type: Tuple[Text, Text]
- if old_type in reftest_types:
- manifest_items = data[old_type][rel_path] # type: Iterable[ManifestItem]
- all_reftest_nodes.extend((item, old_hash) for item in manifest_items)
else:
assert not isinstance(source_file, bytes)
rel_path = source_file.rel_path
@@ -343,28 +316,14 @@ class Manifest(object):
if not is_new:
old_hash, old_type = path_hash[rel_path]
if old_hash != file_hash:
- new_type, manifest_items = source_file.manifest_items()
hash_changed = True
- if new_type != old_type:
- del data[old_type][rel_path]
- if old_type in reftest_types:
- reftest_changes = True
- else:
- new_type = old_type
- if old_type in reftest_types:
- manifest_items = data[old_type][rel_path]
- else:
- new_type, manifest_items = source_file.manifest_items()
-
- if new_type in reftest_types:
- all_reftest_nodes.extend((item, file_hash) for item in manifest_items)
- if is_new or hash_changed:
- reftest_changes = True
- elif is_new or hash_changed:
- data[new_type][rel_path] = set(manifest_items)
if is_new or hash_changed:
+ new_type, manifest_items = source_file.manifest_items()
+ data[new_type][rel_path] = set(manifest_items)
path_hash[rel_path] = (file_hash, new_type)
+ if hash_changed and new_type != old_type:
+ del data[old_type][rel_path]
changed = True
deleted = prev_files - seen_files
@@ -373,8 +332,6 @@ class Manifest(object):
for rel_path in deleted:
if rel_path in path_hash:
_, old_type = path_hash[rel_path]
- if old_type in reftest_types:
- reftest_changes = True
del path_hash[rel_path]
try:
del data[old_type][rel_path]
@@ -385,65 +342,8 @@ class Manifest(object):
if rel_path in test_data:
del test_data[rel_path]
- if reftest_changes:
- reftests, reftest_nodes, changed_hashes = self._compute_reftests(all_reftest_nodes)
- reftest_data = data["reftest"]
- reftest_data.clear()
- for path, items in iteritems(reftests):
- if MYPY:
- reftest_data[path] = cast(Set[ManifestItem], items)
- else:
- reftest_data[path] = items
-
- reftest_node_data = data["reftest_node"]
- reftest_node_data.clear()
- for node_path, node_items in iteritems(reftest_nodes):
- if MYPY:
- reftest_node_data[node_path] = cast(Set[ManifestItem], node_items)
- else:
- reftest_node_data[node_path] = node_items
-
- path_hash.update(changed_hashes)
-
return changed
- def _compute_reftests(self,
- reftest_nodes # type: List[Tuple[ManifestItem, Text]]
- ):
- # type: (...) -> Tuple[Dict[Text, Set[RefTest]], Dict[Text, Set[RefTestNode]], Dict[Text, Tuple[Text, Text]]]
- self._reftest_nodes_by_url = {}
- has_inbound = set()
- for item, _ in reftest_nodes:
- assert isinstance(item, (RefTestNode, RefTest))
- for ref_url, ref_type in item.references:
- has_inbound.add(ref_url)
-
- reftests = defaultdict(set) # type: Dict[Text, Set[RefTest]]
- references = defaultdict(set) # type: Dict[Text, Set[RefTestNode]]
- changed_hashes = {} # type: Dict[Text, Tuple[Text, Text]]
-
- for item, file_hash in reftest_nodes:
- assert isinstance(item, (RefTestNode, RefTest))
- if item.url in has_inbound:
- # This is a reference
- if isinstance(item, RefTest):
- item = item.to_RefTestNode()
- changed_hashes[item.path] = (file_hash,
- item.item_type)
- assert isinstance(item, RefTestNode)
- references[item.path].add(item)
- else:
- if isinstance(item, RefTestNode):
- item = item.to_RefTest()
- changed_hashes[item.path] = (file_hash,
- item.item_type)
- assert isinstance(item, RefTest)
- reftests[item.path].add(item)
- assert isinstance(item, (RefTestNode, RefTest))
- self._reftest_nodes_by_url[item.url] = item
-
- return reftests, references, changed_hashes
-
def to_json(self):
# type: () -> Dict[Text, Any]
out_items = {
@@ -469,13 +369,26 @@ class Manifest(object):
self._path_hash = {to_os_path(k): v for k, v in iteritems(obj["paths"])}
+ # merge reftest_node and reftest
+ # TODO(MANIFESTv8): remove this condition
+ if "reftest_node" in obj["items"]:
+ for path in obj["items"]["reftest_node"]:
+ os_path = to_os_path(path)
+ old_hash, old_type = self._path_hash[os_path]
+ self._path_hash[os_path] = (old_hash, "reftest")
+
for test_type, type_paths in iteritems(obj["items"]):
- # Drop "stub" items, which are no longer supported but may be
- # present when doing an incremental manifest update.
- # See https://github.com/web-platform-tests/rfcs/pull/27 for background.
- #
- # TODO(MANIFESTv7): remove this condition
- if test_type == "stub":
+ # merge reftest_node and reftest
+ # TODO(MANIFESTv8): remove this condition
+ if test_type in ("reftest", "reftest_node"):
+ if types and "reftest" not in types:
+ continue
+
+ if self._data["reftest"].json_data:
+ self._data["reftest"].json_data.update(type_paths)
+ else:
+ self._data["reftest"].set_json(tests_root, type_paths)
+
continue
if test_type not in item_classes:
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py
index 4788fc9bdb6..2131c703e04 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py
@@ -33,8 +33,8 @@ except ImportError:
import html5lib
from . import XMLParser
-from .item import (ManifestItem, ManualTest, WebDriverSpecTest, RefTestNode, TestharnessTest,
- SupportFile, ConformanceCheckerTest, VisualTest)
+from .item import (ManifestItem, ManualTest, WebDriverSpecTest, RefTest, TestharnessTest,
+ SupportFile, CrashTest, ConformanceCheckerTest, VisualTest)
from .utils import ContextManagerBytesIO, cached_property
wd_pattern = "*.py"
@@ -339,6 +339,7 @@ class SourceFile(object):
self.filename == "META.yml" or
self.filename.startswith(".") or
self.filename.endswith(".headers") or
+ self.filename.endswith(".ini") or
self.in_non_test_dir())
@property
@@ -409,6 +410,11 @@ class SourceFile(object):
return "/reference/" in self.url or bool(reference_file_re.search(self.name))
@property
+ def name_is_crashtest(self):
+ # type: () -> bool
+ return self.type_flag == "crash" or "crashtests" in self.dir_path.split(os.path.sep)
+
+ @property
def markup_type(self):
# type: () -> Optional[Text]
"""Return the type of markup contained in a file, based on its extension,
@@ -820,6 +826,15 @@ class SourceFile(object):
self.rel_url
)]
+ elif self.name_is_crashtest:
+ rv = CrashTest.item_type, [
+ CrashTest(
+ self.tests_root,
+ self.rel_path,
+ self.url_base,
+ self.rel_url
+ )]
+
elif self.name_is_multi_global:
globals = b""
script_metadata = self.script_metadata
@@ -909,8 +924,8 @@ class SourceFile(object):
))
elif self.content_is_ref_node:
- rv = RefTestNode.item_type, [
- RefTestNode(
+ rv = RefTest.item_type, [
+ RefTest(
self.tests_root,
self.rel_path,
self.url_base,
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py
index 3c1f09d4373..2197792cd64 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py
@@ -33,6 +33,8 @@ def create_parser():
parser.add_argument(
"-p", "--path", type=abs_path, help="Path to manifest file.")
parser.add_argument(
+ "--src-root", type=abs_path, default=None, help="Path to root of sourcetree.")
+ parser.add_argument(
"--tests-root", type=abs_path, default=wpt_root, help="Path to root of tests.")
parser.add_argument(
"--no-update", dest="update", action="store_false", default=True,
@@ -55,25 +57,35 @@ def create_parser():
return parser
-def get_path_id_map(manifest_file, test_ids):
- # type: (Manifest, Iterable[Text]) -> Dict[Text, List[Text]]
+def get_path_id_map(src_root, tests_root, manifest_file, test_ids):
+ # type: (Text, Text, Manifest, Iterable[Text]) -> Dict[Text, List[Text]]
test_ids = set(test_ids)
path_id_map = defaultdict(list) # type: Dict[Text, List[Text]]
+ compute_rel_path = src_root != tests_root
+
for item_type, path, tests in manifest_file:
for test in tests:
if test.id in test_ids:
- path_id_map[path].append(test.id)
+ if compute_rel_path:
+ rel_path = os.path.relpath(os.path.join(tests_root, path),
+ src_root)
+ else:
+ rel_path = path
+ path_id_map[rel_path].append(test.id)
return path_id_map
-def run(**kwargs):
- # type: (**Any) -> None
+def get_paths(**kwargs):
+ # type: (**Any) -> Dict[Text, List[Text]]
tests_root = kwargs["tests_root"]
assert tests_root is not None
path = kwargs["path"]
if path is None:
path = os.path.join(kwargs["tests_root"], "MANIFEST.json")
+ src_root = kwargs["src_root"]
+ if src_root is None:
+ src_root = tests_root
manifest_file = load_and_update(tests_root,
path,
@@ -82,11 +94,21 @@ def run(**kwargs):
rebuild=kwargs["rebuild"],
cache_root=kwargs["cache_root"])
- path_id_map = get_path_id_map(manifest_file, kwargs["test_ids"])
- if kwargs["json"]:
+ return get_path_id_map(src_root, tests_root, manifest_file, kwargs["test_ids"])
+
+
+def write_output(path_id_map, as_json):
+ # type: (Dict[Text, List[Text]], bool) -> None
+ if as_json:
print(json.dumps(path_id_map))
else:
for path, test_ids in sorted(iteritems(path_id_map)):
print(path)
for test_id in sorted(test_ids):
print(" " + test_id)
+
+
+def run(**kwargs):
+ # type: (**Any) -> None
+ path_id_map = get_paths(**kwargs)
+ write_output(path_id_map, as_json=kwargs["json"])
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py
index 1868b1a36e5..5317be013ee 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py
@@ -351,7 +351,7 @@ class RoutesBuilder(object):
if headers is None:
headers = {}
handler = handlers.StaticHandler(path, format_args, content_type, **headers)
- self.add_handler(b"GET", str(route), handler)
+ self.add_handler("GET", str(route), handler)
def add_mount_point(self, url_base, path):
url_base = "/%s/" % url_base.strip("/") if url_base != "/" else "/"
@@ -366,6 +366,7 @@ class RoutesBuilder(object):
("GET", "*.any.serviceworker.html", ServiceWorkersHandler),
("GET", "*.any.worker.js", AnyWorkerHandler),
("GET", "*.asis", handlers.AsIsHandler),
+ ("GET", "/.well-known/origin-policy", handlers.PythonScriptHandler),
("*", "*.py", handlers.PythonScriptHandler),
("GET", "*", handlers.FileHandler)
]
@@ -591,21 +592,9 @@ class WebSocketDaemon(object):
"-w", handlers_root]
if ssl_config is not None:
- # This is usually done through pywebsocket.main, however we're
- # working around that to get the server instance and manually
- # setup the wss server.
- if pywebsocket._import_ssl():
- tls_module = pywebsocket._TLS_BY_STANDARD_MODULE
- elif pywebsocket._import_pyopenssl():
- tls_module = pywebsocket._TLS_BY_PYOPENSSL
- else:
- print("No SSL module available")
- sys.exit(1)
-
cmd_args += ["--tls",
"--private-key", ssl_config["key_path"],
- "--certificate", ssl_config["cert_path"],
- "--tls-module", tls_module]
+ "--certificate", ssl_config["cert_path"]]
if (bind_address):
cmd_args = ["-H", host] + cmd_args
@@ -739,6 +728,9 @@ def build_config(override_path=None, **kwargs):
def _make_subdomains_product(s, depth=2):
return {u".".join(x) for x in chain(*(product(s, repeat=i) for i in range(1, depth+1)))}
+def _make_origin_policy_subdomains(limit):
+ return {u"op%d" % x for x in range(1,limit+1)}
+
_subdomains = {u"www",
u"www1",
@@ -750,6 +742,12 @@ _not_subdomains = {u"nonexistent"}
_subdomains = _make_subdomains_product(_subdomains)
+# Origin policy subdomains need to not be reused by any other tests, since origin policies have
+# origin-wide impacts like installing a CSP or Feature Policy that could interfere with features
+# under test.
+# See https://github.com/web-platform-tests/rfcs/pull/44.
+_subdomains |= _make_origin_policy_subdomains(99)
+
_not_subdomains = _make_subdomains_product(_not_subdomains)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/taskcluster/commands.json b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/taskcluster/commands.json
deleted file mode 100644
index dcbd8961fc2..00000000000
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/taskcluster/commands.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "tc-verify": {"path": "verify.py", "script": "run", "parser": "create_parser", "help": "Verify .taskcluster.yml file is parsable",
- "virtualenv": true, "install": ["json-e", "pyyaml"]}
-}
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/LICENSE b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/LICENSE
index f3068bfd9e0..4b05a545261 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/LICENSE
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2017 Benjamin Peterson
+Copyright (c) 2010-2019 Benjamin Peterson
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py
index 6bf4fd38104..d0aece89fa4 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2017 Benjamin Peterson
+# Copyright (c) 2010-2019 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@ import sys
import types
__author__ = "Benjamin Peterson <benjamin@python.org>"
-__version__ = "1.11.0"
+__version__ = "1.13.0"
# Useful for very coarse version differentiation.
@@ -255,8 +255,10 @@ _moved_attributes = [
MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
MovedModule("builtins", "__builtin__"),
MovedModule("configparser", "ConfigParser"),
+ MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"),
MovedModule("copyreg", "copy_reg"),
MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
+ MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"),
MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
MovedModule("http_cookies", "Cookie", "http.cookies"),
@@ -637,6 +639,7 @@ if PY3:
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
+ del io
_assertCountEqual = "assertCountEqual"
if sys.version_info[1] <= 1:
_assertRaisesRegex = "assertRaisesRegexp"
@@ -824,7 +827,15 @@ def with_metaclass(meta, *bases):
class metaclass(type):
def __new__(cls, name, this_bases, d):
- return meta(name, bases, d)
+ if sys.version_info[:2] >= (3, 7):
+ # This version introduced PEP 560 that requires a bit
+ # of extra care (we mimic what is done by __build_class__).
+ resolved_bases = types.resolve_bases(bases)
+ if resolved_bases is not bases:
+ d['__orig_bases__'] = bases
+ else:
+ resolved_bases = bases
+ return meta(name, resolved_bases, d)
@classmethod
def __prepare__(cls, name, this_bases):
@@ -844,13 +855,74 @@ def add_metaclass(metaclass):
orig_vars.pop(slots_var)
orig_vars.pop('__dict__', None)
orig_vars.pop('__weakref__', None)
+ if hasattr(cls, '__qualname__'):
+ orig_vars['__qualname__'] = cls.__qualname__
return metaclass(cls.__name__, cls.__bases__, orig_vars)
return wrapper
+def ensure_binary(s, encoding='utf-8', errors='strict'):
+ """Coerce **s** to six.binary_type.
+
+ For Python 2:
+ - `unicode` -> encoded to `str`
+ - `str` -> `str`
+
+ For Python 3:
+ - `str` -> encoded to `bytes`
+ - `bytes` -> `bytes`
+ """
+ if isinstance(s, text_type):
+ return s.encode(encoding, errors)
+ elif isinstance(s, binary_type):
+ return s
+ else:
+ raise TypeError("not expecting type '%s'" % type(s))
+
+
+def ensure_str(s, encoding='utf-8', errors='strict'):
+ """Coerce *s* to `str`.
+
+ For Python 2:
+ - `unicode` -> encoded to `str`
+ - `str` -> `str`
+
+ For Python 3:
+ - `str` -> `str`
+ - `bytes` -> decoded to `str`
+ """
+ if not isinstance(s, (text_type, binary_type)):
+ raise TypeError("not expecting type '%s'" % type(s))
+ if PY2 and isinstance(s, text_type):
+ s = s.encode(encoding, errors)
+ elif PY3 and isinstance(s, binary_type):
+ s = s.decode(encoding, errors)
+ return s
+
+
+def ensure_text(s, encoding='utf-8', errors='strict'):
+ """Coerce *s* to six.text_type.
+
+ For Python 2:
+ - `unicode` -> `unicode`
+ - `str` -> `unicode`
+
+ For Python 3:
+ - `str` -> `str`
+ - `bytes` -> decoded to `str`
+ """
+ if isinstance(s, binary_type):
+ return s.decode(encoding, errors)
+ elif isinstance(s, text_type):
+ return s
+ else:
+ raise TypeError("not expecting type '%s'" % type(s))
+
+
+
def python_2_unicode_compatible(klass):
"""
- A decorator that defines __unicode__ and __str__ methods under Python 2.
+ A class decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py
index 217bfc65272..d860b9ea253 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py
@@ -1,6 +1,6 @@
# flake8: noqa
-from client import (
+from .client import (
Cookies,
Element,
Find,
@@ -8,7 +8,7 @@ from client import (
Session,
Timeouts,
Window)
-from error import (
+from .error import (
ElementNotSelectableException,
ElementNotVisibleException,
InvalidArgumentException,
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py
index 0bddd7b1373..cf4c5fd35fd 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py
@@ -1,10 +1,9 @@
-import urlparse
-
-import error
-import protocol
-import transport
+from . import error
+from . import protocol
+from . import transport
from six import string_types
+from six.moves.urllib import parse as urlparse
def command(func):
@@ -739,6 +738,10 @@ class Element(object):
return self.send_element_command("GET", "selected")
@command
+ def screenshot(self):
+ return self.send_element_command("GET", "screenshot")
+
+ @command
def attribute(self, name):
return self.send_element_command("GET", "attribute/%s" % name)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py
index 23ffc40b31f..0647e7eb61f 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py
@@ -1,6 +1,7 @@
import collections
import json
+from six import itervalues
class WebDriverException(Exception):
http_status = None
@@ -205,6 +206,6 @@ def get(error_code):
_errors = collections.defaultdict()
-for item in locals().values():
+for item in list(itervalues(locals())):
if type(item) == type and issubclass(item, WebDriverException):
_errors[item.status_code] = item
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py
index e9574006365..32ba31a2ae9 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py
@@ -1,9 +1,9 @@
-import httplib
import json
import select
-import urlparse
+from six.moves.urllib import parse as urlparse
+from six.moves import http_client as httplib
-import error
+from . import error
from six import text_type
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py
index fb10d756313..c9a5353ab4f 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py
@@ -6,14 +6,14 @@ import stat
import errno
import subprocess
import tempfile
-import urlparse
from abc import ABCMeta, abstractmethod
from datetime import datetime, timedelta
from distutils.spawn import find_executable
+from six.moves.urllib.parse import urlsplit
import requests
-from utils import call, get, untar, unzip
+from .utils import call, get, untar, unzip
uname = platform.uname()
@@ -41,6 +41,14 @@ def handle_remove_readonly(func, path, exc):
raise
+def get_ext(filename):
+ """Get the extension from a filename with special handling for .tar.foo"""
+ name, ext = os.path.splitext(filename)
+ if name.endswith(".tar"):
+ ext = ".tar%s" % ext
+ return ext
+
+
class Browser(object):
__metaclass__ = ABCMeta
@@ -48,6 +56,16 @@ class Browser(object):
self.logger = logger
@abstractmethod
+ def download(self, dest=None, channel=None, rename=None):
+ """Download a package or installer for the browser
+ :param dest: Directory in which to put the dowloaded package
+ :param channel: Browser channel to download
+ :param rename: Optional name for the downloaded package; the original
+ extension is preserved.
+ """
+ return NotImplemented
+
+ @abstractmethod
def install(self, dest=None):
"""Install the browser."""
return NotImplemented
@@ -91,7 +109,6 @@ class Firefox(Browser):
product = "firefox"
binary = "browsers/firefox/firefox"
- platform_ini = "browsers/firefox/platform.ini"
requirements = "requirements_firefox.txt"
platform = {
@@ -117,11 +134,19 @@ class Firefox(Browser):
return "%s%s" % (self.platform, bits)
- def install(self, dest=None, channel="nightly"):
- """Install Firefox."""
+ def _get_dest(self, dest, channel):
+ if dest is None:
+ # os.getcwd() doesn't include the venv path
+ dest = os.path.join(os.getcwd(), "_venv")
- import mozinstall
+ dest = os.path.join(dest, "browsers", channel)
+
+ if not os.path.exists(dest):
+ os.makedirs(dest)
+ return dest
+
+ def download(self, dest=None, channel="nightly", rename=None):
product = {
"nightly": "firefox-nightly-latest-ssl",
"beta": "firefox-beta-latest-ssl",
@@ -137,21 +162,15 @@ class Firefox(Browser):
}
os_key = (self.platform, uname[4])
+ if dest is None:
+ dest = self._get_dest(None, channel)
+
if channel not in product:
raise ValueError("Unrecognised release channel: %s" % channel)
if os_key not in os_builds:
raise ValueError("Unsupported platform: %s %s" % os_key)
- if dest is None:
- # os.getcwd() doesn't include the venv path
- dest = os.path.join(os.getcwd(), "_venv")
-
- dest = os.path.join(dest, "browsers", channel)
-
- if not os.path.exists(dest):
- os.makedirs(dest)
-
url = "https://download.mozilla.org/?product=%s&os=%s&lang=en-US" % (product[channel],
os_builds[os_key])
self.logger.info("Downloading Firefox from %s" % url)
@@ -166,16 +185,31 @@ class Firefox(Browser):
filename = filenames[0]
if not filename:
- filename = urlparse.urlsplit(resp.url).path.rsplit("/", 1)[1]
+ filename = urlsplit(resp.url).path.rsplit("/", 1)[1]
if not filename:
filename = "firefox.tar.bz2"
+ if rename:
+ filename = "%s%s" % (rename, get_ext(filename))
+
installer_path = os.path.join(dest, filename)
with open(installer_path, "wb") as f:
f.write(resp.content)
+ return installer_path
+
+ def install(self, dest=None, channel="nightly"):
+ """Install Firefox."""
+ import mozinstall
+
+ dest = self._get_dest(dest, channel)
+
+ filename = os.path.basename(dest)
+
+ installer_path = self.download(dest, channel)
+
try:
mozinstall.install(installer_path, dest)
except mozinstall.mozinstall.InstallError:
@@ -423,7 +457,7 @@ class FirefoxAndroid(Browser):
product = "firefox_android"
requirements = "requirements_firefox.txt"
- def install(self, dest=None, channel=None):
+ def download(self, dest=None, channel=None, rename=None):
if dest is None:
dest = os.pwd
@@ -446,13 +480,19 @@ class FirefoxAndroid(Browser):
(task_id, "public/build/geckoview-androidTest.apk"))
resp.raise_for_status()
- apk_path = os.path.join(dest, "geckoview-androidTest.apk")
+ filename = "geckoview-androidTest.apk"
+ if rename:
+ filename = "%s%s" % (rename, get_ext(filename)[1])
+ apk_path = os.path.join(dest, filename)
with open(apk_path, "wb") as f:
f.write(resp.content)
return apk_path
+ def install(self, dest=None, channel=None):
+ return self.download(dest, channel)
+
def install_prefs(self, binary, dest=None, channel=None):
fx_browser = Firefox(self.logger)
return fx_browser.install_prefs(binary, dest, channel)
@@ -479,6 +519,9 @@ class Chrome(Browser):
product = "chrome"
requirements = "requirements_chrome.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -634,6 +677,9 @@ class ChromeAndroidBase(Browser):
super(ChromeAndroidBase, self).__init__(logger)
self.device_serial = None
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -685,6 +731,20 @@ class ChromeAndroid(ChromeAndroidBase):
return "com.android.chrome"
+#TODO(aluo): This is largely copied from the AndroidWebView implementation.
+# Tests are not running for weblayer yet (crbug/1019521), this
+# initial implementation will help to reproduce and debug any issues.
+class AndroidWeblayer(ChromeAndroidBase):
+ """Weblayer-specific interface for Android."""
+
+ product = "android_weblayer"
+ # TODO(aluo): replace this with weblayer version after tests are working.
+ requirements = "requirements_android_webview.txt"
+
+ def find_binary(self, venv_path=None, channel=None):
+ return "org.chromium.weblayer.shell"
+
+
class AndroidWebview(ChromeAndroidBase):
"""Webview-specific interface for Android.
@@ -725,6 +785,9 @@ class ChromeiOS(Browser):
product = "chrome_ios"
requirements = "requirements_chrome_ios.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -758,6 +821,9 @@ class Opera(Browser):
self.logger.warning("Unable to find the browser binary.")
return None
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -827,6 +893,9 @@ class EdgeChromium(Browser):
edgedriver_name = "msedgedriver"
requirements = "requirements_edge_chromium.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -838,8 +907,10 @@ class EdgeChromium(Browser):
if not binary:
# Use paths from different Edge channels starting with Release\Beta\Dev\Canary
winpaths = [os.path.expanduser("~\\AppData\\Local\\Microsoft\\Edge\\Application"),
+ os.path.expandvars("$SYSTEMDRIVE\\Program Files\\Microsoft\\Edge\\Application"),
os.path.expandvars("$SYSTEMDRIVE\\Program Files\\Microsoft\\Edge Beta\\Application"),
os.path.expandvars("$SYSTEMDRIVE\\Program Files\\Microsoft\\Edge Dev\\Application"),
+ os.path.expandvars("$SYSTEMDRIVE\\Program Files (x86)\\Microsoft\\Edge\\Application"),
os.path.expandvars("$SYSTEMDRIVE\\Program Files (x86)\\Microsoft\\Edge Beta\\Application"),
os.path.expandvars("$SYSTEMDRIVE\\Program Files (x86)\\Microsoft\\Edge Dev\\Application"),
os.path.expanduser("~\\AppData\Local\\Microsoft\\Edge SxS\\Application")]
@@ -923,6 +994,9 @@ class Edge(Browser):
product = "edge"
requirements = "requirements_edge.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -954,6 +1028,9 @@ class InternetExplorer(Browser):
product = "ie"
requirements = "requirements_ie.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -979,6 +1056,9 @@ class Safari(Browser):
product = "safari"
requirements = "requirements_safari.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -1007,11 +1087,11 @@ class Safari(Browser):
except subprocess.CalledProcessError:
self.logger.warning("Failed to call %s --version" % webdriver_binary)
return None
- m = re.match(r"Included with Safari (.*)", version_string)
+ m = re.match(br"Included with Safari (.*)", version_string)
if not m:
self.logger.warning("Failed to extract version from: %s" % version_string)
return None
- return m.group(1)
+ return m.group(1).decode()
class Servo(Browser):
@@ -1038,17 +1118,34 @@ class Servo(Browser):
return (platform, extension, decompress)
- def install(self, dest=None, channel="nightly"):
- """Install latest Browser Engine."""
+ def _get(self, channel="nightly"):
if channel != "nightly":
raise ValueError("Only nightly versions of Servo are available")
+
+ platform, extension, _ = self.platform_components()
+ url = "https://download.servo.org/nightly/%s/servo-latest%s" % (platform, extension)
+ return get(url)
+
+ def download(self, dest=None, channel="nightly", rename=None):
if dest is None:
dest = os.pwd
- platform, extension, decompress = self.platform_components()
- url = "https://download.servo.org/nightly/%s/servo-latest%s" % (platform, extension)
+ resp = self._get(dest, channel)
+ _, extension, _ = self.platform_components()
+
+ filename = rename if rename is not None else "servo-latest"
+ with open(os.path.join(dest, "%s%s" % (filename, extension,)), "w") as f:
+ f.write(resp.content)
- decompress(get(url).raw, dest=dest)
+ def install(self, dest=None, channel="nightly"):
+ """Install latest Browser Engine."""
+ if dest is None:
+ dest = os.pwd
+
+ _, _, decompress = self.platform_components()
+
+ resp = self._get(channel)
+ decompress(resp.raw, dest=dest)
path = find_executable("servo", os.path.join(dest, "servo"))
st = os.stat(path)
os.chmod(path, st.st_mode | stat.S_IEXEC)
@@ -1084,6 +1181,9 @@ class Sauce(Browser):
product = "sauce"
requirements = "requirements_sauce.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -1106,6 +1206,9 @@ class WebKit(Browser):
product = "webkit"
requirements = "requirements_webkit.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
@@ -1131,7 +1234,7 @@ class WebKitGTKMiniBrowser(WebKit):
gcc = find_executable("gcc")
if gcc:
try:
- triplet = call(gcc, "-dumpmachine").strip()
+ triplet = call(gcc, "-dumpmachine").decode().strip()
except subprocess.CalledProcessError:
pass
# Add Debian/Ubuntu path
@@ -1150,7 +1253,7 @@ class WebKitGTKMiniBrowser(WebKit):
if binary is None:
return None
try: # WebKitGTK MiniBrowser before 2.26.0 doesn't support --version
- output = call(binary, "--version").strip()
+ output = call(binary, "--version").decode().strip()
except subprocess.CalledProcessError:
return None
# Example output: "WebKitGTK 2.26.1"
@@ -1169,6 +1272,9 @@ class Epiphany(Browser):
product = "epiphany"
requirements = "requirements_epiphany.txt"
+ def download(self, dest=None, channel=None, rename=None):
+ raise NotImplementedError
+
def install(self, dest=None, channel=None):
raise NotImplementedError
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py
index 8215dfe0916..6eb59f814bf 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py
@@ -1,7 +1,6 @@
import argparse
-import browser
import sys
-
+from . import browser
latest_channels = {
'firefox': 'nightly',
@@ -42,6 +41,11 @@ def get_parser():
'the latest available development release. For WebDriver installs, '
'we attempt to select an appropriate, compatible, version for the '
'latest browser release on the selected channel.')
+ parser.add_argument('--download-only', action="store_true",
+ help="Download the selected component but don't install it")
+ parser.add_argument('--rename', action="store", default=None,
+ help="Filename, excluding extension for downloaded archive "
+ "(only with --download-only)")
parser.add_argument('-d', '--destination',
help='filesystem directory to place the component')
return parser
@@ -73,21 +77,26 @@ def run(venv, **kwargs):
raise argparse.ArgumentError(None,
"No --destination argument, and no default for the environment")
- install(browser, kwargs["component"], destination, channel)
+ install(browser, kwargs["component"], destination, channel,
+ download_only=kwargs["download_only"], rename=kwargs["rename"])
-def install(name, component, destination, channel="nightly", logger=None):
+def install(name, component, destination, channel="nightly", logger=None, download_only=False,
+ rename=None):
if logger is None:
import logging
logger = logging.getLogger("install")
- if component == 'webdriver':
- method = 'install_webdriver'
- else:
- method = 'install'
+ prefix = "download" if download_only else "install"
+ suffix = "_webdriver" if component == 'webdriver' else ""
+
+ method = prefix + suffix
subclass = getattr(browser, name.title())
sys.stdout.write('Now installing %s %s...\n' % (name, component))
- path = getattr(subclass(logger), method)(dest=destination, channel=channel)
+ kwargs = {}
+ if download_only and rename:
+ kwargs["rename"] = rename
+ path = getattr(subclass(logger), method)(dest=destination, channel=channel, **kwargs)
if path:
- sys.stdout.write('Binary installed as %s\n' % (path,))
+ sys.stdout.write('Binary %s as %s\n' % ("downloaded" if download_only else "installed", path,))
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/paths b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/paths
index 093a7156892..35867c4ccbf 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/paths
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/paths
@@ -3,5 +3,4 @@ tools/docker/
tools/lint/
tools/manifest/
tools/serve/
-tools/taskcluster/
tools/wpt/
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py
index 44dfbc25fa5..f6906fd0ac7 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py
@@ -106,7 +106,7 @@ otherwise install OpenSSL and ensure that it's on your $PATH.""")
def check_environ(product):
- if product not in ("android_webview", "chrome", "chrome_android", "firefox", "firefox_android", "servo"):
+ if product not in ("android_weblayer", "android_webview", "chrome", "chrome_android", "firefox", "firefox_android", "servo"):
config_builder = serve.build_config(os.path.join(wpt_root, "config.json"))
# Override the ports to avoid looking for free ports
config_builder.ssl = {"type": "none"}
@@ -399,6 +399,31 @@ class ChromeiOS(BrowserSetup):
raise WptrunError("Unable to locate or install chromedriver binary")
+class AndroidWeblayer(BrowserSetup):
+ name = "android_weblayer"
+ browser_cls = browser.AndroidWeblayer
+
+ def setup_kwargs(self, kwargs):
+ if kwargs.get("device_serial"):
+ self.browser.device_serial = kwargs["device_serial"]
+ if kwargs["webdriver_binary"] is None:
+ webdriver_binary = self.browser.find_webdriver()
+
+ if webdriver_binary is None:
+ install = self.prompt_install("chromedriver")
+
+ if install:
+ logger.info("Downloading chromedriver")
+ webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path)
+ else:
+ logger.info("Using webdriver binary %s" % webdriver_binary)
+
+ if webdriver_binary:
+ kwargs["webdriver_binary"] = webdriver_binary
+ else:
+ raise WptrunError("Unable to locate or install chromedriver binary")
+
+
class AndroidWebview(BrowserSetup):
name = "android_webview"
browser_cls = browser.AndroidWebview
@@ -476,8 +501,8 @@ class EdgeChromium(BrowserSetup):
kwargs["webdriver_binary"] = webdriver_binary
else:
raise WptrunError("Unable to locate or install msedgedriver binary")
- if browser_channel == "dev":
- logger.info("Automatically turning on experimental features for Edge Dev")
+ if browser_channel in ("dev", "canary"):
+ logger.info("Automatically turning on experimental features for Edge Dev/Canary")
kwargs["binary_args"].append("--enable-experimental-web-platform-features")
@@ -638,6 +663,7 @@ class Epiphany(BrowserSetup):
product_setup = {
+ "android_weblayer": AndroidWeblayer,
"android_webview": AndroidWebview,
"firefox": Firefox,
"firefox_android": FirefoxAndroid,
@@ -679,8 +705,9 @@ def setup_logging(kwargs, default_config=None, formatter_defaults=None):
def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
from wptrunner import wptcommandline
+ from six import iteritems
- kwargs = utils.Kwargs(kwargs.iteritems())
+ kwargs = utils.Kwargs(iteritems(kwargs))
product_parts = kwargs["product"].split(":")
kwargs["product"] = product_parts[0].replace("-", "_")
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py
index cf12a59c8e6..ae021046446 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py
@@ -247,7 +247,7 @@ def affected_testfiles(files_changed, # type: Iterable[Text]
nontests_changed = set(files_changed)
wpt_manifest = load_manifest(manifest_path, manifest_update)
- test_types = ["testharness", "reftest", "wdspec"]
+ test_types = ["crashtest", "testharness", "reftest", "wdspec"]
support_files = {os.path.join(wpt_root, path)
for _, path, _ in wpt_manifest.itertypes("support")}
wdspec_test_files = {os.path.join(wpt_root, path)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/wpt.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/wpt.py
index 93301dd86b4..49ee6345381 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/wpt.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/wpt.py
@@ -40,13 +40,14 @@ def load_commands():
return rv
-def parse_args(argv, commands):
+def parse_args(argv, commands = load_commands()):
parser = argparse.ArgumentParser()
parser.add_argument("--venv", action="store", help="Path to an existing virtualenv to use")
parser.add_argument("--skip-venv-setup", action="store_true",
dest="skip_venv_setup",
help="Whether to use the virtualenv as-is. Must set --venv as well")
parser.add_argument("--debug", action="store_true", help="Run the debugger in case of an exception")
+ parser.add_argument("--py3", action="store_true", help="Run with python3")
subparsers = parser.add_subparsers(dest="command")
for command, props in iteritems(commands):
subparsers.add_parser(command, help=props["help"], add_help=False)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py
index e11cae137b9..7766565fe4f 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py
@@ -69,6 +69,31 @@ class Config(Mapping):
def as_dict(self):
return json_types(self.__dict__)
+ # Environment variables are limited in size so we need to prune the most egregious contributors
+ # to size, the origin policy subdomains.
+ def as_dict_for_wd_env_variable(self):
+ result = self.as_dict()
+
+ for key in [
+ ("subdomains",),
+ ("domains", "alt"),
+ ("domains", ""),
+ ("all_domains", "alt"),
+ ("all_domains", ""),
+ ("domains_set",),
+ ("all_domains_set",)
+ ]:
+ target = result
+ for part in key[:-1]:
+ target = target[part]
+ value = target[key[-1]]
+ if isinstance(value, dict):
+ target[key[-1]] = {k:v for (k,v) in iteritems(value) if not k.startswith("op")}
+ else:
+ target[key[-1]] = [x for x in value if not x.startswith("op")]
+
+ return result
+
def json_types(obj):
if isinstance(obj, dict):
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py
index ca5118009cf..fea1277b0d1 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py
@@ -1,4 +1,3 @@
-import cgi
import json
import os
import sys
@@ -14,6 +13,11 @@ from .request import Authentication
from .response import MultipartContent
from .utils import HTTPException
+try:
+ from html import escape
+except ImportError:
+ from cgi import escape
+
__all__ = ["file_handler", "python_script_handler",
"FunctionHandler", "handler", "json_handler",
"as_is_handler", "ErrorHandler", "BasicAuthHandler"]
@@ -76,7 +80,7 @@ class DirectoryHandler(object):
<ul>
%(items)s
</ul>
-""" % {"path": cgi.escape(url_path),
+""" % {"path": escape(url_path),
"items": "\n".join(self.list_items(url_path, path))} # noqa: E122
def list_items(self, base_path, path):
@@ -92,15 +96,29 @@ class DirectoryHandler(object):
link = urljoin(base_path, "..")
yield ("""<li class="dir"><a href="%(link)s">%(name)s</a></li>""" %
{"link": link, "name": ".."})
+ items = []
+ prev_item = None
for item in sorted(os.listdir(path)):
- link = cgi.escape(quote(item))
+ if prev_item and prev_item + ".headers" == item:
+ items[-1][1] = item
+ prev_item = None
+ continue
+ items.append([item, None])
+ prev_item = item
+ for item, dot_headers in items:
+ link = escape(quote(item))
+ dot_headers_markup = ""
+ if dot_headers is not None:
+ dot_headers_markup = (""" (<a href="%(link)s">.headers</a>)""" %
+ {"link": escape(quote(dot_headers))})
if os.path.isdir(os.path.join(path, item)):
link += "/"
class_ = "dir"
else:
class_ = "file"
- yield ("""<li class="%(class)s"><a href="%(link)s">%(name)s</a></li>""" %
- {"link": link, "name": cgi.escape(item), "class": class_})
+ yield ("""<li class="%(class)s"><a href="%(link)s">%(name)s</a>%(headers)s</li>""" %
+ {"link": link, "name": escape(item), "class": class_,
+ "headers": dot_headers_markup})
def wrap_pipeline(path, request, response):
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py
index ceb34cc3f4f..569875bf972 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py
@@ -1,4 +1,3 @@
-from cgi import escape
from collections import deque
import base64
import gzip as gzip_module
@@ -7,10 +6,15 @@ import os
import re
import time
import uuid
-from six.moves import StringIO
+from six.moves import StringIO
from six import text_type, binary_type
+try:
+ from html import escape
+except ImportError:
+ from cgi import escape
+
def resolve_content(response):
return b"".join(item for item in response.iter_content(read_file=True))
@@ -393,8 +397,8 @@ class SubFunctions(object):
def uuid(request):
return str(uuid.uuid4())
- # Maintain a whitelist of supported algorithms, restricted to those that
- # are available on all platforms [1]. This ensures that test authors do not
+ # Maintain a list of supported algorithms, restricted to those that are
+ # available on all platforms [1]. This ensures that test authors do not
# unknowingly introduce platform-specific tests.
#
# [1] https://docs.python.org/2/library/hashlib.html
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt
index a24bc83a919..37ab5409ec7 100755
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt
@@ -2,4 +2,11 @@
if __name__ == "__main__":
from tools.wpt import wpt
- wpt.main()
+ from sys import version_info, argv, exit
+ args, extra = wpt.parse_args(argv[1:])
+
+ if args.py3 and version_info.major < 3:
+ from subprocess import call
+ exit(call(['python3', argv[0]] + [args.command] + extra))
+ else:
+ wpt.main()
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt.py
index c65e1ed2c6c..affba7343ea 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/wpt.py
@@ -1,3 +1,3 @@
# This file exists to allow `python wpt <command>` to work on Windows:
# https://github.com/web-platform-tests/wpt/pull/6907
-execfile("wpt")
+exec(compile(open("wpt", "r").read(), "wpt", 'exec'))