summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/tools/blinkpy
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 16:23:34 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:37:21 +0000
commit38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch)
treec4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/third_party/blink/tools/blinkpy
parente684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff)
downloadqtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/tools/blinkpy')
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py20
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py14
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/checkout/diff_parser_unittest.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/checkout/diff_test_data.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/config/builders.json1
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/host_mock.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/buildbot.py63
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/buildbot_unittest.py57
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/git_cl_unittest.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/web.py15
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/web_mock.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/web_test_results.py (renamed from chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results.py)32
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/net/web_test_results_unittest.py (renamed from chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results_unittest.py)22
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/path_finder.py9
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/path_finder_unittest.py12
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/system/executive.py9
-rw-r--r--chromium/third_party/blink/tools/blinkpy/common/unified_diff.py2
-rwxr-xr-xchromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py33
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/README.chromium2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/README.chromium8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/WPTWhiteList5
-rwxr-xr-xchromium/third_party/blink/tools/blinkpy/third_party/wpt/checkout.sh2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt.config.json1
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/gitignore/gitignore.py204
-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/manifest/commands.json3
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/download.py79
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/item.py44
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/manifest.py403
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/sourcefile.py2
-rwxr-xr-xchromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/update.py46
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/vcs.py247
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/serve/serve.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py36
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py741
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py210
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/protocol.py43
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py192
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py176
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/commands.json1
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py15
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/markdown.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/run.py123
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py72
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/utils.py32
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/virtualenv.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/config.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/handlers.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/pipes.py28
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/request.py13
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/server.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/__init__.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/base.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/openssl.py22
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/pregenerated.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/stash.py23
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/analyze_baselines_unittest.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/flaky_tests.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/optimize_baselines_unittest.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/queries.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py28
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py12
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_server.py16
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py24
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/chromium_commit_mock.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/chromium_finder.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/import_notifier.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/test_copier.py12
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/test_importer.py26
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater.py16
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py20
-rw-r--r--chromium/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/builder_list.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py17
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/single_test_runner.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder.py)8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder_unittest.py)10
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner.py)2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner_unittes.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner_unittest.py)6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/merge_results.py16
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/merge_results_unittest.py16
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/android.py18
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py69
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py38
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_driver.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/driver.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py50
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py6
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/test.py28
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/port/win.py2
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times.py)0
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times_unittest.py (renamed from chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times_unittest.py)4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests.py20
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests_unittest.py92
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/apache_http.py12
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/cli_wrapper.py8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/pywebsocket.py8
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py9
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py40
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/try_flag.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/try_flag_unittest.py16
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py4
-rw-r--r--chromium/third_party/blink/tools/blinkpy/web_tests/views/printing.py2
118 files changed, 2941 insertions, 981 deletions
diff --git a/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py b/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py
index afa44cb4217..2015d8009b2 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer.py
@@ -44,10 +44,10 @@ class BaselineOptimizer(object):
for port_name in port_names:
self._ports[port_name] = host.port_factory.get(port_name)
- self._layout_tests_dir = default_port.layout_tests_dir()
- self._parent_of_tests = self._filesystem.dirname(self._layout_tests_dir)
- self._layout_tests_dir_name = self._filesystem.relpath(
- self._layout_tests_dir, self._parent_of_tests)
+ self._web_tests_dir = default_port.web_tests_dir()
+ self._parent_of_tests = self._filesystem.dirname(self._web_tests_dir)
+ self._web_tests_dir_name = self._filesystem.relpath(
+ self._web_tests_dir, self._parent_of_tests)
# Only used by unit tests.
self.new_results_by_directory = []
@@ -56,7 +56,7 @@ class BaselineOptimizer(object):
# A visualization of baseline fallback:
# https://docs.google.com/drawings/d/13l3IUlSE99RoKjDwEWuY1O77simAhhF6Wi0fZdkSaMA/
# The full document with more details:
- # https://chromium.googlesource.com/chromium/src/+/master/docs/testing/layout_test_baseline_fallback.md
+ # https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_test_baseline_fallback.md
# The virtual and non-virtual subtrees are identical, with the virtual
# root being the special node having multiple parents and connecting the
# two trees. We patch the virtual subtree to cut its dependencies on the
@@ -195,7 +195,7 @@ class BaselineOptimizer(object):
Returns:
The platform name, or '(generic)' if unable to make a guess.
"""
- platform_dir = self._layout_tests_dir_name + self._filesystem.sep + 'platform' + self._filesystem.sep
+ platform_dir = self._web_tests_dir_name + self._filesystem.sep + 'platform' + self._filesystem.sep
if filename.startswith(platform_dir):
return filename.replace(platform_dir, '').split(self._filesystem.sep)[0]
platform_dir = self._filesystem.join(self._parent_of_tests, platform_dir)
@@ -239,7 +239,7 @@ class BaselineOptimizer(object):
# independently. If an immediate predecessor is missing a baseline, find
# its non-virtual fallback and copy over.
_log.debug('Copying non-virtual baselines to the virtual subtree to make it independent.')
- virtual_root_baseline_path = self._filesystem.join(self._layout_tests_dir, baseline_name)
+ virtual_root_baseline_path = self._filesystem.join(self._web_tests_dir, baseline_name)
if self._filesystem.exists(virtual_root_baseline_path):
return
@@ -252,7 +252,7 @@ class BaselineOptimizer(object):
self._walk_immediate_predecessors_of_virtual_root(test_name, extension, baseline_name, patcher)
def _optimize_virtual_root(self, test_name, extension, baseline_name):
- virtual_root_baseline_path = self._filesystem.join(self._layout_tests_dir, baseline_name)
+ virtual_root_baseline_path = self._filesystem.join(self._web_tests_dir, baseline_name)
if self._filesystem.exists(virtual_root_baseline_path):
_log.debug('Virtual root baseline found. Checking if we can remove it.')
self._try_to_remove_virtual_root(test_name, baseline_name, virtual_root_baseline_path)
@@ -294,7 +294,7 @@ class BaselineOptimizer(object):
def _baseline_root(self):
"""Returns the name of the root (generic) baseline directory."""
- return self._layout_tests_dir_name
+ return self._web_tests_dir_name
def _baseline_search_path(self, port):
"""Returns the baseline search path (a list of absolute paths) of the
@@ -476,7 +476,7 @@ class BaselineOptimizer(object):
class ResultDigest(object):
"""Digest of a result file for fast comparison.
- A result file can be any actual or expected output from a layout test,
+ A result file can be any actual or expected output from a web test,
including text and image. SHA1 is used internally to digest the file.
"""
diff --git a/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py
index 0082145aac3..f0c1932a485 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/checkout/baseline_optimizer_unittest.py
@@ -92,22 +92,22 @@ class BaselineOptimizerTest(unittest.TestCase):
['linux-trusty', 'mac-mac10.10', 'mac-mac10.11', 'mac-mac10.12', 'mac-mac10.13', 'win-win10'])
def _assert_optimization(self, results_by_directory, directory_to_new_results, baseline_dirname='', suffix='txt'):
- layout_tests_dir = PathFinder(self.fs).layout_tests_dir()
+ web_tests_dir = PathFinder(self.fs).web_tests_dir()
test_name = 'mock-test.html'
baseline_name = 'mock-test-expected.' + suffix
self.fs.write_text_file(
- self.fs.join(layout_tests_dir, 'VirtualTestSuites'),
+ self.fs.join(web_tests_dir, 'VirtualTestSuites'),
'[{"prefix": "gpu", "base": "fast/canvas", "args": ["--foo"]}]')
for dirname, contents in results_by_directory.items():
- self.fs.write_binary_file(self.fs.join(layout_tests_dir, dirname, baseline_name), contents)
+ self.fs.write_binary_file(self.fs.join(web_tests_dir, dirname, baseline_name), contents)
baseline_optimizer = BaselineOptimizer(self.host, self.host.port_factory.get(), self.host.port_factory.all_port_names())
self.assertTrue(baseline_optimizer.optimize(
self.fs.join(baseline_dirname, test_name), suffix))
for dirname, contents in directory_to_new_results.items():
- path = self.fs.join(layout_tests_dir, dirname, baseline_name)
+ path = self.fs.join(web_tests_dir, dirname, baseline_name)
if contents is None:
# Check files that are explicitly marked as absent.
self.assertFalse(self.fs.exists(path), '%s should not exist after optimization' % path)
@@ -115,13 +115,13 @@ class BaselineOptimizerTest(unittest.TestCase):
self.assertEqual(self.fs.read_binary_file(path), contents, 'Content of %s != "%s"' % (path, contents))
for dirname in results_by_directory:
- path = self.fs.join(layout_tests_dir, dirname, baseline_name)
+ path = self.fs.join(web_tests_dir, dirname, baseline_name)
if dirname not in directory_to_new_results or directory_to_new_results[dirname] is None:
self.assertFalse(self.fs.exists(path), '%s should not exist after optimization' % path)
def _assert_reftest_optimization(self, results_by_directory, directory_to_new_results, test_path='', baseline_dirname=''):
- layout_tests_dir = PathFinder(self.fs).layout_tests_dir()
- self.fs.write_text_file(self.fs.join(layout_tests_dir, test_path, 'mock-test-expected.html'), 'ref')
+ web_tests_dir = PathFinder(self.fs).web_tests_dir()
+ self.fs.write_text_file(self.fs.join(web_tests_dir, test_path, 'mock-test-expected.html'), 'ref')
self._assert_optimization(results_by_directory, directory_to_new_results, baseline_dirname, suffix='png')
def test_linux_redundant_with_win(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_parser_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_parser_unittest.py
index da63aa127c2..be84891b3f4 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_parser_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_parser_unittest.py
@@ -78,7 +78,7 @@ class DiffParserTest(unittest.TestCase):
self.assertEqual((87, 90), diff.lines[22][0:2])
# Check if a newly added file is correctly handled.
- diff = parser.files['LayoutTests/platform/mac/fast/flexbox/box-orient-button-expected.checksum']
+ diff = parser.files['web_tests/platform/mac/fast/flexbox/box-orient-button-expected.checksum']
self.assertEqual(1, len(diff.lines))
self.assertEqual((0, 1), diff.lines[0][0:2])
diff --git a/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_test_data.py b/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_test_data.py
index 7504599b223..be76cd28e3e 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_test_data.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/checkout/diff_test_data.py
@@ -69,7 +69,7 @@ index ce21720..324929e 100644
}
bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
-diff --git a/LayoutTests/platform/mac/fast/flexbox/box-orient-button-expected.checksum b/LayoutTests/platform/mac/fast/flexbox/box-orient-button-expected.checksum
+diff --git a/web_tests/platform/mac/fast/flexbox/box-orient-button-expected.checksum b/web_tests/platform/mac/fast/flexbox/box-orient-button-expected.checksum
new file mode 100644
index 0000000..6db26bd
--- /dev/null
diff --git a/chromium/third_party/blink/tools/blinkpy/common/config/builders.json b/chromium/third_party/blink/tools/blinkpy/common/config/builders.json
index d606556ed08..5c3e7c6016a 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/config/builders.json
+++ b/chromium/third_party/blink/tools/blinkpy/common/config/builders.json
@@ -92,6 +92,7 @@
"is_try_builder": true
},
"android_blink_rel": {
+ "bucket": "luci.chromium.try",
"port_name": "android-kitkat",
"specifiers": ["KitKat", "Release"],
"is_try_builder": true
diff --git a/chromium/third_party/blink/tools/blinkpy/common/host_mock.py b/chromium/third_party/blink/tools/blinkpy/common/host_mock.py
index 3b317477634..2131a01952a 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/host_mock.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/host_mock.py
@@ -93,7 +93,7 @@ class MockHost(MockSystemHost):
'is_try_builder': True,
},
'android_blink_rel': {
- 'bucket': 'master.tryserver.chromium.android',
+ 'bucket': 'luci.chromium.try',
'port_name': 'android-kitkat',
'specifiers': ['KitKat', 'Release'],
'is_try_builder': True,
@@ -113,7 +113,7 @@ class MockHost(MockSystemHost):
def _add_base_manifest_to_mock_filesystem(self, filesystem):
path_finder = PathFinder(filesystem)
- external_dir = path_finder.path_from_layout_tests('external')
+ external_dir = path_finder.path_from_web_tests('external')
filesystem.maybe_make_directory(filesystem.join(external_dir, 'wpt'))
# This filename should match the constant BASE_MANIFEST_NAME.
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/buildbot.py b/chromium/third_party/blink/tools/blinkpy/common/net/buildbot.py
index b2184562eed..e9547cf43ab 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/buildbot.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/buildbot.py
@@ -31,11 +31,10 @@ import logging
import json
import re
import urllib
-import urllib2
from blinkpy.common.memoized import memoized
-from blinkpy.common.net.layout_test_results import LayoutTestResults
-from blinkpy.common.net.network_transaction import NetworkTransaction
+from blinkpy.common.net.web import Web
+from blinkpy.common.net.web_test_results import WebTestResults
from blinkpy.web_tests.layout_package import json_results_generator
_log = logging.getLogger(__name__)
@@ -57,13 +56,16 @@ class Build(collections.namedtuple('Build', ('builder_name', 'build_number'))):
class BuildBot(object):
"""This class represents an interface to BuildBot-related functionality.
- This includes fetching layout test results from Google Storage;
- for more information about the layout test result format, see:
+ This includes fetching web test results from Google Storage;
+ for more information about the web test result format, see:
https://www.chromium.org/developers/the-json-test-results-format
"""
+ def __init__(self):
+ self.web = Web()
+
def results_url(self, builder_name, build_number=None, step_name=None):
- """Returns a URL for one set of archived layout test results.
+ """Returns a URL for one set of archived web test results.
If a build number is given, this will be results for a particular run;
otherwise it will be the accumulated results URL, which should have
@@ -93,30 +95,40 @@ class BuildBot(object):
def fetch_retry_summary_json(self, build):
"""Fetches and returns the text of the archived retry_summary file.
- This file is expected to contain the results of retrying layout tests
+ This file is expected to contain the results of retrying web tests
with and without a patch in a try job. It includes lists of tests
that failed only with the patch ("failures"), and tests that failed
both with and without ("ignored").
"""
url_base = '%s/%s' % (self.builder_results_url_base(build.builder_name), build.build_number)
- return NetworkTransaction(return_none_on_404=True).run(
- lambda: self.fetch_file('%s/%s' % (url_base, 'retry_summary.json')))
+ # Originally we used retry_summary.json, which is the summary of retry
+ # without patch; now we retry again with patch and ignore the flakes.
+ # See https://crbug.com/882969.
+ return self.web.get_binary('%s/%s' % (url_base, 'retry_with_patch_summary.json'),
+ return_none_on_404=True)
def accumulated_results_url_base(self, builder_name):
return self.builder_results_url_base(builder_name) + '/results/layout-test-results'
@memoized
def fetch_results(self, build, full=False):
- """Returns a LayoutTestResults object for results from a given Build.
+ """Returns a WebTestResults object for results from a given Build.
Uses full_results.json if full is True, otherwise failing_results.json.
"""
- return self.fetch_layout_test_results(
+ if not build.builder_name or not build.build_number:
+ _log.debug('Builder name or build number is None')
+ return None
+ return self.fetch_web_test_results(
self.results_url(build.builder_name, build.build_number,
step_name=self.get_layout_test_step_name(build)),
full)
@memoized
def get_layout_test_step_name(self, build):
+ if not build.builder_name or not build.build_number:
+ _log.debug('Builder name or build number is None')
+ return None
+
url = '%s/testfile?%s' % (TEST_RESULTS_SERVER, urllib.urlencode({
'builder': build.builder_name,
'buildnumber': build.build_number,
@@ -124,8 +136,7 @@ class BuildBot(object):
# This forces the server to gives us JSON rather than an HTML page.
'callback': json_results_generator.JSON_CALLBACK,
}))
- data = NetworkTransaction(return_none_on_404=True).run(
- lambda: self.fetch_file(url))
+ data = self.web.get_binary(url, return_none_on_404=True)
if not data:
_log.debug('Got 404 response from:\n%s', url)
return None
@@ -146,38 +157,24 @@ class BuildBot(object):
suites = list(set(suites))
if len(suites) != 1:
raise Exception(
- 'build %s on builder %s expected to only have one layout test '
+ 'build %s on builder %s expected to only have one web test '
'step, instead has %s' % (
build.build_number, build.builder_name, suites))
return suites[0]
@memoized
- def fetch_layout_test_results(self, results_url, full=False):
- """Returns a LayoutTestResults object for results fetched from a given URL.
+ def fetch_web_test_results(self, results_url, full=False):
+ """Returns a WebTestResults object for results fetched from a given URL.
Uses full_results.json if full is True, otherwise failing_results.json.
"""
base_filename = 'full_results.json' if full else 'failing_results.json'
- results_file = NetworkTransaction(return_none_on_404=True).run(
- lambda: self.fetch_file('%s/%s' % (results_url, base_filename)))
+ results_file = self.web.get_binary('%s/%s' % (results_url, base_filename),
+ return_none_on_404=True)
if results_file is None:
_log.debug('Got 404 response from:\n%s/%s', results_url, base_filename)
return None
- revision = NetworkTransaction(return_none_on_404=True).run(
- lambda: self.fetch_file('%s/LAST_CHANGE' % results_url))
- if revision is None:
- _log.debug('Got 404 response from:\n%s/LAST_CHANGE', results_url)
- return LayoutTestResults.results_from_string(results_file, revision)
-
- def fetch_file(self, url):
- # It seems this can return None if the url redirects and then returns 404.
- # FIXME: This could use Web instead of using urllib2 directly.
- result = urllib2.urlopen(url)
- if not result:
- return None
- # urlopen returns a file-like object which sometimes works fine with str()
- # but sometimes is a addinfourl object. In either case calling read() is correct.
- return result.read()
+ return WebTestResults.results_from_string(results_file)
def current_build_link(host):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/buildbot_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/net/buildbot_unittest.py
index 231b923dfe7..850b26b34cc 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/buildbot_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/buildbot_unittest.py
@@ -31,6 +31,7 @@ import logging
import unittest
from blinkpy.common.net.buildbot import BuildBot, Build, filter_latest_builds
+from blinkpy.common.net.web_mock import MockWeb
from blinkpy.common.system.log_testing import LoggingTestCase
@@ -70,52 +71,58 @@ class BuilderTest(LoggingTestCase):
BuildBot().accumulated_results_url_base('WebKit Mac10.8 (dbg)'),
'https://test-results.appspot.com/data/layout_results/WebKit_Mac10_8__dbg_/results/layout-test-results')
- def test_fetch_layout_test_results_with_no_results_fetched(self):
+ def test_fetch_web_test_results_with_no_results_fetched(self):
buildbot = BuildBot()
-
- def fetch_file(url):
- return None if url.endswith('failing_results.json') else 'contents'
-
- buildbot.fetch_file = fetch_file
- results = buildbot.fetch_layout_test_results(buildbot.results_url('B'))
+ buildbot.web = MockWeb()
+ results = buildbot.fetch_web_test_results(buildbot.results_url('B'))
self.assertIsNone(results)
self.assertLog([
'DEBUG: Got 404 response from:\n'
'https://test-results.appspot.com/data/layout_results/B/results/layout-test-results/failing_results.json\n'
])
- def test_fetch_layout_test_results_weird_step_name(self):
+ def test_fetch_results_with_weird_step_name(self):
buildbot = BuildBot()
-
- def fetch_file(url):
- if '/testfile' in url:
- return ('ADD_RESULTS(%s);' % (json.dumps(
+ buildbot.web = MockWeb(urls={
+ 'https://test-results.appspot.com/testfile?buildnumber=123&'
+ 'callback=ADD_RESULTS&builder=builder&name=full_results.json':
+ 'ADD_RESULTS(%s);' % (json.dumps(
[{"TestType": "webkit_layout_tests on Intel GPU (with patch)"},
- {"TestType": "base_unittests (with patch)"}])))
- return json.dumps({'passed': True}) if url.endswith('failing_results.json') else 'deadbeef'
-
- buildbot.fetch_file = fetch_file
+ {"TestType": "base_unittests (with patch)"}])),
+ 'https://test-results.appspot.com/data/layout_results/builder/123/'
+ 'webkit_layout_tests%20on%20Intel%20GPU%20%28with%20patch%29/'
+ 'layout-test-results/failing_results.json':
+ json.dumps({'passed': True}),
+ })
results = buildbot.fetch_results(Build('builder', 123))
self.assertEqual(results._results, { # pylint: disable=protected-access
'passed': True
})
self.assertLog([])
- def test_get_step_name(self):
+ def test_fetch_results_without_build_number(self):
buildbot = BuildBot()
+ self.assertIsNone(buildbot.fetch_results(Build('builder', None)))
- def fetch_file(_):
- return ('ADD_RESULTS(%s);' % (json.dumps(
- [{"TestType": "webkit_layout_tests (with patch)"},
- {"TestType": "not_site_per_process_webkit_layout_tests (with patch)"},
- {"TestType": "webkit_layout_tests (retry with patch)"},
- {"TestType": "base_unittests (with patch)"}])))
-
- buildbot.fetch_file = fetch_file
+ def test_get_step_name(self):
+ buildbot = BuildBot()
+ buildbot.web = MockWeb(urls={
+ 'https://test-results.appspot.com/testfile?buildnumber=5&'
+ 'callback=ADD_RESULTS&builder=foo&name=full_results.json':
+ 'ADD_RESULTS(%s);' % (json.dumps(
+ [{"TestType": "webkit_layout_tests (with patch)"},
+ {"TestType": "not_site_per_process_webkit_layout_tests (with patch)"},
+ {"TestType": "webkit_layout_tests (retry with patch)"},
+ {"TestType": "base_unittests (with patch)"}]))
+ })
step_name = buildbot.get_layout_test_step_name(Build('foo', 5))
self.assertEqual(step_name, 'webkit_layout_tests (with patch)')
self.assertLog([])
+ def test_get_step_name_without_build_number(self):
+ buildbot = BuildBot()
+ self.assertIsNone(buildbot.get_layout_test_step_name(Build('builder', None)))
+
class BuildBotHelperFunctionTest(unittest.TestCase):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/git_cl_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/net/git_cl_unittest.py
index 6fd5a5db0da..2181e11f7b5 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/git_cl_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/git_cl_unittest.py
@@ -52,7 +52,7 @@ class GitCLTest(unittest.TestCase):
],
[
'git', 'cl', 'try',
- '-B', 'master.tryserver.chromium.android',
+ '-B', 'luci.chromium.try',
'-b', 'android_blink_rel',
'--auth-refresh-token-json', 'token.json'
],
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/web.py b/chromium/third_party/blink/tools/blinkpy/common/net/web.py
index b979b6ddada..c3573054d97 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/web.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/web.py
@@ -33,11 +33,20 @@ from blinkpy.common.net.network_transaction import NetworkTransaction
class Web(object):
+ class _HTTPRedirectHandler2(urllib2.HTTPRedirectHandler): # pylint:disable=no-init
+ """A subclass of HTTPRedirectHandler to support 308 Permanent Redirect."""
+
+ def http_error_308(self, req, fp, code, msg, headers): # pylint:disable=unused-argument
+ # We have to override the code to 301 (Moved Permanently);
+ # otherwise, HTTPRedirectHandler will throw a HTTPError.
+ return self.http_error_301(req, fp, 301, msg, headers)
+
def get_binary(self, url, return_none_on_404=False):
- return NetworkTransaction(return_none_on_404=return_none_on_404).run(lambda: urllib2.urlopen(url).read())
+ return NetworkTransaction(return_none_on_404=return_none_on_404).run(
+ lambda: self.request('GET', url).read())
- def request(self, method, url, data, headers=None):
- opener = urllib2.build_opener(urllib2.HTTPHandler)
+ def request(self, method, url, data=None, headers=None):
+ opener = urllib2.build_opener(Web._HTTPRedirectHandler2)
request = urllib2.Request(url=url, data=data)
request.get_method = lambda: method
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/web_mock.py b/chromium/third_party/blink/tools/blinkpy/common/net/web_mock.py
index a0733c59487..f044ea3a278 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/web_mock.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/web_mock.py
@@ -44,7 +44,7 @@ class MockWeb(object):
return None
return 'MOCK Web result, 404 Not found'
- def request(self, method, url, data, headers=None): # pylint: disable=unused-argument
+ def request(self, method, url, data=None, headers=None): # pylint: disable=unused-argument
return MockResponse(self.responses.pop(0))
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results.py b/chromium/third_party/blink/tools/blinkpy/common/net/web_test_results.py
index 02d7d59df24..27bfbaed172 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/web_test_results.py
@@ -32,7 +32,7 @@ from blinkpy.common.memoized import memoized
from blinkpy.web_tests.layout_package import json_results_generator
-class LayoutTestResult(object):
+class WebTestResult(object):
def __init__(self, test_name, result_dict):
self._test_name = test_name
@@ -78,21 +78,17 @@ class LayoutTestResult(object):
return self.last_retry_result() == 'MISSING'
-# FIXME: This should be unified with ResultsSummary or other NRWT layout tests code
-# in the layout_tests package.
+# FIXME: This should be unified with ResultsSummary or other NRWT web tests code
+# in the web_tests package.
# This doesn't belong in common.net, but we don't have a better place for it yet.
-class LayoutTestResults(object):
+class WebTestResults(object):
@classmethod
- def results_from_string(cls, string, chromium_revision=None):
- """Creates a LayoutTestResults object from a test result JSON string.
+ def results_from_string(cls, string):
+ """Creates a WebTestResults object from a test result JSON string.
Args:
- string: JSON string containing layout test result.
- chromium_revision: If given, it will override the chromium_revision
- field in json, to indicate the last revision that has completed
- uploading onto the storage server. chromium_revision can be a
- git hash or position number.
+ string: JSON string containing web test result.
"""
if not string:
@@ -103,7 +99,7 @@ class LayoutTestResults(object):
if not json_dict:
return None
- return cls(json_dict, chromium_revision)
+ return cls(json_dict)
def __init__(self, parsed_json, chromium_revision=None):
self._results = parsed_json
@@ -131,32 +127,32 @@ class LayoutTestResults(object):
if part not in tree:
return None
tree = tree[part]
- return LayoutTestResult(test, tree)
+ return WebTestResult(test, tree)
def for_each_test(self, handler):
- LayoutTestResults._for_each_test(self._test_result_tree(), handler, '')
+ WebTestResults._for_each_test(self._test_result_tree(), handler, '')
@staticmethod
def _for_each_test(tree, handler, prefix=''):
for key in tree:
new_prefix = (prefix + '/' + key) if prefix else key
if 'actual' not in tree[key]:
- LayoutTestResults._for_each_test(tree[key], handler, new_prefix)
+ WebTestResults._for_each_test(tree[key], handler, new_prefix)
else:
- handler(LayoutTestResult(new_prefix, tree[key]))
+ handler(WebTestResult(new_prefix, tree[key]))
def _test_result_tree(self):
return self._results['tests']
def _filter_tests(self, result_filter):
- """Returns LayoutTestResult objects for tests which pass the given filter."""
+ """Returns WebTestResult objects for tests which pass the given filter."""
results = []
def add_if_passes(result):
if result_filter(result):
results.append(result)
- LayoutTestResults._for_each_test(self._test_result_tree(), add_if_passes)
+ WebTestResults._for_each_test(self._test_result_tree(), add_if_passes)
return sorted(results, key=lambda r: r.test_name())
def didnt_run_as_expected_results(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/net/web_test_results_unittest.py
index 32ca91404e2..40a266623e8 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/net/layout_test_results_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/net/web_test_results_unittest.py
@@ -28,10 +28,10 @@
import unittest
-from blinkpy.common.net.layout_test_results import LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResults
-class LayoutTestResultsTest(unittest.TestCase):
+class WebTestResultsTest(unittest.TestCase):
# The real files have no whitespace, but newlines make this much more readable.
example_full_results_json = """ADD_RESULTS({
"tests": {
@@ -87,7 +87,7 @@ class LayoutTestResultsTest(unittest.TestCase):
},
"skipped": 450,
"num_regressions": 15,
- "layout_tests_dir": "/b/build/slave/Webkit_Mac10_5/build/src/third_party/WebKit/LayoutTests",
+ "layout_tests_dir": "/b/build/slave/Webkit_Mac10_5/build/src/third_party/blink/web_tests",
"version": 3,
"num_passes": 77,
"fixable": 1220,
@@ -97,26 +97,26 @@ class LayoutTestResultsTest(unittest.TestCase):
});"""
def test_results_from_string(self):
- self.assertIsNone(LayoutTestResults.results_from_string(None))
- self.assertIsNone(LayoutTestResults.results_from_string(''))
+ self.assertIsNone(WebTestResults.results_from_string(None))
+ self.assertIsNone(WebTestResults.results_from_string(''))
def test_was_interrupted(self):
- self.assertTrue(LayoutTestResults.results_from_string(
+ self.assertTrue(WebTestResults.results_from_string(
'ADD_RESULTS({"tests":{},"interrupted":true});').run_was_interrupted())
- self.assertFalse(LayoutTestResults.results_from_string(
+ self.assertFalse(WebTestResults.results_from_string(
'ADD_RESULTS({"tests":{},"interrupted":false});').run_was_interrupted())
def test_chromium_revision(self):
- self.assertEqual(LayoutTestResults.results_from_string(self.example_full_results_json).chromium_revision(), 1234)
+ self.assertEqual(WebTestResults.results_from_string(self.example_full_results_json).chromium_revision(), 1234)
def test_actual_results(self):
- results = LayoutTestResults.results_from_string(self.example_full_results_json)
+ results = WebTestResults.results_from_string(self.example_full_results_json)
self.assertEqual(results.result_for_test('fast/dom/prototype-banana.html').actual_results(), 'PASS')
self.assertEqual(results.result_for_test('fast/dom/prototype-taco.html').actual_results(), 'PASS TEXT')
self.assertFalse(results.result_for_test('nonexistant.html'))
def test_didnt_run_as_expected_results(self):
- results = LayoutTestResults.results_from_string(self.example_full_results_json)
+ results = WebTestResults.results_from_string(self.example_full_results_json)
self.assertEqual(
[r.test_name() for r in results.didnt_run_as_expected_results()],
[
@@ -130,7 +130,7 @@ class LayoutTestResultsTest(unittest.TestCase):
])
def test_didnt_run_as_expected_slow_test(self):
- results = LayoutTestResults({
+ results = WebTestResults({
'tests': {
'fast': {
'dom': {
diff --git a/chromium/third_party/blink/tools/blinkpy/common/path_finder.py b/chromium/third_party/blink/tools/blinkpy/common/path_finder.py
index 3fc8ce149d8..e4e96565f0d 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/path_finder.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/path_finder.py
@@ -101,7 +101,7 @@ def _does_blink_web_tests_exist():
TESTS_IN_BLINK = _does_blink_web_tests_exist()
-# LayoutTests / web_tests path relative to the repository root.
+# web_tests path relative to the repository root.
# Path separators are always '/', and this contains the trailing '/'.
RELATIVE_WEB_TESTS = 'third_party/blink/web_tests/'
WEB_TESTS_LAST_COMPONENT = 'web_tests'
@@ -118,8 +118,7 @@ class PathFinder(object):
def chromium_base(self):
return self._filesystem.dirname(self._filesystem.dirname(self._blink_base()))
- # TODO(tkent): Rename this to web_tests_dir().
- def layout_tests_dir(self):
+ def web_tests_dir(self):
return self.path_from_chromium_base('third_party', 'blink', 'web_tests')
def perf_tests_dir(self):
@@ -146,8 +145,8 @@ class PathFinder(object):
def path_from_blink_tools(self, *comps):
return self._filesystem.join(self._filesystem.join(self.chromium_base(), 'third_party', 'blink', 'tools'), *comps)
- def path_from_layout_tests(self, *comps):
- return self._filesystem.join(self.layout_tests_dir(), *comps)
+ def path_from_web_tests(self, *comps):
+ return self._filesystem.join(self.web_tests_dir(), *comps)
@memoized
def depot_tools_base(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/path_finder_unittest.py b/chromium/third_party/blink/tools/blinkpy/common/path_finder_unittest.py
index ec53f4da354..13baca96746 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/path_finder_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/path_finder_unittest.py
@@ -21,20 +21,20 @@ class TestPathFinder(unittest.TestCase):
finder.path_from_chromium_base('foo', 'bar.baz'),
'/mock-checkout/foo/bar.baz')
- def test_layout_tests_dir(self):
+ def test_web_tests_dir(self):
finder = PathFinder(MockFileSystem())
self.assertEqual(
- finder.layout_tests_dir(),
+ finder.web_tests_dir(),
'/mock-checkout/' + RELATIVE_WEB_TESTS[:-1])
- def test_layout_tests_dir_with_backslash_sep(self):
+ def test_web_tests_dir_with_backslash_sep(self):
filesystem = MockFileSystem()
filesystem.sep = '\\'
filesystem.path_to_module = lambda _: (
'C:\\mock-checkout\\third_party\\blink\\tools\\blinkpy\\foo.py')
finder = PathFinder(filesystem)
self.assertEqual(
- finder.layout_tests_dir(),
+ finder.web_tests_dir(),
'C:\\mock-checkout\\third_party\\blink\\web_tests')
def test_perf_tests_dir(self):
@@ -43,10 +43,10 @@ class TestPathFinder(unittest.TestCase):
finder.perf_tests_dir(),
'/mock-checkout/third_party/blink/perf_tests')
- def test_path_from_layout_tests(self):
+ def test_path_from_web_tests(self):
finder = PathFinder(MockFileSystem())
self.assertEqual(
- finder.path_from_layout_tests('external', 'wpt'),
+ finder.path_from_web_tests('external', 'wpt'),
'/mock-checkout/' + RELATIVE_WEB_TESTS + 'external/wpt')
def test_depot_tools_base_not_found(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/common/system/executive.py b/chromium/third_party/blink/tools/blinkpy/common/system/executive.py
index bf33f76a5b5..5bf3d993233 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/system/executive.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/system/executive.py
@@ -111,8 +111,13 @@ class Executive(object):
Will fail silently if pid does not exist or insufficient permissions.
"""
- # According to http://docs.python.org/library/os.html
- # os.kill isn't available on Windows.
+ # This method behaves differently on Windows and Linux. On Windows, it
+ # kills the process as well as all of its subprocesses (because of the
+ # '/t' flag). Some call sites depend on this behaviour (e.g. to kill all
+ # worker processes of wptserve on Windows).
+ # TODO(robertma): Replicate the behaviour on POSIX by calling setsid()
+ # in Popen's preexec_fn hook, and perhaps rename the method to
+ # kill_process_tree.
if sys.platform == 'win32':
# Workaround for race condition that occurs when the browser is
# killed as it's launching a process. This sometimes leaves a child
diff --git a/chromium/third_party/blink/tools/blinkpy/common/unified_diff.py b/chromium/third_party/blink/tools/blinkpy/common/unified_diff.py
index 1b5d37e22b5..7f0700aa8df 100644
--- a/chromium/third_party/blink/tools/blinkpy/common/unified_diff.py
+++ b/chromium/third_party/blink/tools/blinkpy/common/unified_diff.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""A utility function to do text diffs of expected and actual layout test results."""
+"""A utility function to do text diffs of expected and actual web test results."""
import difflib
diff --git a/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
index 3b3544dd34d..c4ae1f98fb8 100755
--- a/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
+++ b/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -69,6 +69,10 @@ _CONFIG = [
'base::span',
'logging::GetVlogLevel',
+ # //base/observer_list.h.
+ 'base::ObserverList',
+ 'base::CheckedObserver',
+
# //base/bind_helpers.h.
'base::DoNothing',
@@ -108,6 +112,9 @@ _CONFIG = [
'base::IsTypeInRangeForNumericType',
'base::IsValueNegative',
+ # //base/strings/char_traits.h.
+ 'base::CharTraits',
+
# //base/synchronization/waitable_event.h.
'base::WaitableEvent',
@@ -134,6 +141,7 @@ _CONFIG = [
'base::debug::.+',
# Base atomic utilities
+ 'base::AtomicFlag',
'base::AtomicSequenceNumber',
# Task traits
@@ -172,6 +180,7 @@ _CONFIG = [
# Chromium geometry types.
'gfx::Point',
+ 'gfx::Point3F',
'gfx::Rect',
'gfx::RectF',
'gfx::Size',
@@ -248,6 +257,7 @@ _CONFIG = [
'root_scroller_util::.+',
'scheduler::.+',
'scroll_customization::.+',
+ 'scroll_timeline_util::.+',
'style_change_extra_data::.+',
'style_change_reason::.+',
'svg_path_parser::.+',
@@ -324,6 +334,12 @@ _CONFIG = [
],
},
{
+ 'paths': ['third_party/blink/renderer/controller/oom_intervention_impl.cc'],
+ 'allowed': [
+ 'base::BindOnce',
+ ],
+ },
+ {
'paths': ['third_party/blink/renderer/core/animation'],
'allowed': [
'[a-z_]+_functions::.+',
@@ -401,6 +417,15 @@ _CONFIG = [
],
},
{
+ 'paths': ['third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc'],
+ 'allowed': [
+ # cc painting types.
+ 'cc::ContentLayerClient',
+ 'cc::DisplayItemList',
+ 'cc::DrawRecordOp',
+ ],
+ },
+ {
'paths': ['third_party/blink/renderer/core/inspector/inspector_performance_agent.cc'],
'allowed': [
'base::subtle::TimeTicksNowIgnoringOverride',
@@ -434,6 +459,14 @@ _CONFIG = [
},
{
'paths': [
+ 'third_party/blink/renderer/modules/mediastream/',
+ ],
+ 'allowed': [
+ 'media::.+',
+ ]
+ },
+ {
+ 'paths': [
'third_party/blink/renderer/modules/indexeddb/',
],
'allowed': [
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 57b71b87958..ff596681578 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: c757432db546a30c1e6ef833df0b597df2dad6bd
+Version: f759f0b3a8cb7457adbf30dc0734d3a158ce4990
License: LICENSES FOR W3C TEST SUITES (http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html)
License File: wpt/wpt/LICENSE.md
Security Critical: no
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/README.chromium b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/README.chromium
index 6d71072bce1..0de32f410f2 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/README.chromium
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/README.chromium
@@ -1,4 +1,4 @@
-W3C Web Platform Tests in Blink Layout Tests
+W3C Web Platform Tests in Blink Web Tests
Design Doc: https://goo.gl/iXUaZd
@@ -28,7 +28,7 @@ changing the ports (HTTP/S, WS/S), make sure to also:
- update `WPT_HOST_AND_PORTS` in
`//third_party/blink/tools/blinkpy/web_tests/port/driver.py`
-- update LayoutTestContentBrowserClient::GetOriginsRequiringDedicatedProcess()
+- update WebTestContentBrowserClient::GetOriginsRequiringDedicatedProcess()
checkout.sh
===========
@@ -71,6 +71,10 @@ re-generate them:
Rolling in WPT
+If there are new files that need to be rolled in, add the intended files to
+the WPTWhiteList. Ensure these files are in the correct order by running
+"LC_ALL=C sort WPTWhiteList".
+
When rolling in new versions of WPT support, modify WPT_HEAD in checkout.sh to
the desired HEAD position. You can then call "./checkout.sh clone" which will
pull in all the code.
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/WPTWhiteList b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/WPTWhiteList
index 8349f0421a2..0c3a99f3e11 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/WPTWhiteList
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/WPTWhiteList
@@ -103,6 +103,11 @@
./tools/third_party/webencodings/webencodings/mklabels.py
./tools/third_party/webencodings/webencodings/tests.py
./tools/third_party/webencodings/webencodings/x_user_defined.py
+./tools/webdriver/webdriver/__init__.py
+./tools/webdriver/webdriver/client.py
+./tools/webdriver/webdriver/error.py
+./tools/webdriver/webdriver/protocol.py
+./tools/webdriver/webdriver/transport.py
./tools/wpt/__init__.py
./tools/wpt/browser.py
./tools/wpt/commands.json
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 24a3a3577ef..d927f1844d1 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://chromium.googlesource.com/external/github.com/web-platform-tests/wpt.git"
-WPT_HEAD=6279ae5cc55eb91bb086ab1d0f1969c180cbedc2
+WPT_HEAD=f759f0b3a8cb7457adbf30dc0734d3a158ce4990
function clone {
# Remove existing repo if already exists.
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt.config.json b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt.config.json
index 897d4e9ecaa..3a674155c52 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt.config.json
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt.config.json
@@ -3,6 +3,7 @@
"ws_doc_root": null,
"check_subdomains": false,
"server_host": "127.0.0.1",
+ "log_level": "info",
"ports": {
"http": [8001, 8081],
"https": [8444],
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 8702cec7db5..9b661308ab1 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
@@ -1,21 +1,29 @@
import re
import os
+import itertools
+from six import itervalues, iteritems
+from collections import defaultdict
+
end_space = re.compile(r"([^\\]\s)*$")
-def fnmatch_translate(pat, path_name=False):
+def fnmatch_translate(pat):
parts = []
- seq = False
+ seq = None
i = 0
- if pat[0] == "/" or path_name:
+ any_char = "[^/]"
+ if pat[0] == "/":
parts.append("^")
- any_char = "[^/]"
- if pat[0] == "/":
- pat = pat[1:]
+ pat = pat[1:]
else:
- any_char = "."
+ # By default match the entire path up to a /
+ # but if / doesn't appear in the pattern we will mark is as
+ # a name pattern and just produce a pattern that matches against
+ # the filename
parts.append("^(?:.*/)?")
+
+ name_pattern = True
if pat[-1] == "/":
# If the last character is / match this directory or any subdirectory
pat = pat[:-1]
@@ -31,11 +39,10 @@ def fnmatch_translate(pat, path_name=False):
parts.append(re.escape(c))
else:
raise ValueError
- elif seq:
+ elif seq is not None:
+ # TODO: this doesn't really handle invalid sequences in the right way
if c == "]":
- seq = False
- # First two cases are to deal with the case where / is the only character
- # in the sequence but path_name is True so it shouldn't match anything
+ seq = None
if parts[-1] == "[":
parts = parts[:-1]
elif parts[-1] == "^" and parts[-2] == "[":
@@ -44,35 +51,46 @@ def fnmatch_translate(pat, path_name=False):
parts.append(c)
elif c == "-":
parts.append(c)
- elif not (path_name and c == "/"):
+ else:
parts += re.escape(c)
elif c == "[":
parts.append("[")
if i < len(pat) - 1 and pat[i+1] in ("!", "^"):
parts.append("^")
i += 1
- seq = True
+ seq = i
elif c == "*":
if i < len(pat) - 1 and pat[i+1] == "*":
- parts.append(any_char + "*")
+ if i > 0 and pat[i-1] != "/":
+ raise ValueError
+ parts.append(".*")
i += 1
- if i < len(pat) - 1 and pat[i+1] == "*":
+ if i < len(pat) - 1 and pat[i+1] != "/":
raise ValueError
else:
parts.append(any_char + "*")
elif c == "?":
parts.append(any_char)
+ elif c == "/" and not seq:
+ name_pattern = False
+ parts.append(c)
else:
parts.append(re.escape(c))
i += 1
- if seq:
+ if name_pattern:
+ parts[0] = "^"
+
+ if seq is not None:
raise ValueError
parts.append(suffix)
try:
- return re.compile("".join(parts))
+ return name_pattern, re.compile("".join(parts))
except Exception:
- raise
+ raise ValueError
+
+# Regexp matching rules that have to be converted to patterns
+pattern_re = re.compile(r".*[\*\[\?]")
def parse_line(line):
@@ -89,11 +107,19 @@ def parse_line(line):
if dir_only:
line = line[:-1]
- return invert, dir_only, fnmatch_translate(line, dir_only)
+ # Could make a special case for **/foo, but we don't have any patterns like that
+ if not invert and not pattern_re.match(line):
+ literal = True
+ pattern = tuple(line.rsplit("/", 1))
+ else:
+ pattern = fnmatch_translate(line)
+ literal = False
+
+ return invert, dir_only, literal, pattern
class PathFilter(object):
- def __init__(self, root, extras=None):
+ def __init__(self, root, extras=None, cache=None):
if root:
ignore_path = os.path.join(root, ".gitignore")
else:
@@ -103,51 +129,123 @@ class PathFilter(object):
return
self.trivial = False
- self.rules_file = []
- self.rules_dir = []
+ self.literals_file = defaultdict(dict)
+ self.literals_dir = defaultdict(dict)
+ self.patterns_file = []
+ self.patterns_dir = []
+ self.cache = cache or {}
if extras is None:
extras = []
if ignore_path and os.path.exists(ignore_path):
- self._read_ignore(ignore_path)
-
- for item in extras:
- self._read_line(item)
+ args = ignore_path, extras
+ else:
+ args = None, extras
+ self._read_ignore(*args)
- def _read_ignore(self, ignore_path):
- with open(ignore_path) as f:
- for line in f:
- self._read_line(line)
+ def _read_ignore(self, ignore_path, extras):
+ if ignore_path is not None:
+ with open(ignore_path) as f:
+ for line in f:
+ self._read_line(line)
+ for line in extras:
+ self._read_line(line)
def _read_line(self, line):
parsed = parse_line(line)
if not parsed:
return
- invert, dir_only, regexp = parsed
- if dir_only:
- self.rules_dir.append((regexp, invert))
+ invert, dir_only, literal, rule = parsed
+
+ if invert:
+ # For exclude rules, we attach the rules to all preceeding patterns, so
+ # that we can match patterns out of order and check if they were later
+ # overriden by an exclude rule
+ assert not literal
+ if not dir_only:
+ rules_iter = itertools.chain(
+ itertools.chain(*(iteritems(item) for item in itervalues(self.literals_dir))),
+ itertools.chain(*(iteritems(item) for item in itervalues(self.literals_file))),
+ self.patterns_dir,
+ self.patterns_file)
+ else:
+ rules_iter = itertools.chain(
+ itertools.chain(*(iteritems(item) for item in itervalues(self.literals_dir))),
+ self.patterns_dir)
+
+ for rules in rules_iter:
+ rules[1].append(rule)
else:
- self.rules_file.append((regexp, invert))
+ if literal:
+ if len(rule) == 1:
+ dir_name, pattern = None, rule[0]
+ else:
+ dir_name, pattern = rule
+ self.literals_dir[dir_name][pattern] = []
+ if not dir_only:
+ self.literals_file[dir_name][pattern] = []
+ else:
+ self.patterns_dir.append((rule, []))
+ if not dir_only:
+ self.patterns_file.append((rule, []))
+
+ def filter(self, iterator):
+ empty = {}
+ for dirpath, dirnames, filenames in iterator:
+ orig_dirpath = dirpath
+ if os.path.sep != "/":
+ dirpath = dirpath.replace(os.path.sep, "/")
+
+ keep_dirs = []
+ keep_files = []
+
+ for iter_items, literals, patterns, target, suffix in [
+ (dirnames, self.literals_dir, self.patterns_dir, keep_dirs, "/"),
+ (filenames, self.literals_file, self.patterns_file, keep_files, "")]:
+ for item in iter_items:
+ name = item[0]
+ if dirpath:
+ path = "%s/%s" % (dirpath, name) + suffix
+ else:
+ path = name + suffix
+ if path in self.cache:
+ if not self.cache[path]:
+ target.append(item)
+ continue
+ for rule_dir in [None, dirpath]:
+ if name in literals.get(rule_dir, empty):
+ exclude = literals[rule_dir][name]
+ if not any(rule.match(path) for rule in exclude):
+ # Skip this item
+ self.cache[path] = True
+ break
+ else:
+ for (component_only, pattern), exclude in patterns:
+ if component_only:
+ match = pattern.match(name)
+ else:
+ match = pattern.match(path)
+ if match:
+ if not any(rule.match(name if name_only else path)
+ for name_only, rule in exclude):
+ # Skip this item
+ self.cache[path] = True
+ break
+ else:
+ self.cache[path] = False
+ target.append(item)
+
+ dirnames[:] = keep_dirs
+ assert ".git" not in dirnames
+ yield orig_dirpath, dirnames, keep_files
+
+ def __call__(self, iterator):
+ if self.trivial:
+ return iterator
- def __call__(self, path):
- if os.path.sep != "/":
- path = path.replace(os.path.sep, "/")
+ return self.filter(iterator)
- if self.trivial:
- return True
- path_is_dir = path[-1] == "/"
- if path_is_dir:
- path = path[:-1]
- rules = self.rules_dir
- else:
- rules = self.rules_file
-
- include = True
- for regexp, invert in rules:
- if not include and invert and regexp.match(path):
- include = True
- elif include and not invert and regexp.match(path):
- include = False
- return include
+def has_ignore(dirpath):
+ return os.path.exists(os.path.join(dirpath, ".gitignore"))
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 fedc740b4e8..03f0ecc7780 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
@@ -16,6 +16,7 @@ from . import fnmatch
from .. import localpaths
from ..gitignore.gitignore import PathFilter
from ..wpt import testfiles
+from ..manifest.vcs import walk
from manifest.sourcefile import SourceFile, js_meta_re, python_meta_re, space_chars, get_any_variants, get_default_any_variants
from six import binary_type, iteritems, itervalues
@@ -67,14 +68,14 @@ def all_filesystem_paths(repo_root, subdir=None):
expanded_path = subdir
else:
expanded_path = repo_root
- for dirpath, dirnames, filenames in os.walk(expanded_path):
- for filename in filenames:
- path = os.path.relpath(os.path.join(dirpath, filename), repo_root)
- if path_filter(path):
- yield path
- dirnames[:] = [item for item in dirnames if
- path_filter(os.path.relpath(os.path.join(dirpath, item) + "/",
- repo_root)+"/")]
+ for dirpath, dirnames, filenames in path_filter(walk(expanded_path)):
+ for filename, _ in filenames:
+ path = os.path.join(dirpath, filename)
+ if subdir:
+ path = os.path.join(subdir, path)
+ assert not os.path.isabs(path), path
+ yield path
+
def _all_files_equal(paths):
"""
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/commands.json b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/commands.json
index d6ccd98809e..074d248bf27 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/commands.json
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/commands.json
@@ -2,5 +2,4 @@
{"path": "update.py", "script": "run", "parser": "create_parser", "help": "Update the MANIFEST.json file",
"virtualenv": false},
"manifest-download":
- {"path": "download.py", "script": "run", "parser": "create_parser", "help": "Download recent pregenerated MANIFEST.json file",
- "virtualenv": false}}
+ {"path": "download.py", "script": "run", "parser": "create_parser", "help": "Download recent pregenerated MANIFEST.json file", "virtualenv": false}}
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/download.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/download.py
index 8bb3cb673de..2e505f371ed 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/download.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/download.py
@@ -33,46 +33,53 @@ def should_download(manifest_path, rebuild_time=timedelta(days=5)):
return False
-def git_commits(repo_root):
+def merge_pr_tags(repo_root, max_count=50):
git = Git.get_func(repo_root)
- return [item for item in git("log", "--format=%H", "-n50").split("\n") if item]
-
-
-def github_url(commits):
- try:
- resp = urlopen("https://api.github.com/repos/web-platform-tests/wpt/releases")
- except Exception:
- return None
-
- if resp.code != 200:
- return None
-
- try:
- releases = json.load(resp.fp)
- except ValueError:
- logger.warning("Response was not valid JSON")
- return None
-
- fallback = None
- for release in releases:
- for commit in commits:
- for item in release["assets"]:
- if item["name"] == "MANIFEST-%s.json.gz" % commit:
- return item["browser_download_url"]
- elif item["name"] == "MANIFEST.json.gz" and not fallback:
- fallback = item["browser_download_url"]
- if fallback:
- logger.info("Can't find a commit-specific manifest so just using the most recent one")
- return fallback
-
-
-def download_manifest(manifest_path, commits_func, url_func, force=False):
+ tags = []
+ for line in git("log", "--format=%D", "--max-count=%s" % max_count).split("\n"):
+ for ref in line.split(", "):
+ if ref.startswith("tag: merge_pr_"):
+ tags.append(ref[5:])
+ return tags
+
+
+def github_url(tags):
+ for tag in tags:
+ url = "https://api.github.com/repos/web-platform-tests/wpt/releases/tags/%s" % tag
+ try:
+ resp = urlopen(url)
+ except Exception:
+ logger.warning("Fetching %s failed" % url)
+ continue
+
+ if resp.code != 200:
+ logger.warning("Fetching %s failed; got HTTP status %d" % (url, resp.code))
+ continue
+
+ try:
+ release = json.load(resp.fp)
+ except ValueError:
+ logger.warning("Response was not valid JSON")
+ return None
+
+ for item in release["assets"]:
+ # Accept both ways of naming the manfest asset, even though
+ # there's no longer a reason to include the commit sha.
+ if item["name"].startswith("MANIFEST-") and item["name"].endswith(".json.gz"):
+ return item["browser_download_url"]
+ elif item["name"] == "MANIFEST.json.gz":
+ return item["browser_download_url"]
+
+ return None
+
+
+def download_manifest(manifest_path, tags_func, url_func, force=False):
if not force and not should_download(manifest_path):
return False
- commits = commits_func()
+ tags = tags_func()
- url = url_func(commits)
+ url = url_func(tags)
if not url:
logger.warning("No generated manifest found")
return False
@@ -120,7 +127,7 @@ def create_parser():
def download_from_github(path, tests_root, force=False):
- return download_manifest(path, lambda: git_commits(tests_root), github_url,
+ return download_manifest(path, lambda: merge_pr_tags(tests_root), github_url,
force=force)
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 ddf046a68fa..2bbdf0d5a5b 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
@@ -2,19 +2,21 @@ from six.moves.urllib.parse import urljoin, urlparse
from abc import ABCMeta, abstractproperty
-def get_source_file(source_files, tests_root, manifest, path):
- def make_new():
+class SourceFileCache(object):
+ def __init__(self):
+ self.source_files = {}
+
+ def make_new(self, tests_root, path, url_base):
from .sourcefile import SourceFile
- return SourceFile(tests_root, path, manifest.url_base)
+ return SourceFile(tests_root, path, url_base)
- if source_files is None:
- return make_new()
+ def get(self, tests_root, manifest, path):
- if path not in source_files:
- source_files[path] = make_new()
+ if path not in self.source_files:
+ self.source_files[path] = self.make_new(tests_root, path, manifest.url_base)
- return source_files[path]
+ return self.source_files[path]
item_types = {}
@@ -27,7 +29,8 @@ class ManifestItemMeta(ABCMeta):
def __new__(cls, name, bases, attrs, **kwargs):
rv = ABCMeta.__new__(cls, name, bases, attrs, **kwargs)
- item_types[rv.item_type] = rv
+ if rv.item_type:
+ item_types[rv.item_type] = rv
return rv
@@ -37,8 +40,9 @@ class ManifestItem(object):
item_type = None
+ source_file_cache = SourceFileCache()
+
def __init__(self, source_file, manifest=None):
- self.manifest = manifest
self.source_file = source_file
@abstractproperty
@@ -84,8 +88,8 @@ class ManifestItem(object):
return [{}]
@classmethod
- def from_json(cls, manifest, tests_root, path, obj, source_files=None):
- source_file = get_source_file(source_files, tests_root, manifest, path)
+ def from_json(cls, manifest, tests_root, path, obj):
+ source_file = cls.source_file_cache.get(tests_root, manifest, path)
return cls(source_file,
manifest=manifest)
@@ -113,8 +117,8 @@ class URLManifestItem(ManifestItem):
return rv
@classmethod
- def from_json(cls, manifest, tests_root, path, obj, source_files=None):
- source_file = get_source_file(source_files, tests_root, manifest, path)
+ def from_json(cls, manifest, tests_root, path, obj):
+ source_file = cls.source_file_cache.get(tests_root, manifest, path)
url, extras = obj
return cls(source_file,
url,
@@ -145,8 +149,8 @@ class TestharnessTest(URLManifestItem):
return rv
@classmethod
- def from_json(cls, manifest, tests_root, path, obj, source_files=None):
- source_file = get_source_file(source_files, tests_root, manifest, path)
+ def from_json(cls, manifest, tests_root, path, obj):
+ source_file = cls.source_file_cache.get(tests_root, manifest, path)
url, extras = obj
return cls(source_file,
@@ -187,8 +191,8 @@ class RefTestNode(URLManifestItem):
return rv
@classmethod
- def from_json(cls, manifest, tests_root, path, obj, source_files=None):
- source_file = get_source_file(source_files, tests_root, manifest, path)
+ def from_json(cls, manifest, tests_root, path, obj):
+ source_file = cls.source_file_cache.get(tests_root, manifest, path)
url, references, extras = obj
return cls(source_file,
url,
@@ -248,8 +252,8 @@ class WebDriverSpecTest(URLManifestItem):
return rv
@classmethod
- def from_json(cls, manifest, tests_root, path, obj, source_files=None):
- source_file = get_source_file(source_files, tests_root, manifest, path)
+ def from_json(cls, manifest, tests_root, path, obj):
+ source_file = cls.source_file_cache.get(tests_root, manifest, path)
url, extras = obj
return cls(source_file,
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 9b2f0a18a56..127d45dbc66 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,13 +1,20 @@
import itertools
-import json
import os
from collections import defaultdict
-from six import iteritems, itervalues, viewkeys, string_types
+from six import iteritems, iterkeys, itervalues, string_types
-from .item import ManualTest, WebDriverSpecTest, Stub, RefTestNode, RefTest, TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest
+from . import vcs
+from .item import (ManualTest, WebDriverSpecTest, Stub, RefTestNode, RefTest,
+ TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest)
from .log import get_logger
from .utils import from_os_path, to_os_path
+try:
+ import ujson as json
+ JSON_LIBRARY = 'ujson'
+except ImportError:
+ import json
+ JSON_LIBRARY = 'json'
CURRENT_VERSION = 5
@@ -27,11 +34,178 @@ def iterfilter(filters, iter):
yield item
+item_classes = {"testharness": TestharnessTest,
+ "reftest": RefTest,
+ "reftest_node": RefTestNode,
+ "manual": ManualTest,
+ "stub": Stub,
+ "wdspec": WebDriverSpecTest,
+ "conformancechecker": ConformanceCheckerTest,
+ "visual": VisualTest,
+ "support": SupportFile}
+
+
+class TypeData(object):
+ def __init__(self, manifest, type_cls, meta_filters):
+ """Dict-like object containing the TestItems for each test type.
+
+ Loading an actual Item class for each test is unnecessarily
+ slow, so this class allows lazy-loading of the test
+ items. When the manifest is loaded we store the raw json
+ corresponding to the test type, and only create an Item
+ subclass when the test is accessed. In order to remain
+ API-compatible with consumers that depend on getting an Item
+ from iteration, we do egerly load all items when iterating
+ over the class."""
+ self.manifest = manifest
+ self.type_cls = type_cls
+ self.json_data = {}
+ self.tests_root = None
+ self.data = {}
+ self.meta_filters = meta_filters or []
+
+ def __getitem__(self, key):
+ if key not in self.data:
+ self.load(key)
+ return self.data[key]
+
+ def __bool__(self):
+ return bool(self.data)
+
+ def __len__(self):
+ rv = len(self.data)
+ if self.json_data is not None:
+ rv += len(self.json_data)
+ return rv
+
+ def __delitem__(self, key):
+ if key in self.data:
+ del self.data[key]
+ elif self.json_data is not None:
+ del self.json_data[from_os_path(key)]
+ else:
+ raise KeyError
+
+ def __setitem__(self, key, value):
+ self.data[key] = value
+
+ def __contains__(self, key):
+ self.load_all()
+ return key in self.data
+
+ def __iter__(self):
+ self.load_all()
+ return self.data.__iter__()
+
+ def pop(self, key, default=None):
+ try:
+ value = self[key]
+ except ValueError:
+ value = default
+ else:
+ del self.data[key]
+ return value
+
+ def get(self, key, default=None):
+ try:
+ return self[key]
+ except ValueError:
+ return default
+
+ def itervalues(self):
+ self.load_all()
+ return itervalues(self.data)
+
+ def iteritems(self):
+ self.load_all()
+ return iteritems(self.data)
+
+ def values(self):
+ return self.itervalues()
+
+ def items(self):
+ return self.iteritems()
+
+ def load(self, key):
+ """Load a specific Item given a path"""
+ if self.json_data is not None:
+ data = set()
+ path = from_os_path(key)
+ for test in iterfilter(self.meta_filters, self.json_data.get(path, [])):
+ manifest_item = self.type_cls.from_json(self.manifest,
+ self.tests_root,
+ path,
+ test)
+ data.add(manifest_item)
+ try:
+ del self.json_data[path]
+ except KeyError:
+ pass
+ self.data[key] = data
+ else:
+ raise ValueError
+
+ def load_all(self):
+ """Load all test items in this class"""
+ if self.json_data is not None:
+ for path, value in iteritems(self.json_data):
+ key = to_os_path(path)
+ if key in self.data:
+ continue
+ data = set()
+ for test in iterfilter(self.meta_filters, self.json_data.get(path, [])):
+ manifest_item = self.type_cls.from_json(self.manifest,
+ self.tests_root,
+ path,
+ test)
+ data.add(manifest_item)
+ self.data[key] = data
+ self.json_data = None
+
+ def set_json(self, tests_root, data):
+ if not isinstance(data, dict):
+ raise ValueError("Got a %s expected a dict" % (type(data)))
+ self.tests_root = tests_root
+ self.json_data = data
+
+ def paths(self):
+ """Get a list of all paths containing items of this type,
+ without actually constructing all the items"""
+ rv = set(iterkeys(self.data))
+ if self.json_data:
+ rv |= set(to_os_path(item) for item in iterkeys(self.json_data))
+ return rv
+
+
+class ManifestData(dict):
+ def __init__(self, manifest, meta_filters=None):
+ """Dictionary subclass containing a TypeData instance for each test type,
+ keyed by type name"""
+ self.initialized = False
+ for key, value in iteritems(item_classes):
+ self[key] = TypeData(manifest, value, meta_filters=meta_filters)
+ self.initialized = True
+ self.json_obj = None
+
+ def __setitem__(self, key, value):
+ if self.initialized:
+ raise AttributeError
+ dict.__setitem__(self, key, value)
+
+ def paths(self):
+ """Get a list of all paths containing test items
+ without actually constructing all the items"""
+ rv = set()
+ for item_data in itervalues(self):
+ rv |= set(item_data.paths())
+ return rv
+
+
class Manifest(object):
- def __init__(self, url_base="/"):
+ def __init__(self, url_base="/", meta_filters=None):
assert url_base is not None
self._path_hash = {}
- self._data = defaultdict(dict)
+ self._data = ManifestData(self, meta_filters)
self._reftest_nodes_by_url = None
self.url_base = url_base
@@ -42,7 +216,8 @@ class Manifest(object):
if not types:
types = sorted(self._data.keys())
for item_type in types:
- for path, tests in sorted(iteritems(self._data[item_type])):
+ for path in sorted(self._data[item_type]):
+ tests = self._data[item_type][path]
yield item_type, path, tests
def iterpath(self, path):
@@ -74,61 +249,88 @@ class Manifest(object):
return self.reftest_nodes_by_url.get(url)
def update(self, tree):
- new_data = defaultdict(dict)
- new_hashes = {}
+ """Update the manifest given an iterable of items that make up the updated manifest.
+ The iterable must either generate tuples of the form (SourceFile, True) for paths
+ that are to be updated, or (path, False) for items that are not to be updated. This
+ 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."""
reftest_nodes = []
- old_files = defaultdict(set, {k: set(viewkeys(v)) for k, v in iteritems(self._data)})
+ seen_files = set()
changed = False
reftest_changes = False
- for source_file in tree:
- rel_path = source_file.rel_path
- file_hash = source_file.hash
+ prev_files = self._data.paths()
- is_new = rel_path not in self._path_hash
- hash_changed = False
+ reftest_types = ("reftest", "reftest_node")
- if not is_new:
- old_hash, old_type = self._path_hash[rel_path]
- old_files[old_type].remove(rel_path)
- if old_hash != file_hash:
- new_type, manifest_items = source_file.manifest_items()
- hash_changed = True
- else:
- new_type, manifest_items = old_type, self._data[old_type][rel_path]
- if old_type in ("reftest", "reftest_node") and new_type != old_type:
- reftest_changes = True
+ for source_file, update in tree:
+ if not update:
+ rel_path = source_file
+ seen_files.add(rel_path)
else:
- new_type, manifest_items = source_file.manifest_items()
-
- if new_type in ("reftest", "reftest_node"):
- reftest_nodes.extend(manifest_items)
- if is_new or hash_changed:
- reftest_changes = True
- elif new_type:
- new_data[new_type][rel_path] = set(manifest_items)
+ rel_path = source_file.rel_path
+ seen_files.add(rel_path)
+
+ file_hash = source_file.hash
+
+ is_new = rel_path not in self._path_hash
+ hash_changed = False
+
+ if not is_new:
+ old_hash, old_type = self._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:
+ try:
+ del self._data[old_type][rel_path]
+ except KeyError:
+ pass
+ else:
+ new_type, manifest_items = old_type, self._data[old_type][rel_path]
+ if old_type in reftest_types and new_type != old_type:
+ reftest_changes = True
+ else:
+ new_type, manifest_items = source_file.manifest_items()
- new_hashes[rel_path] = (file_hash, new_type)
+ if new_type in ("reftest", "reftest_node"):
+ reftest_nodes.extend(manifest_items)
+ if is_new or hash_changed:
+ reftest_changes = True
+ elif new_type:
+ self._data[new_type][rel_path] = set(manifest_items)
- if is_new or hash_changed:
- changed = True
+ self._path_hash[rel_path] = (file_hash, new_type)
- if reftest_changes or old_files["reftest"] or old_files["reftest_node"]:
- reftests, reftest_nodes, changed_hashes = self._compute_reftests(reftest_nodes)
- new_data["reftest"] = reftests
- new_data["reftest_node"] = reftest_nodes
- new_hashes.update(changed_hashes)
- else:
- new_data["reftest"] = self._data["reftest"]
- new_data["reftest_node"] = self._data["reftest_node"]
+ if is_new or hash_changed:
+ changed = True
- if any(itervalues(old_files)):
+ deleted = prev_files - seen_files
+ if deleted:
changed = True
+ for rel_path in deleted:
+ if rel_path in self._path_hash:
+ _, old_type = self._path_hash[rel_path]
+ if old_type in reftest_types:
+ reftest_changes = True
+ del self._path_hash[rel_path]
+ try:
+ del self._data[old_type][rel_path]
+ except KeyError:
+ pass
+ else:
+ for test_data in itervalues(self._data):
+ if rel_path in test_data:
+ del test_data[rel_path]
- self._data = new_data
- self._path_hash = new_hashes
+ if reftest_changes:
+ reftests, reftest_nodes, changed_hashes = self._compute_reftests(reftest_nodes)
+ self._data["reftest"].data = reftests
+ self._data["reftest_node"].data = reftest_nodes
+ self._path_hash.update(changed_hashes)
return changed
@@ -168,7 +370,7 @@ class Manifest(object):
[t for t in sorted(test.to_json() for test in tests)]
for path, tests in iteritems(type_paths)
}
- for test_type, type_paths in iteritems(self._data)
+ for test_type, type_paths in iteritems(self._data) if type_paths
}
rv = {"url_base": self.url_base,
"paths": {from_os_path(k): v for k, v in iteritems(self._path_hash)},
@@ -182,26 +384,12 @@ class Manifest(object):
if version != CURRENT_VERSION:
raise ManifestVersionMismatch
- self = cls(url_base=obj.get("url_base", "/"))
+ self = cls(url_base=obj.get("url_base", "/"), meta_filters=meta_filters)
if not hasattr(obj, "items") and hasattr(obj, "paths"):
raise ManifestError
self._path_hash = {to_os_path(k): v for k, v in iteritems(obj["paths"])}
- item_classes = {"testharness": TestharnessTest,
- "reftest": RefTest,
- "reftest_node": RefTestNode,
- "manual": ManualTest,
- "stub": Stub,
- "wdspec": WebDriverSpecTest,
- "conformancechecker": ConformanceCheckerTest,
- "visual": VisualTest,
- "support": SupportFile}
-
- meta_filters = meta_filters or []
-
- source_files = {}
-
for test_type, type_paths in iteritems(obj["items"]):
if test_type not in item_classes:
raise ManifestError
@@ -209,18 +397,7 @@ class Manifest(object):
if types and test_type not in types:
continue
- test_cls = item_classes[test_type]
- tests = defaultdict(set)
- for path, manifest_tests in iteritems(type_paths):
- path = to_os_path(path)
- for test in iterfilter(meta_filters, manifest_tests):
- manifest_item = test_cls.from_json(self,
- tests_root,
- path,
- test,
- source_files=source_files)
- tests[path].add(manifest_item)
- self._data[test_type] = tests
+ self._data[test_type].set_json(tests_root, type_paths)
return self
@@ -228,7 +405,20 @@ class Manifest(object):
def load(tests_root, manifest, types=None, meta_filters=None):
logger = get_logger()
+ logger.warning("Prefer load_and_update instead")
+ return _load(logger, tests_root, manifest, types, meta_filters)
+
+
+__load_cache = {}
+
+
+def _load(logger, tests_root, manifest, types=None, meta_filters=None):
# "manifest" is a path or file-like object.
+ manifest_path = (manifest if isinstance(manifest, string_types)
+ else manifest.name)
+ if manifest_path in __load_cache:
+ return __load_cache[manifest_path]
+
if isinstance(manifest, string_types):
if os.path.exists(manifest):
logger.debug("Opening manifest at %s" % manifest)
@@ -236,15 +426,65 @@ def load(tests_root, manifest, types=None, meta_filters=None):
logger.debug("Creating new manifest at %s" % manifest)
try:
with open(manifest) as f:
- rv = Manifest.from_json(tests_root, json.load(f), types=types, meta_filters=meta_filters)
+ rv = Manifest.from_json(tests_root,
+ json.load(f),
+ types=types,
+ meta_filters=meta_filters)
except IOError:
return None
except ValueError:
logger.warning("%r may be corrupted", manifest)
return None
- return rv
+ else:
+ rv = Manifest.from_json(tests_root,
+ json.load(manifest),
+ types=types,
+ meta_filters=meta_filters)
+
+ __load_cache[manifest_path] = rv
+ return rv
+
+
+def load_and_update(tests_root,
+ manifest_path,
+ url_base,
+ update=True,
+ rebuild=False,
+ metadata_path=None,
+ cache_root=None,
+ working_copy=False,
+ types=None,
+ meta_filters=None,
+ write_manifest=True):
+ logger = get_logger()
- return Manifest.from_json(tests_root, json.load(manifest), types=types, meta_filters=meta_filters)
+ manifest = None
+ if not rebuild:
+ try:
+ manifest = _load(logger,
+ tests_root,
+ manifest_path,
+ types=types,
+ meta_filters=meta_filters)
+ except ManifestVersionMismatch:
+ logger.info("Manifest version changed, rebuilding")
+
+ if manifest is not None and manifest.url_base != url_base:
+ logger.info("Manifest url base did not match, rebuilding")
+
+ if manifest is None:
+ manifest = Manifest(url_base, meta_filters=meta_filters)
+ update = True
+
+ if update:
+ tree = vcs.get_tree(tests_root, manifest, manifest_path, cache_root,
+ working_copy, rebuild)
+ changed = manifest.update(tree)
+ if write_manifest and changed:
+ write(manifest, manifest_path)
+ tree.dump_caches()
+
+ return manifest
def write(manifest, manifest_path):
@@ -252,5 +492,12 @@ def write(manifest, manifest_path):
if not os.path.exists(dir_name):
os.makedirs(dir_name)
with open(manifest_path, "wb") as f:
- json.dump(manifest.to_json(), f, sort_keys=True, indent=1, separators=(',', ': '))
+ if JSON_LIBRARY == 'ujson':
+ # ujson does not support the separators flag.
+ json.dump(manifest.to_json(), f, sort_keys=True, indent=1)
+ else:
+ # Use ',' instead of the default ', ' separator to prevent trailing
+ # spaces: https://docs.python.org/2/library/json.html#json.dump
+ json.dump(manifest.to_json(), f,
+ sort_keys=True, indent=1, separators=(',', ': '))
f.write("\n")
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 1f08088eb46..d2e5df85526 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
@@ -164,6 +164,8 @@ class SourceFile(object):
:param contents: Byte array of the contents of the file or ``None``.
"""
+ assert not os.path.isabs(rel_path), rel_path
+
self.tests_root = tests_root
if os.name == "nt":
# do slash normalization on Windows
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/update.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/update.py
index 9923cc5fe62..217d767cece 100755
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/update.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/update.py
@@ -13,14 +13,18 @@ wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
logger = get_logger()
-def update(tests_root, manifest, working_copy=False):
+
+def update(tests_root,
+ manifest,
+ manifest_path=None,
+ working_copy=False,
+ cache_root=None,
+ rebuild=False):
+ logger.warning("Deprecated; use manifest.load_and_update instead")
logger.info("Updating manifest")
- tree = None
- if not working_copy:
- tree = vcs.Git.for_path(tests_root, manifest.url_base)
- if tree is None:
- tree = vcs.FileSystem(tests_root, manifest.url_base)
+ tree = vcs.get_tree(tests_root, manifest, manifest_path, cache_root,
+ working_copy, rebuild)
return manifest.update(tree)
@@ -29,26 +33,16 @@ def update_from_cli(**kwargs):
path = kwargs["path"]
assert tests_root is not None
- m = None
-
if kwargs["download"]:
download_from_github(path, tests_root)
- if not kwargs.get("rebuild", False):
- try:
- m = manifest.load(tests_root, path)
- except manifest.ManifestVersionMismatch:
- logger.info("Manifest version changed, rebuilding")
- m = None
-
- if m is None:
- m = manifest.Manifest(kwargs["url_base"])
-
- changed = update(tests_root,
- m,
- working_copy=kwargs["work"])
- if changed:
- manifest.write(m, path)
+ manifest.load_and_update(tests_root,
+ path,
+ kwargs["url_base"],
+ update=True,
+ rebuild=kwargs["rebuild"],
+ cache_root=kwargs["cache_root"],
+ working_copy=kwargs["work"])
def abs_path(path):
@@ -73,6 +67,9 @@ def create_parser():
parser.add_argument(
"--no-download", dest="download", action="store_false", default=True,
help="Never attempt to download the manifest.")
+ parser.add_argument(
+ "--cache-root", action="store", default=os.path.join(wpt_root, ".wptcache"),
+ help="Path in which to store any caches (default <tests_root>/.wptcache/")
return parser
@@ -87,10 +84,9 @@ def find_top_repo():
return rv
-def run(**kwargs):
+def run(*args, **kwargs):
if kwargs["path"] is None:
kwargs["path"] = os.path.join(kwargs["tests_root"], "MANIFEST.json")
-
update_from_cli(**kwargs)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py
index d9be750e416..9da79f6deb4 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py
@@ -4,7 +4,7 @@ import os
from six import BytesIO
def rel_path_to_url(rel_path, url_base="/"):
- assert not os.path.isabs(rel_path)
+ assert not os.path.isabs(rel_path), rel_path
if url_base[0] != "/":
url_base = "/" + url_base
if url_base[-1] != "/":
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/vcs.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/vcs.py
index 675eb01714f..69eb9ab8ecb 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/vcs.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/vcs.py
@@ -1,15 +1,46 @@
+import json
import os
-import subprocess
import platform
+import stat
+import subprocess
+from collections import deque
from .sourcefile import SourceFile
+def get_tree(tests_root, manifest, manifest_path, cache_root,
+ working_copy=False, rebuild=False):
+ tree = None
+ if cache_root is None:
+ cache_root = os.path.join(tests_root, ".wptcache")
+ if not os.path.exists(cache_root):
+ try:
+ os.makedirs(cache_root)
+ except IOError:
+ cache_root = None
+
+ if not working_copy:
+ tree = Git.for_path(tests_root,
+ manifest.url_base,
+ manifest_path=manifest_path,
+ cache_path=cache_root,
+ rebuild=rebuild)
+ if tree is None:
+ tree = FileSystem(tests_root,
+ manifest.url_base,
+ manifest_path=manifest_path,
+ cache_path=cache_root,
+ rebuild=rebuild)
+ return tree
+
+
class Git(object):
- def __init__(self, repo_root, url_base):
- self.root = os.path.abspath(repo_root)
+ def __init__(self, repo_root, url_base, cache_path, manifest_path=None,
+ rebuild=False):
+ self.root = repo_root
self.git = Git.get_func(repo_root)
self.url_base = url_base
+ # rebuild is a noop for now since we don't cache anything
@staticmethod
def get_func(repo_path):
@@ -26,11 +57,12 @@ class Git(object):
return git
@classmethod
- def for_path(cls, path, url_base):
+ def for_path(cls, path, url_base, cache_path, manifest_path=None, rebuild=False):
git = Git.get_func(path)
try:
- return cls(git("rev-parse", "--show-toplevel").rstrip(), url_base)
- except subprocess.CalledProcessError:
+ return cls(git("rev-parse", "--show-toplevel").rstrip(), url_base, cache_path,
+ manifest_path=manifest_path, rebuild=rebuild)
+ except (subprocess.CalledProcessError, OSError):
return None
def _local_changes(self):
@@ -74,27 +106,194 @@ class Git(object):
rel_path,
self.url_base,
hash,
- contents=contents)
+ contents=contents), True
+
+ def dump_caches(self):
+ pass
class FileSystem(object):
- def __init__(self, root, url_base):
- self.root = root
- self.url_base = url_base
+ def __init__(self, root, url_base, cache_path, manifest_path=None, rebuild=False):
from gitignore import gitignore
- self.path_filter = gitignore.PathFilter(self.root, extras=[".git/"])
+ self.root = os.path.abspath(root)
+ self.url_base = url_base
+ self.ignore_cache = None
+ self.mtime_cache = None
+ if cache_path is not None:
+ if manifest_path is not None:
+ self.mtime_cache = MtimeCache(cache_path, root, manifest_path, rebuild)
+ if gitignore.has_ignore(root):
+ self.ignore_cache = GitIgnoreCache(cache_path, root, rebuild)
+ self.path_filter = gitignore.PathFilter(self.root,
+ extras=[".git/"],
+ cache=self.ignore_cache)
def __iter__(self):
- paths = self.get_paths()
- for path in paths:
- yield SourceFile(self.root, path, self.url_base)
-
- def get_paths(self):
- for dirpath, dirnames, filenames in os.walk(self.root):
- for filename in filenames:
- path = os.path.relpath(os.path.join(dirpath, filename), self.root)
- if self.path_filter(path):
- yield path
-
- dirnames[:] = [item for item in dirnames if self.path_filter(
- os.path.relpath(os.path.join(dirpath, item), self.root) + "/")]
+ mtime_cache = self.mtime_cache
+ for dirpath, dirnames, filenames in self.path_filter(walk(self.root)):
+ for filename, path_stat in filenames:
+ path = os.path.join(dirpath, filename)
+ if mtime_cache is None or mtime_cache.updated(path, path_stat):
+ yield SourceFile(self.root, path, self.url_base), True
+ else:
+ yield path, False
+
+ def dump_caches(self):
+ for cache in [self.mtime_cache, self.ignore_cache]:
+ if cache is not None:
+ cache.dump()
+
+
+class CacheFile(object):
+ file_name = None
+
+ def __init__(self, cache_root, tests_root, rebuild=False):
+ self.tests_root = tests_root
+ if not os.path.exists(cache_root):
+ os.makedirs(cache_root)
+ self.path = os.path.join(cache_root, self.file_name)
+ self.modified = False
+ self.data = self.load(rebuild)
+
+ def dump(self):
+ if not self.modified:
+ return
+ with open(self.path, 'w') as f:
+ json.dump(self.data, f, indent=1)
+
+ def load(self, rebuild=False):
+ data = {}
+ try:
+ if not rebuild:
+ with open(self.path, 'r') as f:
+ data = json.load(f)
+ data = self.check_valid(data)
+ except IOError:
+ pass
+ return data
+
+ def check_valid(self, data):
+ """Check if the cached data is valid and return an updated copy of the
+ cache containing only data that can be used."""
+ return data
+
+
+class MtimeCache(CacheFile):
+ file_name = "mtime.json"
+
+ def __init__(self, cache_root, tests_root, manifest_path, rebuild=False):
+ self.manifest_path = manifest_path
+ super(MtimeCache, self).__init__(cache_root, tests_root, rebuild=False)
+
+ def updated(self, rel_path, stat):
+ """Return a boolean indicating whether the file changed since the cache was last updated.
+
+ This implicitly updates the cache with the new mtime data."""
+ mtime = stat.st_mtime
+ if mtime != self.data.get(rel_path):
+ self.modified = True
+ self.data[rel_path] = mtime
+ return True
+ return False
+
+ def check_valid(self, data):
+ if data.get("/tests_root") != self.tests_root:
+ self.modified = True
+ else:
+ if self.manifest_path is not None and os.path.exists(self.manifest_path):
+ mtime = os.path.getmtime(self.manifest_path)
+ if data.get("/manifest_path") != [self.manifest_path, mtime]:
+ self.modified = True
+ else:
+ self.modified = True
+ if self.modified:
+ data = {}
+ data["/tests_root"] = self.tests_root
+ return data
+
+ def dump(self):
+ if self.manifest_path is None:
+ raise ValueError
+ if not os.path.exists(self.manifest_path):
+ return
+ mtime = os.path.getmtime(self.manifest_path)
+ self.data["/manifest_path"] = [self.manifest_path, mtime]
+ self.data["/tests_root"] = self.tests_root
+ super(MtimeCache, self).dump()
+
+
+class GitIgnoreCache(CacheFile):
+ file_name = "gitignore.json"
+
+ def check_valid(self, data):
+ ignore_path = os.path.join(self.tests_root, ".gitignore")
+ mtime = os.path.getmtime(ignore_path)
+ if data.get("/gitignore_file") != [ignore_path, mtime]:
+ self.modified = True
+ data = {}
+ data["/gitignore_file"] = [ignore_path, mtime]
+ return data
+
+ def __contains__(self, key):
+ return key in self.data
+
+ def __getitem__(self, key):
+ return self.data[key]
+
+ def __setitem__(self, key, value):
+ if self.data.get(key) != value:
+ self.modified = True
+ self.data[key] = value
+
+
+def walk(root):
+ """Re-implementation of os.walk. Returns an iterator over
+ (dirpath, dirnames, filenames), with some semantic differences
+ to os.walk.
+
+ This has a similar interface to os.walk, with the important difference
+ that instead of lists of filenames and directory names, it yields
+ lists of tuples of the form [(name, stat)] where stat is the result of
+ os.stat for the file. That allows reusing the same stat data in the
+ caller. It also always returns the dirpath relative to the root, with
+ the root iself being returned as the empty string.
+
+ Unlike os.walk the implementation is not recursive."""
+
+ listdir = os.listdir
+ get_stat = os.stat
+ listdir = os.listdir
+ join = os.path.join
+ is_dir = stat.S_ISDIR
+ is_link = stat.S_ISLNK
+ relpath = os.path.relpath
+
+ root = os.path.abspath(root)
+ stack = deque([(root, "")])
+
+ while stack:
+ dir_path, rel_path = stack.popleft()
+ try:
+ # Note that listdir and error are globals in this module due
+ # to earlier import-*.
+ names = listdir(dir_path)
+ except OSError:
+ continue
+
+ dirs, non_dirs = [], []
+ for name in names:
+ path = join(dir_path, name)
+ try:
+ path_stat = get_stat(path)
+ except OSError:
+ continue
+ if is_dir(path_stat.st_mode):
+ dirs.append((name, path_stat))
+ else:
+ non_dirs.append((name, path_stat))
+
+ yield rel_path, dirs, non_dirs
+ for name, path_stat in dirs:
+ new_path = join(dir_path, name)
+ if not is_link(path_stat.st_mode):
+ stack.append((new_path, relpath(new_path, root)))
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 c4afc691d34..4eee732443b 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
@@ -757,7 +757,9 @@ class ConfigBuilder(config.ConfigBuilder):
"openssl": {
"openssl_binary": "openssl",
"base_path": "_certs",
+ "password": "web-platform-tests",
"force_regenerate": False,
+ "duration": 30,
"base_conf_path": None
},
"pregenerated": {
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
new file mode 100644
index 00000000000..217bfc65272
--- /dev/null
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/__init__.py
@@ -0,0 +1,36 @@
+# flake8: noqa
+
+from client import (
+ Cookies,
+ Element,
+ Find,
+ Frame,
+ Session,
+ Timeouts,
+ Window)
+from error import (
+ ElementNotSelectableException,
+ ElementNotVisibleException,
+ InvalidArgumentException,
+ InvalidCookieDomainException,
+ InvalidElementCoordinatesException,
+ InvalidElementStateException,
+ InvalidSelectorException,
+ InvalidSessionIdException,
+ JavascriptErrorException,
+ MoveTargetOutOfBoundsException,
+ NoSuchAlertException,
+ NoSuchElementException,
+ NoSuchFrameException,
+ NoSuchWindowException,
+ ScriptTimeoutException,
+ SessionNotCreatedException,
+ StaleElementReferenceException,
+ TimeoutException,
+ UnableToSetCookieException,
+ UnexpectedAlertOpenException,
+ UnknownCommandException,
+ UnknownErrorException,
+ UnknownMethodException,
+ UnsupportedOperationException,
+ WebDriverException)
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
new file mode 100644
index 00000000000..29be09bb3c9
--- /dev/null
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/client.py
@@ -0,0 +1,741 @@
+import urlparse
+
+import error
+import protocol
+import transport
+
+from six import string_types
+
+
+def command(func):
+ def inner(self, *args, **kwargs):
+ if hasattr(self, "session"):
+ session = self.session
+ else:
+ session = self
+
+ if session.session_id is None:
+ session.start()
+
+ return func(self, *args, **kwargs)
+
+ inner.__name__ = func.__name__
+ inner.__doc__ = func.__doc__
+
+ return inner
+
+
+class Timeouts(object):
+
+ def __init__(self, session):
+ self.session = session
+
+ def _get(self, key=None):
+ timeouts = self.session.send_session_command("GET", "timeouts")
+ if key is not None:
+ return timeouts[key]
+ return timeouts
+
+ def _set(self, key, secs):
+ body = {key: secs * 1000}
+ self.session.send_session_command("POST", "timeouts", body)
+ return None
+
+ @property
+ def script(self):
+ return self._get("script")
+
+ @script.setter
+ def script(self, secs):
+ return self._set("script", secs)
+
+ @property
+ def page_load(self):
+ return self._get("pageLoad")
+
+ @page_load.setter
+ def page_load(self, secs):
+ return self._set("pageLoad", secs)
+
+ @property
+ def implicit(self):
+ return self._get("implicit")
+
+ @implicit.setter
+ def implicit(self, secs):
+ return self._set("implicit", secs)
+
+ def __str__(self):
+ name = "%s.%s" % (self.__module__, self.__class__.__name__)
+ return "<%s script=%d, load=%d, implicit=%d>" % \
+ (name, self.script, self.page_load, self.implicit)
+
+
+class ActionSequence(object):
+ """API for creating and performing action sequences.
+
+ Each action method adds one or more actions to a queue. When perform()
+ is called, the queued actions fire in order.
+
+ May be chained together as in::
+
+ ActionSequence(session, "key", id) \
+ .key_down("a") \
+ .key_up("a") \
+ .perform()
+ """
+ def __init__(self, session, action_type, input_id, pointer_params=None):
+ """Represents a sequence of actions of one type for one input source.
+
+ :param session: WebDriver session.
+ :param action_type: Action type; may be "none", "key", or "pointer".
+ :param input_id: ID of input source.
+ :param pointer_params: Optional dictionary of pointer parameters.
+ """
+ self.session = session
+ self._id = input_id
+ self._type = action_type
+ self._actions = []
+ self._pointer_params = pointer_params
+
+ @property
+ def dict(self):
+ d = {
+ "type": self._type,
+ "id": self._id,
+ "actions": self._actions,
+ }
+ if self._pointer_params is not None:
+ d["parameters"] = self._pointer_params
+ return d
+
+ @command
+ def perform(self):
+ """Perform all queued actions."""
+ self.session.actions.perform([self.dict])
+
+ def _key_action(self, subtype, value):
+ self._actions.append({"type": subtype, "value": value})
+
+ def _pointer_action(self, subtype, button):
+ self._actions.append({"type": subtype, "button": button})
+
+ def pause(self, duration):
+ self._actions.append({"type": "pause", "duration": duration})
+ return self
+
+ def pointer_move(self, x, y, duration=None, origin=None):
+ """Queue a pointerMove action.
+
+ :param x: Destination x-axis coordinate of pointer in CSS pixels.
+ :param y: Destination y-axis coordinate of pointer in CSS pixels.
+ :param duration: Number of milliseconds over which to distribute the
+ move. If None, remote end defaults to 0.
+ :param origin: Origin of coordinates, either "viewport", "pointer" or
+ an Element. If None, remote end defaults to "viewport".
+ """
+ action = {
+ "type": "pointerMove",
+ "x": x,
+ "y": y
+ }
+ if duration is not None:
+ action["duration"] = duration
+ if origin is not None:
+ action["origin"] = origin
+ self._actions.append(action)
+ return self
+
+ def pointer_up(self, button=0):
+ """Queue a pointerUp action for `button`.
+
+ :param button: Pointer button to perform action with.
+ Default: 0, which represents main device button.
+ """
+ self._pointer_action("pointerUp", button)
+ return self
+
+ def pointer_down(self, button=0):
+ """Queue a pointerDown action for `button`.
+
+ :param button: Pointer button to perform action with.
+ Default: 0, which represents main device button.
+ """
+ self._pointer_action("pointerDown", button)
+ return self
+
+ def click(self, element=None, button=0):
+ """Queue a click with the specified button.
+
+ If an element is given, move the pointer to that element first,
+ otherwise click current pointer coordinates.
+
+ :param element: Optional element to click.
+ :param button: Integer representing pointer button to perform action
+ with. Default: 0, which represents main device button.
+ """
+ if element:
+ self.pointer_move(0, 0, origin=element)
+ return self.pointer_down(button).pointer_up(button)
+
+ def key_up(self, value):
+ """Queue a keyUp action for `value`.
+
+ :param value: Character to perform key action with.
+ """
+ self._key_action("keyUp", value)
+ return self
+
+ def key_down(self, value):
+ """Queue a keyDown action for `value`.
+
+ :param value: Character to perform key action with.
+ """
+ self._key_action("keyDown", value)
+ return self
+
+ def send_keys(self, keys):
+ """Queue a keyDown and keyUp action for each character in `keys`.
+
+ :param keys: String of keys to perform key actions with.
+ """
+ for c in keys:
+ self.key_down(c)
+ self.key_up(c)
+ return self
+
+
+class Actions(object):
+ def __init__(self, session):
+ self.session = session
+
+ @command
+ def perform(self, actions=None):
+ """Performs actions by tick from each action sequence in `actions`.
+
+ :param actions: List of input source action sequences. A single action
+ sequence may be created with the help of
+ ``ActionSequence.dict``.
+ """
+ body = {"actions": [] if actions is None else actions}
+ return self.session.send_session_command("POST", "actions", body)
+
+ @command
+ def release(self):
+ return self.session.send_session_command("DELETE", "actions")
+
+ def sequence(self, *args, **kwargs):
+ """Return an empty ActionSequence of the designated type.
+
+ See ActionSequence for parameter list.
+ """
+ return ActionSequence(self.session, *args, **kwargs)
+
+
+class Window(object):
+ identifier = "window-fcc6-11e5-b4f8-330a88ab9d7f"
+
+ def __init__(self, session):
+ self.session = session
+
+ @property
+ @command
+ def rect(self):
+ return self.session.send_session_command("GET", "window/rect")
+
+ @property
+ @command
+ def size(self):
+ """Gets the window size as a tuple of `(width, height)`."""
+ rect = self.rect
+ return (rect["width"], rect["height"])
+
+ @size.setter
+ @command
+ def size(self, new_size):
+ """Set window size by passing a tuple of `(width, height)`."""
+ width, height = new_size
+ body = {"width": width, "height": height}
+ self.session.send_session_command("POST", "window/rect", body)
+
+ @property
+ @command
+ def position(self):
+ """Gets the window position as a tuple of `(x, y)`."""
+ rect = self.rect
+ return (rect["x"], rect["y"])
+
+ @position.setter
+ @command
+ def position(self, new_position):
+ """Set window position by passing a tuple of `(x, y)`."""
+ x, y = new_position
+ body = {"x": x, "y": y}
+ self.session.send_session_command("POST", "window/rect", body)
+
+ @command
+ def maximize(self):
+ return self.session.send_session_command("POST", "window/maximize")
+
+ @command
+ def minimize(self):
+ return self.session.send_session_command("POST", "window/minimize")
+
+ @command
+ def fullscreen(self):
+ return self.session.send_session_command("POST", "window/fullscreen")
+
+ @classmethod
+ def from_json(cls, json, session):
+ uuid = json[Window.identifier]
+ return cls(uuid, session)
+
+
+class Frame(object):
+ identifier = "frame-075b-4da1-b6ba-e579c2d3230a"
+
+ def __init__(self, session):
+ self.session = session
+
+ @classmethod
+ def from_json(cls, json, session):
+ uuid = json[Frame.identifier]
+ return cls(uuid, session)
+
+
+class Find(object):
+ def __init__(self, session):
+ self.session = session
+
+ @command
+ def css(self, selector, all=True):
+ return self._find_element("css selector", selector, all)
+
+ def _find_element(self, strategy, selector, all):
+ route = "elements" if all else "element"
+ body = {"using": strategy,
+ "value": selector}
+ return self.session.send_session_command("POST", route, body)
+
+
+class Cookies(object):
+ def __init__(self, session):
+ self.session = session
+
+ def __getitem__(self, name):
+ self.session.send_session_command("GET", "cookie/%s" % name, {})
+
+ def __setitem__(self, name, value):
+ cookie = {"name": name,
+ "value": None}
+
+ if isinstance(name, string_types):
+ cookie["value"] = value
+ elif hasattr(value, "value"):
+ cookie["value"] = value.value
+ self.session.send_session_command("POST", "cookie/%s" % name, {})
+
+
+class UserPrompt(object):
+ def __init__(self, session):
+ self.session = session
+
+ @command
+ def dismiss(self):
+ self.session.send_session_command("POST", "alert/dismiss")
+
+ @command
+ def accept(self):
+ self.session.send_session_command("POST", "alert/accept")
+
+ @property
+ @command
+ def text(self):
+ return self.session.send_session_command("GET", "alert/text")
+
+ @text.setter
+ @command
+ def text(self, value):
+ body = {"value": list(value)}
+ self.session.send_session_command("POST", "alert/text", body=body)
+
+
+class Session(object):
+ def __init__(self,
+ host,
+ port,
+ url_prefix="/",
+ capabilities=None,
+ timeout=None,
+ extension=None):
+ self.transport = transport.HTTPWireProtocol(
+ host, port, url_prefix, timeout=timeout)
+ self.requested_capabilities = capabilities
+ self.capabilities = None
+ self.session_id = None
+ self.timeouts = None
+ self.window = None
+ self.find = None
+ self.extension = None
+ self.extension_cls = extension
+
+ self.timeouts = Timeouts(self)
+ self.window = Window(self)
+ self.find = Find(self)
+ self.alert = UserPrompt(self)
+ self.actions = Actions(self)
+
+ def __repr__(self):
+ return "<%s %s>" % (self.__class__.__name__, self.session_id or "(disconnected)")
+
+ def __eq__(self, other):
+ return (self.session_id is not None and isinstance(other, Session) and
+ self.session_id == other.session_id)
+
+ def __enter__(self):
+ self.start()
+ return self
+
+ def __exit__(self, *args, **kwargs):
+ self.end()
+
+ def __del__(self):
+ self.end()
+
+ def start(self):
+ """Start a new WebDriver session.
+
+ :return: Dictionary with `capabilities` and `sessionId`.
+
+ :raises error.WebDriverException: If the remote end returns
+ an error.
+ """
+ if self.session_id is not None:
+ return
+
+ body = {}
+
+ if self.requested_capabilities is not None:
+ body["capabilities"] = self.requested_capabilities
+
+ value = self.send_command("POST", "session", body=body)
+ self.session_id = value["sessionId"]
+ self.capabilities = value["capabilities"]
+
+ if self.extension_cls:
+ self.extension = self.extension_cls(self)
+
+ return value
+
+ def end(self):
+ """Try to close the active session."""
+ if self.session_id is None:
+ return
+
+ try:
+ self.send_command("DELETE", "session/%s" % self.session_id)
+ except error.InvalidSessionIdException:
+ pass
+ finally:
+ self.session_id = None
+
+ def send_command(self, method, url, body=None):
+ """
+ Send a command to the remote end and validate its success.
+
+ :param method: HTTP method to use in request.
+ :param uri: "Command part" of the HTTP request URL,
+ e.g. `window/rect`.
+ :param body: Optional body of the HTTP request.
+
+ :return: `None` if the HTTP response body was empty, otherwise
+ the `value` field returned after parsing the response
+ body as JSON.
+
+ :raises error.WebDriverException: If the remote end returns
+ an error.
+ :raises ValueError: If the response body does not contain a
+ `value` key.
+ """
+ response = self.transport.send(
+ method, url, body,
+ encoder=protocol.Encoder, decoder=protocol.Decoder,
+ session=self)
+
+ if response.status != 200:
+ err = error.from_response(response)
+
+ if isinstance(err, error.InvalidSessionIdException):
+ # The driver could have already been deleted the session.
+ self.session_id = None
+
+ raise err
+
+ if "value" in response.body:
+ value = response.body["value"]
+ """
+ Edge does not yet return the w3c session ID.
+ We want the tests to run in Edge anyway to help with REC.
+ In order to run the tests in Edge, we need to hack around
+ bug:
+ https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14641972
+ """
+ if url == "session" and method == "POST" and "sessionId" in response.body and "sessionId" not in value:
+ value["sessionId"] = response.body["sessionId"]
+ else:
+ raise ValueError("Expected 'value' key in response body:\n"
+ "%s" % response)
+
+ return value
+
+ def send_session_command(self, method, uri, body=None):
+ """
+ Send a command to an established session and validate its success.
+
+ :param method: HTTP method to use in request.
+ :param url: "Command part" of the HTTP request URL,
+ e.g. `window/rect`.
+ :param body: Optional body of the HTTP request. Must be JSON
+ serialisable.
+
+ :return: `None` if the HTTP response body was empty, otherwise
+ the result of parsing the body as JSON.
+
+ :raises error.WebDriverException: If the remote end returns
+ an error.
+ """
+ url = urlparse.urljoin("session/%s/" % self.session_id, uri)
+ return self.send_command(method, url, body)
+
+ @property
+ @command
+ def url(self):
+ return self.send_session_command("GET", "url")
+
+ @url.setter
+ @command
+ def url(self, url):
+ if urlparse.urlsplit(url).netloc is None:
+ return self.url(url)
+ body = {"url": url}
+ return self.send_session_command("POST", "url", body)
+
+ @command
+ def back(self):
+ return self.send_session_command("POST", "back")
+
+ @command
+ def forward(self):
+ return self.send_session_command("POST", "forward")
+
+ @command
+ def refresh(self):
+ return self.send_session_command("POST", "refresh")
+
+ @property
+ @command
+ def title(self):
+ return self.send_session_command("GET", "title")
+
+ @property
+ @command
+ def source(self):
+ return self.send_session_command("GET", "source")
+
+ @property
+ @command
+ def window_handle(self):
+ return self.send_session_command("GET", "window")
+
+ @window_handle.setter
+ @command
+ def window_handle(self, handle):
+ body = {"handle": handle}
+ return self.send_session_command("POST", "window", body=body)
+
+ def switch_frame(self, frame):
+ if frame == "parent":
+ url = "frame/parent"
+ body = None
+ else:
+ url = "frame"
+ body = {"id": frame}
+
+ return self.send_session_command("POST", url, body)
+
+ @command
+ def close(self):
+ handles = self.send_session_command("DELETE", "window")
+ if handles is not None and len(handles) == 0:
+ # With no more open top-level browsing contexts, the session is closed.
+ self.session_id = None
+
+ return handles
+
+ @property
+ @command
+ def handles(self):
+ return self.send_session_command("GET", "window/handles")
+
+ @property
+ @command
+ def active_element(self):
+ return self.send_session_command("GET", "element/active")
+
+ @command
+ def cookies(self, name=None):
+ if name is None:
+ url = "cookie"
+ else:
+ url = "cookie/%s" % name
+ return self.send_session_command("GET", url, {})
+
+ @command
+ def set_cookie(self, name, value, path=None, domain=None,
+ secure=None, expiry=None, http_only=None):
+ body = {
+ "name": name,
+ "value": value,
+ }
+
+ if domain is not None:
+ body["domain"] = domain
+ if expiry is not None:
+ body["expiry"] = expiry
+ if http_only is not None:
+ body["httpOnly"] = http_only
+ if path is not None:
+ body["path"] = path
+ if secure is not None:
+ body["secure"] = secure
+ self.send_session_command("POST", "cookie", {"cookie": body})
+
+ def delete_cookie(self, name=None):
+ if name is None:
+ url = "cookie"
+ else:
+ url = "cookie/%s" % name
+ self.send_session_command("DELETE", url, {})
+
+ #[...]
+
+ @command
+ def execute_script(self, script, args=None):
+ if args is None:
+ args = []
+
+ body = {
+ "script": script,
+ "args": args
+ }
+ return self.send_session_command("POST", "execute/sync", body)
+
+ @command
+ def execute_async_script(self, script, args=None):
+ if args is None:
+ args = []
+
+ body = {
+ "script": script,
+ "args": args
+ }
+ return self.send_session_command("POST", "execute/async", body)
+
+ #[...]
+
+ @command
+ def screenshot(self):
+ return self.send_session_command("GET", "screenshot")
+
+
+class Element(object):
+ """
+ Representation of a web element.
+
+ A web element is an abstraction used to identify an element when
+ it is transported via the protocol, between remote- and local ends.
+ """
+ identifier = "element-6066-11e4-a52e-4f735466cecf"
+
+ def __init__(self, id, session):
+ """
+ Construct a new web element representation.
+
+ :param id: Web element UUID which must be unique across
+ all browsing contexts.
+ :param session: Current ``webdriver.Session``.
+ """
+ self.id = id
+ self.session = session
+
+ def __repr__(self):
+ return "<%s %s>" % (self.__class__.__name__, self.id)
+
+ def __eq__(self, other):
+ return (isinstance(other, Element) and self.id == other.id and
+ self.session == other.session)
+
+ @classmethod
+ def from_json(cls, json, session):
+ uuid = json[Element.identifier]
+ return cls(uuid, session)
+
+ def send_element_command(self, method, uri, body=None):
+ url = "element/%s/%s" % (self.id, uri)
+ return self.session.send_session_command(method, url, body)
+
+ @command
+ def find_element(self, strategy, selector):
+ body = {"using": strategy,
+ "value": selector}
+ return self.send_element_command("POST", "element", body)
+
+ @command
+ def click(self):
+ self.send_element_command("POST", "click", {})
+
+ @command
+ def tap(self):
+ self.send_element_command("POST", "tap", {})
+
+ @command
+ def clear(self):
+ self.send_element_command("POST", "clear", {})
+
+ @command
+ def send_keys(self, text):
+ return self.send_element_command("POST", "value", {"text": text})
+
+ @property
+ @command
+ def text(self):
+ return self.send_element_command("GET", "text")
+
+ @property
+ @command
+ def name(self):
+ return self.send_element_command("GET", "name")
+
+ @command
+ def style(self, property_name):
+ return self.send_element_command("GET", "css/%s" % property_name)
+
+ @property
+ @command
+ def rect(self):
+ return self.send_element_command("GET", "rect")
+
+ @property
+ @command
+ def selected(self):
+ return self.send_element_command("GET", "selected")
+
+ @command
+ def attribute(self, name):
+ return self.send_element_command("GET", "attribute/%s" % name)
+
+ # This MUST come last because otherwise @property decorators above
+ # will be overridden by this.
+ @command
+ def property(self, name):
+ return self.send_element_command("GET", "property/%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
new file mode 100644
index 00000000000..23ffc40b31f
--- /dev/null
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/error.py
@@ -0,0 +1,210 @@
+import collections
+import json
+
+
+class WebDriverException(Exception):
+ http_status = None
+ status_code = None
+
+ def __init__(self, http_status=None, status_code=None, message=None, stacktrace=None):
+ super(WebDriverException, self)
+ self.http_status = http_status
+ self.status_code = status_code
+ self.message = message
+ self.stacktrace = stacktrace
+
+ def __repr__(self):
+ return "<%s http_status=%s>" % (self.__class__.__name__, self.http_status)
+
+ def __str__(self):
+ message = "%s (%s)" % (self.status_code, self.http_status)
+
+ if self.message is not None:
+ message += ": %s" % self.message
+ message += "\n"
+
+ if self.stacktrace:
+ message += ("\nRemote-end stacktrace:\n\n%s" % self.stacktrace)
+
+ return message
+
+
+class ElementClickInterceptedException(WebDriverException):
+ http_status = 400
+ status_code = "element click intercepted"
+
+
+class ElementNotSelectableException(WebDriverException):
+ http_status = 400
+ status_code = "element not selectable"
+
+
+class ElementNotVisibleException(WebDriverException):
+ http_status = 400
+ status_code = "element not visible"
+
+
+class InsecureCertificateException(WebDriverException):
+ http_status = 400
+ status_code = "insecure certificate"
+
+
+class InvalidArgumentException(WebDriverException):
+ http_status = 400
+ status_code = "invalid argument"
+
+
+class InvalidCookieDomainException(WebDriverException):
+ http_status = 400
+ status_code = "invalid cookie domain"
+
+
+class InvalidElementCoordinatesException(WebDriverException):
+ http_status = 400
+ status_code = "invalid element coordinates"
+
+
+class InvalidElementStateException(WebDriverException):
+ http_status = 400
+ status_code = "invalid element state"
+
+
+class InvalidSelectorException(WebDriverException):
+ http_status = 400
+ status_code = "invalid selector"
+
+
+class InvalidSessionIdException(WebDriverException):
+ http_status = 404
+ status_code = "invalid session id"
+
+
+class JavascriptErrorException(WebDriverException):
+ http_status = 500
+ status_code = "javascript error"
+
+
+class MoveTargetOutOfBoundsException(WebDriverException):
+ http_status = 500
+ status_code = "move target out of bounds"
+
+
+class NoSuchAlertException(WebDriverException):
+ http_status = 404
+ status_code = "no such alert"
+
+
+class NoSuchCookieException(WebDriverException):
+ http_status = 404
+ status_code = "no such cookie"
+
+
+class NoSuchElementException(WebDriverException):
+ http_status = 404
+ status_code = "no such element"
+
+
+class NoSuchFrameException(WebDriverException):
+ http_status = 404
+ status_code = "no such frame"
+
+
+class NoSuchWindowException(WebDriverException):
+ http_status = 404
+ status_code = "no such window"
+
+
+class ScriptTimeoutException(WebDriverException):
+ http_status = 500
+ status_code = "script timeout"
+
+
+class SessionNotCreatedException(WebDriverException):
+ http_status = 500
+ status_code = "session not created"
+
+
+class StaleElementReferenceException(WebDriverException):
+ http_status = 404
+ status_code = "stale element reference"
+
+
+class TimeoutException(WebDriverException):
+ http_status = 500
+ status_code = "timeout"
+
+
+class UnableToSetCookieException(WebDriverException):
+ http_status = 500
+ status_code = "unable to set cookie"
+
+
+class UnexpectedAlertOpenException(WebDriverException):
+ http_status = 500
+ status_code = "unexpected alert open"
+
+
+class UnknownErrorException(WebDriverException):
+ http_status = 500
+ status_code = "unknown error"
+
+
+class UnknownCommandException(WebDriverException):
+ http_status = 404
+ status_code = "unknown command"
+
+
+class UnknownMethodException(WebDriverException):
+ http_status = 405
+ status_code = "unknown method"
+
+
+class UnsupportedOperationException(WebDriverException):
+ http_status = 500
+ status_code = "unsupported operation"
+
+
+def from_response(response):
+ """
+ Unmarshals an error from a ``Response``'s `body`, failing
+ if not all three required `error`, `message`, and `stacktrace`
+ fields are given. Defaults to ``WebDriverException`` if `error`
+ is unknown.
+ """
+ if response.status == 200:
+ raise UnknownErrorException(
+ response.status,
+ None,
+ "Response is not an error:\n"
+ "%s" % json.dumps(response.body))
+
+ if "value" in response.body:
+ value = response.body["value"]
+ else:
+ raise UnknownErrorException(
+ response.status,
+ None,
+ "Expected 'value' key in response body:\n"
+ "%s" % json.dumps(response.body))
+
+ # all fields must exist, but stacktrace can be an empty string
+ code = value["error"]
+ message = value["message"]
+ stack = value["stacktrace"] or None
+
+ cls = get(code)
+ return cls(response.status, code, message, stacktrace=stack)
+
+
+def get(error_code):
+ """
+ Gets exception from `error_code`, falling back to
+ ``WebDriverException`` if it is not found.
+ """
+ return _errors.get(error_code, WebDriverException)
+
+
+_errors = collections.defaultdict()
+for item in locals().values():
+ 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/protocol.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/protocol.py
new file mode 100644
index 00000000000..18a3d52c8a3
--- /dev/null
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/protocol.py
@@ -0,0 +1,43 @@
+import json
+
+import webdriver
+
+
+"""WebDriver wire protocol codecs."""
+
+
+class Encoder(json.JSONEncoder):
+ def __init__(self, *args, **kwargs):
+ kwargs.pop("session")
+ super(Encoder, self).__init__(*args, **kwargs)
+
+ def default(self, obj):
+ if isinstance(obj, (list, tuple)):
+ return [self.default(x) for x in obj]
+ elif isinstance(obj, webdriver.Element):
+ return {webdriver.Element.identifier: obj.id}
+ elif isinstance(obj, webdriver.Frame):
+ return {webdriver.Frame.identifier: obj.id}
+ elif isinstance(obj, webdriver.Window):
+ return {webdriver.Frame.identifier: obj.id}
+ return super(Encoder, self).default(obj)
+
+
+class Decoder(json.JSONDecoder):
+ def __init__(self, *args, **kwargs):
+ self.session = kwargs.pop("session")
+ super(Decoder, self).__init__(
+ object_hook=self.object_hook, *args, **kwargs)
+
+ def object_hook(self, payload):
+ if isinstance(payload, (list, tuple)):
+ return [self.object_hook(x) for x in payload]
+ elif isinstance(payload, dict) and webdriver.Element.identifier in payload:
+ return webdriver.Element.from_json(payload, self.session)
+ elif isinstance(payload, dict) and webdriver.Frame.identifier in payload:
+ return webdriver.Frame.from_json(payload, self.session)
+ elif isinstance(payload, dict) and webdriver.Window.identifier in payload:
+ return webdriver.Window.from_json(payload, self.session)
+ elif isinstance(payload, dict):
+ return {k: self.object_hook(v) for k, v in payload.iteritems()}
+ return payload
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
new file mode 100644
index 00000000000..881002ad117
--- /dev/null
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/webdriver/webdriver/transport.py
@@ -0,0 +1,192 @@
+import httplib
+import json
+import select
+import urlparse
+
+import error
+
+from six import text_type
+
+"""Implements HTTP transport for the WebDriver wire protocol."""
+
+
+class Response(object):
+ """
+ Describes an HTTP response received from a remote end whose
+ body has been read and parsed as appropriate.
+ """
+
+ def __init__(self, status, body):
+ self.status = status
+ self.body = body
+
+ def __repr__(self):
+ cls_name = self.__class__.__name__
+ if self.error:
+ return "<%s status=%s error=%s>" % (cls_name, self.status, repr(self.error))
+ return "<% status=%s body=%s>" % (cls_name, self.status, json.dumps(self.body))
+
+ def __str__(self):
+ return json.dumps(self.body, indent=2)
+
+ @property
+ def error(self):
+ if self.status != 200:
+ return error.from_response(self)
+ return None
+
+ @classmethod
+ def from_http(cls, http_response, decoder=json.JSONDecoder, **kwargs):
+ try:
+ body = json.load(http_response, cls=decoder, **kwargs)
+ except ValueError:
+ raise ValueError("Failed to decode response body as JSON:\n" +
+ http_response.read())
+
+ return cls(http_response.status, body)
+
+
+class HTTPWireProtocol(object):
+ """
+ Transports messages (commands and responses) over the WebDriver
+ wire protocol.
+
+ Complex objects, such as ``webdriver.Element``, ``webdriver.Frame``,
+ and ``webdriver.Window`` are by default not marshaled to enable
+ use of `session.transport.send` in WPT tests::
+
+ session = webdriver.Session("127.0.0.1", 4444)
+ response = transport.send("GET", "element/active", None)
+ print response.body["value"]
+ # => {u'element-6066-11e4-a52e-4f735466cecf': u'<uuid>'}
+
+ Automatic marshaling is provided by ``webdriver.protocol.Encoder``
+ and ``webdriver.protocol.Decoder``, which can be passed in to
+ ``HTTPWireProtocol.send`` along with a reference to the current
+ ``webdriver.Session``::
+
+ session = webdriver.Session("127.0.0.1", 4444)
+ response = transport.send("GET", "element/active", None,
+ encoder=protocol.Encoder, decoder=protocol.Decoder,
+ session=session)
+ print response.body["value"]
+ # => webdriver.Element
+ """
+
+ def __init__(self, host, port, url_prefix="/", timeout=None):
+ """
+ Construct interface for communicating with the remote server.
+
+ :param url: URL of remote WebDriver server.
+ :param wait: Duration to wait for remote to appear.
+ """
+ self.host = host
+ self.port = port
+ self.url_prefix = url_prefix
+
+ self._conn = None
+ self._timeout = timeout
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ """Closes the current HTTP connection, if there is one."""
+ if self._conn:
+ self._conn.close()
+
+ @property
+ def connection(self):
+ """Gets the current HTTP connection, or lazily creates one."""
+ if not self._conn:
+ conn_kwargs = {}
+ if self._timeout is not None:
+ conn_kwargs["timeout"] = self._timeout
+
+ self._conn = httplib.HTTPConnection(
+ self.host, self.port, strict=True, **conn_kwargs)
+
+ return self._conn
+
+ def url(self, suffix):
+ """
+ From the relative path to a command end-point,
+ craft a full URL suitable to be used in a request to the HTTPD.
+ """
+ return urlparse.urljoin(self.url_prefix, suffix)
+
+ def send(self,
+ method,
+ uri,
+ body=None,
+ headers=None,
+ encoder=json.JSONEncoder,
+ decoder=json.JSONDecoder,
+ **codec_kwargs):
+ """
+ Send a command to the remote.
+
+ The request `body` must be JSON serialisable unless a
+ custom `encoder` has been provided. This means complex
+ objects such as ``webdriver.Element``, ``webdriver.Frame``,
+ and `webdriver.Window`` are not automatically made
+ into JSON. This behaviour is, however, provided by
+ ``webdriver.protocol.Encoder``, should you want it.
+
+ Similarly, the response body is returned au natural
+ as plain JSON unless a `decoder` that converts web
+ element references to ``webdriver.Element`` is provided.
+ Use ``webdriver.protocol.Decoder`` to achieve this behaviour.
+
+ The client will attempt to use persistent HTTP connections.
+
+ :param method: `GET`, `POST`, or `DELETE`.
+ :param uri: Relative endpoint of the requests URL path.
+ :param body: Body of the request. Defaults to an empty
+ dictionary if ``method`` is `POST`.
+ :param headers: Additional dictionary of headers to include
+ in the request.
+ :param encoder: JSON encoder class, which defaults to
+ ``json.JSONEncoder`` unless specified.
+ :param decoder: JSON decoder class, which defaults to
+ ``json.JSONDecoder`` unless specified.
+ :param codec_kwargs: Surplus arguments passed on to `encoder`
+ and `decoder` on construction.
+
+ :return: Instance of ``webdriver.transport.Response``
+ describing the HTTP response received from the remote end.
+
+ :raises ValueError: If `body` or the response body are not
+ JSON serialisable.
+ """
+ if body is None and method == "POST":
+ body = {}
+
+ payload = None
+ if body is not None:
+ try:
+ payload = json.dumps(body, cls=encoder, **codec_kwargs)
+ except ValueError:
+ raise ValueError("Failed to encode request body as JSON:\n"
+ "%s" % json.dumps(body, indent=2))
+
+ response = self._request(method, uri, payload, headers)
+ return Response.from_http(response, decoder=decoder, **codec_kwargs)
+
+ def _request(self, method, uri, payload, headers=None):
+ if isinstance(payload, text_type):
+ payload = payload.encode("utf-8")
+
+ if headers is None:
+ headers = {}
+ headers.update({"Connection": "keep-alive"})
+
+ url = self.url(uri)
+
+ if self._has_unread_data():
+ self.close()
+ self.connection.request(method, url, payload, headers)
+ return self.connection.getresponse()
+
+ def _has_unread_data(self):
+ return self._conn and select.select([self._conn.sock], [], [], 0)[0]
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 51f0dbdba92..71d1e61918a 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
@@ -1,4 +1,3 @@
-import logging
import os
import platform
import re
@@ -12,14 +11,15 @@ from distutils.spawn import find_executable
from utils import call, get, untar, unzip
-logger = logging.getLogger(__name__)
-
uname = platform.uname()
class Browser(object):
__metaclass__ = ABCMeta
+ def __init__(self, logger):
+ self.logger = logger
+
@abstractmethod
def install(self, dest=None):
"""Install the browser."""
@@ -46,7 +46,7 @@ class Browser(object):
return NotImplemented
@abstractmethod
- def version(self, binary=None):
+ def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
return NotImplemented
@@ -67,22 +67,28 @@ class Firefox(Browser):
platform_ini = "browsers/firefox/platform.ini"
requirements = "requirements_firefox.txt"
- def platform_string_geckodriver(self):
- platform = {
- "Linux": "linux",
- "Windows": "win",
- "Darwin": "macos"
- }.get(uname[0])
+ platform = {
+ "Linux": "linux",
+ "Windows": "win",
+ "Darwin": "macos"
+ }.get(uname[0])
- if platform is None:
+ application_name = {
+ "stable": "Firefox.app",
+ "beta": "Firefox.app",
+ "nightly": "Firefox Nightly.app"
+ }
+
+ def platform_string_geckodriver(self):
+ if self.platform is None:
raise ValueError("Unable to construct a valid Geckodriver package name for current platform")
- if platform in ("linux", "win"):
+ if self.platform in ("linux", "win"):
bits = "64" if uname[4] == "x86_64" else "32"
else:
bits = ""
- return "%s%s" % (platform, bits)
+ return "%s%s" % (self.platform, bits)
def install(self, dest=None, channel="nightly"):
"""Install Firefox."""
@@ -102,24 +108,14 @@ class Firefox(Browser):
"beta": "latest-beta",
"nightly": "latest"
}
- application_name = {
- "stable": "Firefox.app",
- "beta": "Firefox.app",
- "nightly": "Firefox Nightly.app"
- }
+
if channel not in branch:
raise ValueError("Unrecognised release channel: %s" % channel)
from mozdownload import FactoryScraper
import mozinstall
- platform = {
- "Linux": "linux",
- "Windows": "win",
- "Darwin": "mac"
- }.get(uname[0])
-
- if platform is None:
+ if self.platform is None:
raise ValueError("Unable to construct a valid Firefox package name for current platform")
if dest is None:
@@ -128,18 +124,22 @@ class Firefox(Browser):
dest = os.path.join(dest, "browsers", channel)
- filename = FactoryScraper(scraper[channel],
- branch=branch[channel],
- version=version[channel],
- destination=dest).download()
+ scraper = FactoryScraper(scraper[channel],
+ branch=branch[channel],
+ version=version[channel],
+ destination=dest)
+
+ self.logger.info("Downloading Firefox from %s" % scraper.url)
+
+ filename = scraper.download()
try:
mozinstall.install(filename, dest)
except mozinstall.mozinstall.InstallError:
- if platform == "mac" and os.path.exists(os.path.join(dest, application_name[channel])):
+ if self.platform == "macos" and os.path.exists(os.path.join(dest, self.application_name.get(channel, "Firefox Nightly.app"))):
# mozinstall will fail if nightly is already installed in the venv because
# mac installation uses shutil.copy_tree
- mozinstall.uninstall(os.path.join(dest, application_name[channel]))
+ mozinstall.uninstall(os.path.join(dest, self.application_name.get(channel, "Firefox Nightly.app")))
mozinstall.install(filename, dest)
else:
raise
@@ -150,46 +150,31 @@ class Firefox(Browser):
def find_binary_path(self,path=None, channel="nightly"):
"""Looks for the firefox binary in the virtual environment"""
- platform = {
- "Linux": "linux",
- "Windows": "win",
- "Darwin": "mac"
- }.get(uname[0])
-
- application_name = {
- "stable": "Firefox.app",
- "beta": "Firefox.app",
- "nightly": "Firefox Nightly.app"
- }.get(channel)
-
if path is None:
#os.getcwd() doesn't include the venv path
path = os.path.join(os.getcwd(), "_venv", "browsers", channel)
binary = None
- if platform == "linux":
+ if self.platform == "linux":
binary = find_executable("firefox", os.path.join(path, "firefox"))
- elif platform == "win":
+ elif self.platform == "win":
import mozinstall
binary = mozinstall.get_binary(path, "firefox")
- elif platform == "mac":
- binary = find_executable("firefox", os.path.join(path, application_name,
+ elif self.platform == "macos":
+ binary = find_executable("firefox", os.path.join(path, self.application_name.get(channel, "Firefox Nightly.app"),
"Contents", "MacOS"))
return binary
- def find_binary(self, venv_path=None, channel=None):
+ def find_binary(self, venv_path=None, channel="nightly"):
if venv_path is None:
venv_path = os.path.join(os.getcwd(), "_venv")
- if channel is None:
- channel = "nightly"
-
path = os.path.join(venv_path, "browsers", channel)
binary = self.find_binary_path(path, channel)
- if not binary and uname[0] == "Darwin":
+ if not binary and self.platform == "macos":
macpaths = ["/Applications/Firefox Nightly.app/Contents/MacOS",
os.path.expanduser("~/Applications/Firefox Nightly.app/Contents/MacOS"),
"/Applications/Firefox Developer Edition.app/Contents/MacOS",
@@ -256,13 +241,15 @@ class Firefox(Browser):
if channel is not None and channel != channel_:
# Beta doesn't always seem to have the b in the version string, so allow the
# manually supplied value to override the one from the binary
- logger.warning("Supplied channel doesn't match binary, using supplied channel")
+ self.logger.warning("Supplied channel doesn't match binary, using supplied channel")
elif channel is None:
channel = channel_
if dest is None:
dest = os.pwd
- dest = os.path.join(dest, "profiles", channel, version)
+ dest = os.path.join(dest, "profiles", channel)
+ if version:
+ dest = os.path.join(dest, version)
have_cache = False
if os.path.exists(dest):
if channel != "nightly":
@@ -280,7 +267,7 @@ class Firefox(Browser):
url = self.get_profile_bundle_url(version, channel)
- print("Installing test prefs from %s" % url)
+ self.logger.info("Installing test prefs from %s" % url)
try:
extract_dir = tempfile.mkdtemp()
unzip(get(url).raw, dest=extract_dir)
@@ -292,7 +279,7 @@ class Firefox(Browser):
finally:
shutil.rmtree(extract_dir)
else:
- print("Using cached test prefs from %s" % dest)
+ self.logger.info("Using cached test prefs from %s" % dest)
return dest
@@ -322,11 +309,11 @@ class Firefox(Browser):
if path is not None:
return path
else:
- logger.warning("Nightly webdriver not found; falling back to release")
+ self.logger.warning("Nightly webdriver not found; falling back to release")
version = self._latest_geckodriver_version()
format = "zip" if uname[0] == "Windows" else "tar.gz"
- logger.debug("Latest geckodriver release %s" % version)
+ self.logger.debug("Latest geckodriver release %s" % version)
url = ("https://github.com/mozilla/geckodriver/releases/download/%s/geckodriver-%s-%s.%s" %
(version, version, self.platform_string_geckodriver(), format))
if format == "zip":
@@ -338,7 +325,7 @@ class Firefox(Browser):
def install_geckodriver_nightly(self, dest):
import tarfile
import mozdownload
- logger.info("Attempting to install webdriver from nightly")
+ self.logger.info("Attempting to install webdriver from nightly")
try:
s = mozdownload.DailyScraper(branch="mozilla-central",
extension="common.tests.tar.gz",
@@ -359,15 +346,14 @@ class Firefox(Browser):
member.name = os.path.basename(member.name)
f.extractall(members=[member], path=dest)
path = os.path.join(dest, member.name)
- logger.info("Extracted geckodriver to %s" % path)
+ self.logger.info("Extracted geckodriver to %s" % path)
finally:
os.unlink(package_path)
return path
- def version(self, binary=None, channel=None):
+ def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
- binary = binary or self.find_binary(channel)
version_string = call(binary, "--version").strip()
m = re.match(r"Mozilla Firefox (.*)", version_string)
if not m:
@@ -393,7 +379,7 @@ class Fennec(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary=None):
+ def version(self, binary=None, webdriver_binary=None):
return None
@@ -413,7 +399,7 @@ class Chrome(Browser):
if uname[0] == "Darwin":
return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# TODO Windows?
- logger.warn("Unable to find the browser binary.")
+ self.logger.warning("Unable to find the browser binary.")
return None
def install(self, dest=None, channel=None):
@@ -457,20 +443,20 @@ class Chrome(Browser):
os.chmod(path, st.st_mode | stat.S_IEXEC)
return path
- def version(self, binary=None):
+ def version(self, binary=None, webdriver_binary=None):
binary = binary or self.binary
if uname[0] != "Windows":
try:
version_string = call(binary, "--version").strip()
except subprocess.CalledProcessError:
- logger.warn("Failed to call %s", binary)
+ self.logger.warning("Failed to call %s", binary)
return None
m = re.match(r"Google Chrome (.*)", version_string)
if not m:
- logger.warn("Failed to extract version from: s%", version_string)
+ self.logger.warning("Failed to extract version from: s%", version_string)
return None
return m.group(1)
- logger.warn("Unable to extract version from binary on Windows.")
+ self.logger.warning("Unable to extract version from binary on Windows.")
return None
@@ -496,7 +482,7 @@ class ChromeAndroid(Browser):
chrome = Chrome()
return chrome.install_webdriver(dest, channel)
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
return None
class Opera(Browser):
@@ -513,7 +499,7 @@ class Opera(Browser):
if uname[0] == "Linux":
return "/usr/bin/opera"
# TODO Windows, Mac?
- logger.warn("Unable to find the browser binary.")
+ self.logger.warning("Unable to find the browser binary.")
return None
def install(self, dest=None, channel=None):
@@ -561,15 +547,17 @@ class Opera(Browser):
os.chmod(path, st.st_mode | stat.S_IEXEC)
return path
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
binary = binary or self.binary
try:
output = call(binary, "--version")
except subprocess.CalledProcessError:
- logger.warn("Failed to call %s", binary)
+ self.logger.warning("Failed to call %s", binary)
return None
- return re.search(r"[0-9\.]+( [a-z]+)?$", output.strip()).group(0)
+ m = re.search(r"[0-9\.]+( [a-z]+)?$", output.strip())
+ if m:
+ return m.group(0)
class Edge(Browser):
@@ -590,7 +578,7 @@ class Edge(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
return None
@@ -616,7 +604,7 @@ class InternetExplorer(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
return None
@@ -644,12 +632,24 @@ class Safari(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
- return None
-
-
-class SafariWebDriver(Safari):
- product = "safari_webdriver"
+ def version(self, binary=None, webdriver_binary=None):
+ if webdriver_binary is None:
+ self.logger.warning("Cannot find Safari version without safaridriver")
+ return None
+ # Use `safaridriver --version` to get the version. Example output:
+ # "Included with Safari 12.1 (14607.1.11)"
+ # "Included with Safari Technology Preview (Release 67, 13607.1.9.0.1)"
+ # The `--version` flag was added in STP 67, so allow the call to fail.
+ try:
+ version_string = call(webdriver_binary, "--version").strip()
+ except subprocess.CalledProcessError:
+ self.logger.warning("Failed to call %s --version", webdriver_binary)
+ return None
+ m = re.match(r"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)
class Servo(Browser):
@@ -704,10 +704,16 @@ class Servo(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
"""Retrieve the release version of the installed browser."""
output = call(binary, "--version")
- return re.search(r"[0-9\.]+( [a-z]+)?$", output.strip()).group(0)
+ m = re.search(r"Servo ([0-9\.]+-[a-f0-9]+)?(-dirty)?$", output.strip())
+ if m:
+ return m.group(0)
+
+
+class ServoWebDriver(Servo):
+ product = "servodriver"
class Sauce(Browser):
@@ -728,7 +734,7 @@ class Sauce(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
return None
@@ -750,5 +756,5 @@ class WebKit(Browser):
def install_webdriver(self, dest=None, channel=None):
raise NotImplementedError
- def version(self, binary):
+ def version(self, binary=None, webdriver_binary=None):
return None
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/commands.json b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/commands.json
index 0ea6b25276f..161a9defbd1 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/commands.json
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/commands.json
@@ -1,6 +1,7 @@
{
"run": {"path": "run.py", "script": "run", "parser": "create_parser", "help": "Run tests in a browser",
"virtualenv": true, "install": ["requests"], "requirements": ["../wptrunner/requirements.txt"]},
+ "create": {"path": "create.py", "script": "run", "parser": "get_parser", "help": "Create a new wpt test"},
"update-expectations": {"path": "update.py", "script": "update_expectations",
"parser": "create_parser_update", "help": "Update expectations files from raw logs.",
"virtualenv": true, "install": ["requests"],
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 f588a412845..be6bf815986 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
@@ -7,7 +7,6 @@ latest_channels = {
'firefox': 'nightly',
'chrome': 'dev',
'safari': 'preview',
- 'safari_webdriver': 'preview',
'servo': 'nightly'
}
@@ -48,7 +47,7 @@ def get_parser():
def get_channel(browser, channel):
channel = channel_by_name[channel]
if isinstance(channel, dict):
- channel = channel[browser]
+ channel = channel.get(browser)
return channel
@@ -58,8 +57,8 @@ def run(venv, **kwargs):
channel = get_channel(browser, kwargs["channel"])
if channel != kwargs["channel"]:
- print "Interpreting channel '%s' as '%s'" % (kwargs["channel"],
- channel)
+ print("Interpreting channel '%s' as '%s'" % (kwargs["channel"],
+ channel))
if destination is None:
if venv:
@@ -74,7 +73,11 @@ def run(venv, **kwargs):
install(browser, kwargs["component"], destination, channel)
-def install(name, component, destination, channel="nightly"):
+def install(name, component, destination, channel="nightly", logger=None):
+ if logger is None:
+ import logging
+ logger = logging.getLogger("install")
+
if component == 'webdriver':
method = 'install_webdriver'
else:
@@ -82,6 +85,6 @@ def install(name, component, destination, channel="nightly"):
subclass = getattr(browser, name.title())
sys.stdout.write('Now installing %s %s...\n' % (name, component))
- path = getattr(subclass(), method)(dest=destination, channel=channel)
+ path = getattr(subclass(logger), method)(dest=destination, channel=channel)
if path:
sys.stdout.write('Binary installed as %s\n' % (path,))
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/markdown.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/markdown.py
index 8b5ff8079df..43020cdafe6 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/markdown.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/markdown.py
@@ -1,3 +1,5 @@
+from functools import reduce
+
def format_comment_title(product):
"""Produce a Markdown-formatted string based on a given "product"--a string
containing a browser identifier optionally followed by a colon and a
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 452b83f9df6..44cf3137d41 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
@@ -3,11 +3,12 @@ import os
import platform
import sys
from distutils.spawn import find_executable
+from six.moves import input
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
sys.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools")))
-from . import browser, install, utils, virtualenv
+from . import browser, install, testfiles, utils, virtualenv
from ..serve import serve
logger = None
@@ -44,6 +45,8 @@ def create_parser():
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("product", action="store",
help="Browser to run tests in")
+ parser.add_argument("--affected", action="store", default=None,
+ help="Run affected tests since revish")
parser.add_argument("--yes", "-y", dest="prompt", action="store_false", default=True,
help="Don't prompt before installing components")
parser.add_argument("--install-browser", action="store_true",
@@ -62,9 +65,12 @@ def create_parser():
return parser
-def exit(msg):
- logger.error(msg)
- sys.exit(1)
+def exit(msg=None):
+ if msg:
+ logger.error(msg)
+ sys.exit(1)
+ else:
+ sys.exit(0)
def args_general(kwargs):
@@ -145,7 +151,7 @@ class BrowserSetup(object):
browser_cls = None
def __init__(self, venv, prompt=True, sub_product=None):
- self.browser = self.browser_cls()
+ self.browser = self.browser_cls(logger)
self.venv = venv
self.prompt = prompt
self.sub_product = sub_product
@@ -154,7 +160,7 @@ class BrowserSetup(object):
if not self.prompt:
return True
while True:
- resp = raw_input("Download and install %s [Y/n]? " % component).strip().lower()
+ resp = input("Download and install %s [Y/n]? " % component).strip().lower()
if not resp or resp == "y":
return True
elif resp == "n":
@@ -178,6 +184,7 @@ class Firefox(BrowserSetup):
def setup_kwargs(self, kwargs):
if kwargs["binary"] is None:
if kwargs["browser_channel"] is None:
+ kwargs["browser_channel"] = "nightly"
logger.info("No browser channel specified. Running nightly instead.")
binary = self.browser.find_binary(self.venv.path,
@@ -196,7 +203,7 @@ Install Firefox or use --binary to set the binary path""")
logger.info("""Can't find certutil, certificates will not be checked.
Consider installing certutil via your OS package manager or directly.""")
else:
- print("Using certutil %s" % certutil)
+ logger.info("Using certutil %s" % certutil)
kwargs["certutil_binary"] = certutil
@@ -207,15 +214,15 @@ Consider installing certutil via your OS package manager or directly.""")
install = self.prompt_install("geckodriver")
if install:
- print("Downloading geckodriver")
+ logger.info("Downloading geckodriver")
webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path)
else:
- print("Using webdriver binary %s" % webdriver_binary)
+ logger.info("Using webdriver binary %s" % webdriver_binary)
if webdriver_binary:
kwargs["webdriver_binary"] = webdriver_binary
else:
- print("Unable to find or install geckodriver, skipping wdspec tests")
+ logger.info("Unable to find or install geckodriver, skipping wdspec tests")
kwargs["test_types"].remove("wdspec")
if kwargs["prefs_root"] is None:
@@ -228,6 +235,11 @@ Consider installing certutil via your OS package manager or directly.""")
kwargs["headless"] = True
logger.info("Running in headless mode, pass --no-headless to disable")
+ # Turn off Firefox WebRTC ICE logging on WPT (turned on by mozrunner)
+ os.unsetenv('R_LOG_LEVEL')
+ os.unsetenv('R_LOG_DESTINATION')
+ os.unsetenv('R_LOG_VERBOSE')
+
# Allow WebRTC tests to call getUserMedia.
kwargs["extra_prefs"].append("media.navigator.streams.fake=true")
@@ -252,10 +264,10 @@ class Chrome(BrowserSetup):
install = self.prompt_install("chromedriver")
if install:
- print("Downloading chromedriver")
+ logger.info("Downloading chromedriver")
webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path)
else:
- print("Using webdriver binary %s" % webdriver_binary)
+ logger.info("Using webdriver binary %s" % webdriver_binary)
if webdriver_binary:
kwargs["webdriver_binary"] = webdriver_binary
@@ -264,6 +276,11 @@ class Chrome(BrowserSetup):
if kwargs["browser_channel"] == "dev":
logger.info("Automatically turning on experimental features for Chrome Dev")
kwargs["binary_args"].append("--enable-experimental-web-platform-features")
+ # TODO(foolip): remove after unified plan is enabled on Chrome stable
+ kwargs["binary_args"].append("--enable-features=RTCUnifiedPlanByDefault")
+
+ # Allow audio autoplay without a user gesture.
+ kwargs["binary_args"].append("--autoplay-policy=no-user-gesture-required")
# Allow WebRTC tests to call getUserMedia.
kwargs["binary_args"] += ["--use-fake-ui-for-media-stream", "--use-fake-device-for-media-stream"]
@@ -281,10 +298,10 @@ class ChromeAndroid(BrowserSetup):
install = self.prompt_install("chromedriver")
if install:
- print("Downloading chromedriver")
+ logger.info("Downloading chromedriver")
webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path)
else:
- print("Using webdriver binary %s" % webdriver_binary)
+ logger.info("Using webdriver binary %s" % webdriver_binary)
if webdriver_binary:
kwargs["webdriver_binary"] = webdriver_binary
@@ -304,10 +321,10 @@ class Opera(BrowserSetup):
install = self.prompt_install("operadriver")
if install:
- print("Downloading operadriver")
+ logger.info("Downloading operadriver")
webdriver_binary = self.browser.install_webdriver(dest=self.venv.bin_path)
else:
- print("Using webdriver binary %s" % webdriver_binary)
+ logger.info("Using webdriver binary %s" % webdriver_binary)
if webdriver_binary:
kwargs["webdriver_binary"] = webdriver_binary
@@ -379,11 +396,6 @@ class Safari(BrowserSetup):
kwargs["webdriver_binary"] = webdriver_binary
-class SafariWebDriver(Safari):
- name = "safari_webdriver"
- browser_cls = browser.SafariWebDriver
-
-
class Sauce(BrowserSetup):
name = "sauce"
browser_cls = browser.Sauce
@@ -414,6 +426,11 @@ class Servo(BrowserSetup):
kwargs["binary"] = binary
+class ServoWebDriver(Servo):
+ name = "servodriver"
+ browser_cls = browser.ServoWebDriver
+
+
class WebKit(BrowserSetup):
name = "webkit"
browser_cls = browser.WebKit
@@ -434,34 +451,41 @@ product_setup = {
"edge_webdriver": EdgeWebDriver,
"ie": InternetExplorer,
"safari": Safari,
- "safari_webdriver": SafariWebDriver,
"servo": Servo,
+ "servodriver": ServoWebDriver,
"sauce": Sauce,
"opera": Opera,
"webkit": WebKit,
}
-def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
- from wptrunner import wptrunner, wptcommandline
+def setup_logging(kwargs, default_config=None):
import mozlog
+ from wptrunner import wptrunner
global logger
+ # Use the grouped formatter by default where mozlog 3.9+ is installed
+ if default_config is None:
+ if hasattr(mozlog.formatters, "GroupingFormatter"):
+ default_formatter = "grouped"
+ else:
+ default_formatter = "mach"
+ default_config = {default_formatter: sys.stdout}
+ wptrunner.setup_logging(kwargs, default_config)
+ logger = wptrunner.logger
+ return logger
+
+
+def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
+ from wptrunner import wptcommandline
+
kwargs = utils.Kwargs(kwargs.iteritems())
product_parts = kwargs["product"].split(":")
kwargs["product"] = product_parts[0]
sub_product = product_parts[1:]
- # Use the grouped formatter by default where mozlog 3.9+ is installed
- if hasattr(mozlog.formatters, "GroupingFormatter"):
- default_formatter = "grouped"
- else:
- default_formatter = "mach"
- wptrunner.setup_logging(kwargs, {default_formatter: sys.stdout})
- logger = wptrunner.logger
-
check_environ(kwargs["product"])
args_general(kwargs)
@@ -471,16 +495,38 @@ def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
setup_cls = product_setup[kwargs["product"]](venv, prompt, sub_product)
setup_cls.install_requirements()
+ affected_revish = kwargs.pop("affected", None)
+ if affected_revish is not None:
+ # TODO: Consolidate with `./wpt tests-affected --ignore-rules`:
+ # https://github.com/web-platform-tests/wpt/issues/14560
+ files_changed, _ = testfiles.files_changed(
+ affected_revish,
+ ignore_rules=["resources/testharness*"],
+ include_uncommitted=True, include_new=True)
+ # TODO: Perhaps use wptrunner.testloader.ManifestLoader here
+ # and remove the manifest-related code from testfiles.
+ # https://github.com/web-platform-tests/wpt/issues/14421
+ tests_changed, tests_affected = testfiles.affected_testfiles(
+ files_changed, manifest_path=kwargs.get("manifest_path"), manifest_update=kwargs["manifest_update"])
+ test_list = tests_changed | tests_affected
+ logger.info("Identified %s affected tests" % len(test_list))
+ test_list = [os.path.relpath(item, wpt_root) for item in test_list]
+ kwargs["test_list"] += test_list
+ kwargs["default_exclude"] = True
+
if install_browser and not kwargs["channel"]:
logger.info("--install-browser is given but --channel is not set, default to nightly channel")
kwargs["channel"] = "nightly"
if kwargs["channel"]:
channel = install.get_channel(kwargs["product"], kwargs["channel"])
- if channel != kwargs["channel"]:
- logger.info("Interpreting channel '%s' as '%s'" % (kwargs["channel"],
- channel))
- kwargs["browser_channel"] = channel
+ if channel is not None:
+ if channel != kwargs["channel"]:
+ logger.info("Interpreting channel '%s' as '%s'" % (kwargs["channel"],
+ channel))
+ kwargs["browser_channel"] = channel
+ else:
+ logger.info("Valid channels for %s not known; using argument unmodified" % kwargs["product"])
del kwargs["channel"]
if install_browser:
@@ -495,11 +541,14 @@ def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
venv.install_requirements(os.path.join(wptrunner_path, "requirements.txt"))
- kwargs['browser_version'] = setup_cls.browser.version(kwargs.get("binary"))
+ kwargs['browser_version'] = setup_cls.browser.version(binary=kwargs.get("binary"),
+ webdriver_binary=kwargs.get("webdriver_binary"))
return kwargs
def run(venv, **kwargs):
+ setup_logging(kwargs)
+
# Remove arguments that aren't passed to wptrunner
prompt = kwargs.pop("prompt", True)
install_browser = kwargs.pop("install_browser", False)
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 35a4b97d7ff..70e695aa010 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
@@ -8,8 +8,6 @@ import sys
from collections import OrderedDict
from six import iteritems
-from ..manifest import manifest, update
-
here = os.path.dirname(__file__)
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
@@ -162,9 +160,12 @@ def exclude_ignored(files, ignore_rules):
def files_changed(revish, ignore_rules=None, include_uncommitted=False, include_new=False):
- """Get and return files changed since current branch diverged from master,
- excluding those that are located within any path matched by
- `ignore_rules`."""
+ """Find files changed in certain revisions.
+
+ The function passes `revish` directly to `git diff`, so `revish` can have a
+ variety of forms; see `git diff --help` for details. Files in the diff that
+ are matched by `ignore_rules` are excluded.
+ """
files = repo_files_changed(revish,
include_uncommitted=include_uncommitted,
include_new=include_new)
@@ -180,36 +181,28 @@ def _in_repo_root(full_path):
return len(path_components) < 2
-def _init_manifest_cache():
- c = {}
-
- def load(manifest_path=None):
- if manifest_path is None:
- manifest_path = os.path.join(wpt_root, "MANIFEST.json")
- if c.get(manifest_path):
- return c[manifest_path]
- # cache at most one path:manifest
- c.clear()
- wpt_manifest = manifest.load(wpt_root, manifest_path)
- if wpt_manifest is None:
- wpt_manifest = manifest.Manifest()
- update.update(wpt_root, wpt_manifest)
- c[manifest_path] = wpt_manifest
- return c[manifest_path]
- return load
-
+def load_manifest(manifest_path=None, manifest_update=True):
+ # Delay import after localpaths sets up sys.path, because otherwise the
+ # import path will be "..manifest" and Python will treat it as a different
+ # manifest module.
+ from manifest import manifest
+ if manifest_path is None:
+ manifest_path = os.path.join(wpt_root, "MANIFEST.json")
+ return manifest.load_and_update(wpt_root, manifest_path, "/",
+ update=manifest_update)
-load_manifest = _init_manifest_cache()
-
-def affected_testfiles(files_changed, skip_tests, manifest_path=None):
+def affected_testfiles(files_changed, skip_dirs=None,
+ manifest_path=None, manifest_update=True):
"""Determine and return list of test files that reference changed files."""
+ if skip_dirs is None:
+ skip_dirs = set(["conformance-checkers", "docs", "tools"])
affected_testfiles = set()
# Exclude files that are in the repo root, because
# they are not part of any test.
files_changed = [f for f in files_changed if not _in_repo_root(f)]
nontests_changed = set(files_changed)
- wpt_manifest = load_manifest(manifest_path)
+ wpt_manifest = load_manifest(manifest_path, manifest_update)
test_types = ["testharness", "reftest", "wdspec"]
support_files = {os.path.join(wpt_root, path)
@@ -219,6 +212,11 @@ def affected_testfiles(files_changed, skip_tests, manifest_path=None):
test_files = {os.path.join(wpt_root, path)
for _, path, _ in wpt_manifest.itertypes(*test_types)}
+ interface_dir = os.path.join(wpt_root, 'interfaces')
+ interfaces_files = {os.path.join(wpt_root, 'interfaces', filename)
+ for filename in os.listdir(interface_dir)}
+
+ interfaces_changed = interfaces_files.intersection(nontests_changed)
nontests_changed = nontests_changed.intersection(support_files)
tests_changed = set(item for item in files_changed if item in test_files)
@@ -229,7 +227,7 @@ def affected_testfiles(files_changed, skip_tests, manifest_path=None):
rel_path = os.path.relpath(full_path, wpt_root)
path_components = rel_path.split(os.sep)
top_level_subdir = path_components[0]
- if top_level_subdir in skip_tests:
+ if top_level_subdir in skip_dirs:
continue
repo_path = "/" + os.path.relpath(full_path, wpt_root).replace(os.path.sep, "/")
if repo_path in rewrites:
@@ -237,6 +235,9 @@ def affected_testfiles(files_changed, skip_tests, manifest_path=None):
full_path = os.path.join(wpt_root, repo_path[1:].replace("/", os.path.sep))
nontest_changed_paths.add((full_path, repo_path))
+ interface_name = lambda x: os.path.splitext(os.path.basename(x))[0]
+ interfaces_changed_names = map(interface_name, interfaces_changed)
+
def affected_by_wdspec(test):
affected = False
if test in wdspec_test_files:
@@ -252,11 +253,20 @@ def affected_testfiles(files_changed, skip_tests, manifest_path=None):
break
return affected
+ def affected_by_interfaces(file_contents):
+ if len(interfaces_changed_names) > 0:
+ if 'idlharness.js' in file_contents:
+ for interface in interfaces_changed_names:
+ regex = '[\'"]' + interface + '(\\.idl)?[\'"]'
+ if re.search(regex, file_contents):
+ return True
+ return False
+
for root, dirs, fnames in os.walk(wpt_root):
# Walk top_level_subdir looking for test files containing either the
# relative filepath or absolute filepath to the changed files.
if root == wpt_root:
- for dir_name in skip_tests:
+ for dir_name in skip_dirs:
dirs.remove(dir_name)
for fname in fnames:
test_full_path = os.path.join(root, fname)
@@ -277,7 +287,7 @@ def affected_testfiles(files_changed, skip_tests, manifest_path=None):
file_contents = file_contents.decode("utf8", "replace")
for full_path, repo_path in nontest_changed_paths:
rel_path = os.path.relpath(full_path, root).replace(os.path.sep, "/")
- if rel_path in file_contents or repo_path in file_contents:
+ if rel_path in file_contents or repo_path in file_contents or affected_by_interfaces(file_contents):
affected_testfiles.add(test_full_path)
continue
@@ -288,6 +298,8 @@ def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument("revish", default=None, help="Commits to consider. Defaults to the "
"commits on the current branch", nargs="?")
+ # TODO: Consolidate with `./wpt run --affected`:
+ # https://github.com/web-platform-tests/wpt/issues/14560
parser.add_argument("--ignore-rules", nargs="*", type=set,
default=set(["resources/testharness*"]),
help="Rules for paths to exclude from lists of changes. Rules are paths "
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/utils.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/utils.py
index e8edc0be493..fa60230389d 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/utils.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/utils.py
@@ -1,7 +1,6 @@
import logging
import os
import subprocess
-import sys
import tarfile
import zipfile
from io import BytesIO
@@ -39,7 +38,7 @@ def call(*args):
Returns a bytestring of the subprocess output if no error.
"""
- logger.debug("%s" % " ".join(args))
+ logger.debug(" ".join(args))
try:
return subprocess.check_output(args)
except subprocess.CalledProcessError as e:
@@ -49,20 +48,6 @@ def call(*args):
raise
-def get_git_cmd(repo_path):
- """Create a function for invoking git commands as a subprocess."""
- def git(cmd, *args):
- full_cmd = ["git", cmd] + list(args)
- try:
- logger.debug(" ".join(full_cmd))
- return subprocess.check_output(full_cmd, cwd=repo_path, stderr=subprocess.STDOUT).strip()
- except subprocess.CalledProcessError as e:
- logger.error("Git command exited with status %i" % e.returncode)
- logger.error(e.output)
- sys.exit(1)
- return git
-
-
def seekable(fileobj):
"""Attempt to use file.seek on given file, with fallbacks."""
try:
@@ -94,21 +79,6 @@ def unzip(fileobj, dest=None, limit=None):
os.chmod(os.path.join(dest, info.filename), perm)
-class pwd(object):
- """Create context for temporarily changing present working directory."""
- def __init__(self, dir):
- self.dir = dir
- self.old_dir = None
-
- def __enter__(self):
- self.old_dir = os.path.abspath(os.curdir)
- os.chdir(self.dir)
-
- def __exit__(self, *args, **kwargs):
- os.chdir(self.old_dir)
- self.old_dir = None
-
-
def get(url):
"""Issue GET request to a given URL and return the response."""
import requests
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/virtualenv.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/virtualenv.py
index b8454c979c2..0ce7054ae22 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/virtualenv.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/virtualenv.py
@@ -39,7 +39,7 @@ class Virtualenv(object):
def activate(self):
path = os.path.join(self.bin_path, "activate_this.py")
- execfile(path, {"__file__": path})
+ execfile(path, {"__file__": path}) # noqa: F821
def start(self):
if not self.exists:
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 cb5435fdef4..aadcbb9b5a6 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
@@ -101,7 +101,7 @@ class ConfigBuilder(object):
The properties on the final configuration include those explicitly
supplied and computed properties. The computed properties are
- defined byt the computed_properites attribute on the class. This
+ defined by the computed_properties attribute on the class. This
is a list of property names, each corresponding to a _get_<name>
method on the class. These methods are called in the order defined
in computed_properties and are passed a single argument, a
@@ -126,7 +126,9 @@ class ConfigBuilder(object):
"openssl": {
"openssl_binary": "openssl",
"base_path": "_certs",
+ "password": "web-platform-tests",
"force_regenerate": False,
+ "duration": 30,
"base_conf_path": None
},
"pregenerated": {
@@ -316,7 +318,7 @@ class ConfigBuilder(object):
self._ssl_env.__enter__()
if self._ssl_env.ssl_enabled:
key_path, cert_path = self._ssl_env.host_cert_path(data["domains_set"])
- ca_cert_path = self._ssl_env.ca_cert_path()
+ ca_cert_path = self._ssl_env.ca_cert_path(data["domains_set"])
return {"key_path": key_path,
"ca_cert_path": ca_cert_path,
"cert_path": cert_path,
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 7fbe4234ea0..2dd01e29338 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
@@ -7,8 +7,6 @@ import traceback
from six.moves.urllib.parse import parse_qs, quote, unquote, urljoin
from six import iteritems
-from h2.events import RequestReceived, DataReceived
-
from .constants import content_types
from .pipes import Pipeline, template
from .ranges import RangeParser
@@ -79,7 +77,7 @@ class DirectoryHandler(object):
%(items)s
</ul>
""" % {"path": cgi.escape(url_path),
- "items": "\n".join(self.list_items(url_path, path))} # flake8: noqa
+ "items": "\n".join(self.list_items(url_path, path))} # noqa: E122
def list_items(self, base_path, path):
assert base_path.endswith("/")
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 cbae6d6fcb9..d1eb7245abd 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
@@ -329,7 +329,7 @@ def sub(request, response, escape_type="html"):
"html" and "none", with "html" the default for historic reasons.
The format is a very limited template language. Substitutions are
- enclosed by {{ and }}. There are several avaliable substitutions:
+ enclosed by {{ and }}. There are several available substitutions:
host
A simple string value and represents the primary host from which the
@@ -345,6 +345,11 @@ def sub(request, response, escape_type="html"):
includes the leading '?', but other delimiters are omitted.
headers
A dictionary of HTTP headers in the request.
+ header_or_default(header, default)
+ The value of an HTTP header, or a default value if it is absent.
+ For example:
+
+ {{header_or_default(X-Test, test-header-absent)}}
GET
A dictionary of query parameters supplied with the request.
uuid()
@@ -354,6 +359,8 @@ def sub(request, response, escape_type="html"):
sha224, sha256, sha384, and sha512. For example:
{{file_hash(md5, dom/interfaces.html)}}
+ fs_path(filepath)
+ The absolute path to a file inside the wpt document root
So for example in a setup running on localhost with a www
subdomain and a http server on ports 80 and 81::
@@ -414,6 +421,25 @@ class SubFunctions(object):
return base64.b64encode(hash_obj.digest()).strip()
+ @staticmethod
+ def fs_path(request, path):
+ if not path.startswith("/"):
+ subdir = request.request_path[len(request.url_base):]
+ if "/" in subdir:
+ subdir = subdir.rsplit("/", 1)[0]
+ root_rel_path = subdir + "/" + path
+ else:
+ root_rel_path = path[1:]
+ root_rel_path = root_rel_path.replace("/", os.path.sep)
+ absolute_path = os.path.abspath(os.path.join(request.doc_root, root_rel_path))
+ if ".." in os.path.relpath(absolute_path, request.doc_root):
+ raise ValueError("Path outside wpt root")
+ return absolute_path
+
+ @staticmethod
+ def header_or_default(request, name, default):
+ return request.headers.get(name, default)
+
def template(request, content, escape_type="html"):
#TODO: There basically isn't any error handling here
tokenizer = ReplacementTokenizer()
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/request.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/request.py
index 990774cbb9e..aa6306a533e 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/request.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/request.py
@@ -1,7 +1,7 @@
import base64
import cgi
from six.moves.http_cookies import BaseCookie
-from six import BytesIO, binary_type, text_type
+from six import BytesIO, binary_type, text_type, iteritems, PY3
import tempfile
from six.moves.urllib.parse import parse_qsl, urlsplit
@@ -319,9 +319,11 @@ class Request(object):
if self._cookies is None:
parser = BaseCookie()
cookie_headers = self.headers.get("cookie", b"")
+ if PY3:
+ cookie_headers = cookie_headers.decode("iso-8859-1")
parser.load(cookie_headers)
cookies = Cookies()
- for key, value in parser.iteritems():
+ for key, value in iteritems(parser):
cookies[key] = CookieValue(value)
self._cookies = cookies
return self._cookies
@@ -575,7 +577,10 @@ class MultiDict(dict):
:param key: The key to lookup
"""
- return dict.__getitem__(self, key)
+ if key in self:
+ return dict.__getitem__(self, key)
+ else:
+ return []
@classmethod
def from_field_storage(cls, fs):
@@ -619,7 +624,7 @@ class Authentication(object):
header, or None
Both attributes are binary strings (`str` in Py2, `bytes` in Py3), since
- RFC7617 Section 2.1 does not specify the encoding for username & passsword
+ RFC7617 Section 2.1 does not specify the encoding for username & password
(as long it's compatible with ASCII). UTF-8 should be a relatively safe
choice if callers need to decode them as most browsers use it.
"""
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/server.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/server.py
index 53f093b8e3d..d57a36b1338 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/server.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/server.py
@@ -44,7 +44,7 @@ for parsing the incoming request. A RequestRewriter is then
applied and may change the request data if it matches a
supplied rule.
-Once the request data had been finalised, Request and Reponse
+Once the request data had been finalised, Request and Response
objects are constructed. These are used by the other parts of the
system to read information about the request and manipulate the
response.
@@ -154,7 +154,7 @@ class WebTestServer(ThreadingMixIn, BaseHTTPServer.HTTPServer):
port specified in the server_address parameter.
False to bind the server only to the port in the
server_address parameter, but not to the address.
- :param latency: Delay in ms to wait before seving each response, or
+ :param latency: Delay in ms to wait before serving each response, or
callable that returns a delay in ms
"""
self.router = router
@@ -548,7 +548,7 @@ class Http1WebTestRequestHandler(BaseWebTestRequestHandler):
self.close_connection = True
return
- except Exception as e:
+ except Exception:
err = traceback.format_exc()
if response:
response.set_error(500, err)
@@ -591,7 +591,7 @@ class WebTestHttpd(object):
:param config: Dictionary holding environment configuration settings for
handlers to read, or None to use the default values.
:param bind_address: Boolean indicating whether to bind server to IP address.
- :param latency: Delay in ms to wait before seving each response, or
+ :param latency: Delay in ms to wait before serving each response, or
callable that returns a delay in ms
HTTP server designed for testing scenarios.
@@ -621,7 +621,7 @@ class WebTestHttpd(object):
.. attribute:: started
- Boolean indictaing whether the server is running
+ Boolean indicating whether the server is running
"""
def __init__(self, host="127.0.0.1", port=8000,
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/__init__.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/__init__.py
index 6699edb5964..e89bb96f82f 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/__init__.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/__init__.py
@@ -11,4 +11,4 @@ def get_cls(name):
try:
return environments[name]
except KeyError:
- raise ValueError("%s is not a vaid ssl type." % name)
+ raise ValueError("%s is not a valid SSL type." % name)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/base.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/base.py
index c95b693f371..63ef45cc869 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/base.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/base.py
@@ -13,5 +13,5 @@ class NoSSLEnvironment(object):
def host_cert_path(self, hosts):
return None, None
- def ca_cert_path(self):
+ def ca_cert_path(self, hosts):
return None
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/openssl.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/openssl.py
index ebbcf68d716..db188dad70a 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/openssl.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/openssl.py
@@ -114,16 +114,18 @@ def make_subject(common_name,
return "".join(rv)
def make_alt_names(hosts):
- rv = []
- for name in hosts:
- rv.append("DNS:%s" % name)
- return ",".join(rv)
+ return ",".join("DNS:%s" % host for host in hosts)
+
+def make_name_constraints(hosts):
+ return ",".join("permitted;DNS:%s" % host for host in hosts)
def get_config(root_dir, hosts, duration=30):
if hosts is None:
san_line = ""
+ constraints_line = ""
else:
san_line = "subjectAltName = %s" % make_alt_names(hosts)
+ constraints_line = "nameConstraints = " + make_name_constraints(hosts)
if os.path.sep == "\\":
# This seems to be needed for the Shining Light OpenSSL on
@@ -213,9 +215,11 @@ basicConstraints = CA:true
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer:always
keyUsage = keyCertSign
+%(constraints_line)s
""" % {"root_dir": root_dir,
"san_line": san_line,
"duration": duration,
+ "constraints_line": constraints_line,
"sep": os.path.sep.replace("\\", "\\\\")}
return rv
@@ -287,13 +291,13 @@ class OpenSSLEnvironment(object):
return OpenSSL(self.logger, self.binary, self.base_path, conf_path, hosts,
self.duration, self.base_conf_path)
- def ca_cert_path(self):
+ def ca_cert_path(self, hosts):
"""Get the path to the CA certificate file, generating a
new one if needed"""
if self._ca_cert_path is None and not self.force_regenerate:
self._load_ca_cert()
if self._ca_cert_path is None:
- self._generate_ca()
+ self._generate_ca(hosts)
return self._ca_cert_path
def _load_ca_cert(self):
@@ -326,7 +330,7 @@ class OpenSSLEnvironment(object):
#TODO: check the key actually signed the cert.
return True
- def _generate_ca(self):
+ def _generate_ca(self, hosts):
path = self.path
self.logger.info("Generating new CA in %s" % self.base_path)
@@ -334,7 +338,7 @@ class OpenSSLEnvironment(object):
req_path = path("careq.pem")
cert_path = path("cacert.pem")
- with self._config_openssl(None) as openssl:
+ with self._config_openssl(hosts) as openssl:
openssl("req",
"-batch",
"-new",
@@ -391,7 +395,7 @@ class OpenSSLEnvironment(object):
def _generate_host_cert(self, hosts):
host = hosts[0]
if self._ca_key_path is None:
- self._generate_ca()
+ self._generate_ca(hosts)
ca_key_path = self._ca_key_path
assert os.path.exists(ca_key_path)
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/pregenerated.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/pregenerated.py
index fc487df3add..672a10635ed 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/pregenerated.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/sslutils/pregenerated.py
@@ -20,7 +20,7 @@ class PregeneratedSSLEnvironment(object):
"""Return the key and certificate paths for the host"""
return self._host_key_path, self._host_cert_path
- def ca_cert_path(self):
+ def ca_cert_path(self, hosts):
"""Return the certificate path of the CA that signed the
host certificates, or None if that isn't known"""
return self._ca_cert_path
diff --git a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/stash.py b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/stash.py
index ae48a861123..8b6fd34f02c 100644
--- a/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/stash.py
+++ b/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wptserve/wptserve/stash.py
@@ -6,23 +6,29 @@ import threading
from multiprocessing.managers import AcquirerProxy, BaseManager, DictProxy
from six import text_type
+
class ServerDictManager(BaseManager):
shared_data = {}
+
def _get_shared():
return ServerDictManager.shared_data
+
ServerDictManager.register("get_dict",
callable=_get_shared,
proxytype=DictProxy)
ServerDictManager.register('Lock', threading.Lock, AcquirerProxy)
+
class ClientDictManager(BaseManager):
pass
+
ClientDictManager.register("get_dict")
ClientDictManager.register("Lock")
+
class StashServer(object):
def __init__(self, address=None, authkey=None):
self.address = address
@@ -37,6 +43,7 @@ class StashServer(object):
if self.manager is not None:
self.manager.shutdown()
+
def load_env_config():
address, authkey = json.loads(os.environ["WPT_STASH_CONFIG"])
if isinstance(address, list):
@@ -46,10 +53,12 @@ def load_env_config():
authkey = base64.b64decode(authkey)
return address, authkey
+
def store_env_config(address, authkey):
authkey = base64.b64encode(authkey)
os.environ["WPT_STASH_CONFIG"] = json.dumps((address, authkey.decode("ascii")))
+
def start_server(address=None, authkey=None):
if isinstance(authkey, text_type):
authkey = authkey.encode("ascii")
@@ -75,6 +84,7 @@ class LockWrapper(object):
def __exit__(self, *args, **kwargs):
self.release()
+
#TODO: Consider expiring values after some fixed time for long-running
#servers
@@ -104,6 +114,7 @@ class Stash(object):
_proxy = None
lock = None
+ _initializing = threading.Lock()
def __init__(self, default_path, address=None, authkey=None):
self.default_path = default_path
@@ -115,7 +126,16 @@ class Stash(object):
Stash._proxy = {}
Stash.lock = threading.Lock()
- if Stash._proxy is None:
+ # Initializing the proxy involves connecting to the remote process and
+ # retrieving two proxied objects. This process is not inherently
+ # atomic, so a lock must be used to make it so. Atomicity ensures that
+ # only one thread attempts to initialize the connection and that any
+ # threads running in parallel correctly wait for initialization to be
+ # fully complete.
+ with Stash._initializing:
+ if Stash.lock:
+ return
+
manager = ClientDictManager(address, authkey)
manager.connect()
Stash._proxy = manager.get_dict()
@@ -163,5 +183,6 @@ class Stash(object):
return value
+
class StashError(Exception):
pass
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/analyze_baselines_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/analyze_baselines_unittest.py
index e4f87d47ea4..08c0b3f9730 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/analyze_baselines_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/analyze_baselines_unittest.py
@@ -13,7 +13,7 @@ class _FakeOptimizer(BaselineOptimizer):
def read_results_by_directory(self, baseline_name):
if baseline_name.endswith('txt'):
- return {'LayoutTests/passes/text.html': '123456'}
+ return {'web_tests/passes/text.html': '123456'}
return {}
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines_unittest.py
index 67ab390297c..2d14329730a 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines_unittest.py
@@ -21,9 +21,9 @@ class TestCopyExistingBaselines(BaseTestCase):
options_dict.update(kwargs)
return optparse.Values(options_dict)
- def baseline_path(self, path_from_layout_test_dir):
+ def baseline_path(self, path_from_web_test_dir):
port = self.tool.port_factory.get()
- return self.tool.filesystem.join(port.layout_tests_dir(), path_from_layout_test_dir)
+ return self.tool.filesystem.join(port.web_tests_dir(), path_from_web_test_dir)
# The tests in this class all depend on the fall-back path graph
# that is set up in |TestPort.FALLBACK_PATHS|.
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/flaky_tests.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/flaky_tests.py
index b4230ca198c..80b0cf5d0bf 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/flaky_tests.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/flaky_tests.py
@@ -116,7 +116,7 @@ class FlakyTests(Command):
port = tool.port_factory.get()
# Skip any tests which are mentioned in the dashboard but not in our checkout:
fs = tool.filesystem
- lines = [line for line in lines if fs.exists(fs.join(port.layout_tests_dir(), line.path))]
+ lines = [line for line in lines if fs.exists(fs.join(port.web_tests_dir(), line.path))]
test_names = [line.name for line in lines]
flakiness_dashboard_url = self.FLAKINESS_DASHBOARD_URL % ','.join(test_names)
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/optimize_baselines_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/optimize_baselines_unittest.py
index 821ff40d684..6ddde1f73b1 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/optimize_baselines_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/optimize_baselines_unittest.py
@@ -12,7 +12,7 @@ class TestOptimizeBaselines(BaseTestCase):
command_constructor = OptimizeBaselines
def _write_test_file(self, port, path, contents):
- abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
+ abs_path = self.tool.filesystem.join(port.web_tests_dir(), path)
self.tool.filesystem.write_text_file(abs_path, contents)
def setUp(self):
@@ -33,13 +33,13 @@ class TestOptimizeBaselines(BaseTestCase):
self.assertFalse(
self.tool.filesystem.exists(self.tool.filesystem.join(
- test_port.layout_tests_dir(), 'platform/mac/another/test-expected.txt')))
+ test_port.web_tests_dir(), 'platform/mac/another/test-expected.txt')))
self.assertFalse(
self.tool.filesystem.exists(self.tool.filesystem.join(
- test_port.layout_tests_dir(), 'platform/mac/another/test-expected.png')))
+ test_port.web_tests_dir(), 'platform/mac/another/test-expected.png')))
self.assertTrue(
self.tool.filesystem.exists(self.tool.filesystem.join(
- test_port.layout_tests_dir(), 'another/test-expected.txt')))
+ test_port.web_tests_dir(), 'another/test-expected.txt')))
self.assertTrue(
self.tool.filesystem.exists(self.tool.filesystem.join(
- test_port.layout_tests_dir(), 'another/test-expected.png')))
+ test_port.web_tests_dir(), 'another/test-expected.png')))
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/queries.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/queries.py
index dacafd20fc1..9b144368d49 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/queries.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/queries.py
@@ -105,10 +105,10 @@ class PrintExpectations(Command):
if options.paths:
files = default_port.expectations_files()
- layout_tests_dir = default_port.layout_tests_dir()
+ web_tests_dir = default_port.web_tests_dir()
for file in files:
- if file.startswith(layout_tests_dir):
- file = file.replace(layout_tests_dir, WEB_TESTS_LAST_COMPONENT)
+ if file.startswith(web_tests_dir):
+ file = file.replace(web_tests_dir, WEB_TESTS_LAST_COMPONENT)
print file
return
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py
index d84d6944f03..f28b7f2b266 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline.py
@@ -412,8 +412,8 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
test_baseline_set: A TestBaselineSet instance, which represents
a set of tests/platform combinations to rebaseline.
"""
- if self._tool.git().has_working_directory_changes(pathspec=self._layout_tests_dir()):
- _log.error('There are uncommitted changes in the layout tests directory; aborting.')
+ if self._tool.git().has_working_directory_changes(pathspec=self._web_tests_dir()):
+ _log.error('There are uncommitted changes in the web tests directory; aborting.')
return
for test in sorted({t for t, _, _ in test_baseline_set}):
@@ -458,12 +458,12 @@ class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
baseline_paths = []
for test in test_baseline_set.all_tests():
filenames = [self._file_name_for_expected_result(test, suffix) for suffix in BASELINE_SUFFIX_LIST]
- baseline_paths += [filesystem.join(self._layout_tests_dir(), filename) for filename in filenames]
+ baseline_paths += [filesystem.join(self._web_tests_dir(), filename) for filename in filenames]
baseline_paths.sort()
return baseline_paths
- def _layout_tests_dir(self):
- return self._tool.port_factory.get().layout_tests_dir()
+ def _web_tests_dir(self):
+ return self._tool.port_factory.get().web_tests_dir()
def _suffixes_for_actual_failures(self, test, build):
"""Gets the baseline suffixes for actual mismatch failures in some results.
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py
index 0f03959ed69..fa240388cd7 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl.py
@@ -21,7 +21,7 @@ _log = logging.getLogger(__name__)
class RebaselineCL(AbstractParallelRebaselineCommand):
name = 'rebaseline-cl'
help_text = 'Fetches new baselines for a CL from test runs on try bots.'
- long_help = ('This command downloads new baselines for failing layout '
+ long_help = ('This command downloads new baselines for failing web '
'tests from archived try job test results. Cross-platform '
'baselines are deduplicated after downloading. Without '
'positional parameters or --test-name-file, all failing tests '
@@ -222,7 +222,7 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
jobs: A dict mapping Build objects to TryJobStatus objects.
Returns:
- A dict mapping Build to LayoutTestResults for all completed jobs.
+ A dict mapping Build to WebTestResults for all completed jobs.
"""
buildbot = self._tool.buildbot
results = {}
@@ -234,15 +234,15 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
continue
if status != TryJobStatus('COMPLETED', 'FAILURE'):
# Only completed failed builds will contain actual failed
- # layout tests to download baselines for.
+ # web tests to download baselines for.
continue
results_url = buildbot.results_url(build.builder_name, build.build_number)
- layout_test_results = buildbot.fetch_results(build)
- if layout_test_results is None:
+ web_test_results = buildbot.fetch_results(build)
+ if web_test_results is None:
_log.info('Failed to fetch results for "%s".', build.builder_name)
_log.info('Results URL: %s/results.html', results_url)
continue
- results[build] = layout_test_results
+ results[build] = web_test_results
return results
def _make_test_baseline_set_from_file(self, filename, builds_to_results):
@@ -266,7 +266,7 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
Args:
tests: A list of tests.
- builds_to_results: A dict mapping Builds to LayoutTestResults.
+ builds_to_results: A dict mapping Builds to WebTestResults.
Returns:
A TestBaselineSet object.
@@ -284,7 +284,7 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
modified tests will be rebaselined (depending on only_changed_tests).
Args:
- builds_to_results: A dict mapping Builds to LayoutTestResults.
+ builds_to_results: A dict mapping Builds to WebTestResults.
only_changed_tests: Whether to only include baselines for tests that
are changed in this CL. If False, all new baselines for failing
tests will be downloaded, even for tests that were not modified.
@@ -311,26 +311,26 @@ class RebaselineCL(AbstractParallelRebaselineCommand):
return test_baseline_set
def _test_base_path(self):
- """Returns the relative path from the repo root to the layout tests."""
+ """Returns the relative path from the repo root to the web tests."""
finder = PathFinder(self._tool.filesystem)
return self._tool.filesystem.relpath(
- finder.layout_tests_dir(),
+ finder.web_tests_dir(),
finder.path_from_chromium_base()) + '/'
- def _tests_to_rebaseline(self, build, layout_test_results):
+ def _tests_to_rebaseline(self, build, web_test_results):
"""Fetches a list of tests that should be rebaselined for some build.
Args:
build: A Build instance.
- layout_test_results: A LayoutTestResults instance or None.
+ web_test_results: A WebTestResults instance or None.
Returns:
A sorted list of tests to rebaseline for this build.
"""
- if layout_test_results is None:
+ if web_test_results is None:
return []
- unexpected_results = layout_test_results.didnt_run_as_expected_results()
+ unexpected_results = web_test_results.didnt_run_as_expected_results()
tests = sorted(
r.test_name() for r in unexpected_results
if r.is_missing_baseline() or r.has_mismatch_result())
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py
index ba88c33a287..5546cc75ac3 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_cl_unittest.py
@@ -10,7 +10,7 @@ from blinkpy.common.checkout.git_mock import MockGit
from blinkpy.common.net.buildbot import Build
from blinkpy.common.net.git_cl import TryJobStatus
from blinkpy.common.net.git_cl_mock import MockGitCL
-from blinkpy.common.net.layout_test_results import LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResults
from blinkpy.common.path_finder import RELATIVE_WEB_TESTS
from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.tool.commands.rebaseline import TestBaselineSet
@@ -59,7 +59,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
'is_try_builder': True,
},
})
- layout_test_results = LayoutTestResults({
+ web_test_results = WebTestResults({
'tests': {
'one': {
'crash.html': {'expected': 'PASS', 'actual': 'CRASH', 'is_unexpected': True},
@@ -75,7 +75,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
})
for build in builds:
- self.tool.buildbot.set_results(build, layout_test_results)
+ self.tool.buildbot.set_results(build, web_test_results)
self.tool.buildbot.set_retry_sumary_json(build, json.dumps({
'failures': [
'one/flaky-fail.html',
@@ -97,11 +97,11 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
]
for test in tests:
path = self.mac_port.host.filesystem.join(
- self.mac_port.layout_tests_dir(), test)
+ self.mac_port.web_tests_dir(), test)
self._write(path, 'contents')
self.mac_port.host.filesystem.write_text_file(
- '/test.checkout/LayoutTests/external/wpt/MANIFEST.json', '{}')
+ '/test.checkout/web_tests/external/wpt/MANIFEST.json', '{}')
def tearDown(self):
BaseTestCase.tearDown(self)
@@ -358,7 +358,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
# one/flaky-fail.html is considered a real test to rebaseline.
port = self.tool.port_factory.get('test-win-win7')
path = port.host.filesystem.join(
- port.layout_tests_dir(), 'one/flaky-fail.html')
+ port.web_tests_dir(), 'one/flaky-fail.html')
self._write(path, 'contents')
test_baseline_set = TestBaselineSet(self.tool)
test_baseline_set.add(
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_server.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_server.py
index 621e833f565..fad77cda9e2 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_server.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_server.py
@@ -26,13 +26,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Starts a local HTTP server which displays layout test failures (given a test
+"""Starts a local HTTP server which displays web test failures (given a test
results directory), provides comparisons of expected and actual results (both
images and text) and allows one-click rebaselining of tests.
"""
from blinkpy.common.host import Host
-from blinkpy.common.net.layout_test_results import LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResults
from blinkpy.web_tests.layout_package import json_results_generator
from blinkpy.tool.commands.abstract_local_server_command import AbstractLocalServerCommand
from blinkpy.tool.servers.rebaseline_server import get_test_baselines, RebaselineHTTPServer, STATE_NEEDS_REBASELINE
@@ -40,9 +40,9 @@ from blinkpy.tool.servers.rebaseline_server import get_test_baselines, Rebaselin
class TestConfig(object):
- def __init__(self, test_port, layout_tests_directory, results_directory, platforms, host):
+ def __init__(self, test_port, web_tests_directory, results_directory, platforms, host):
self.test_port = test_port
- self.layout_tests_directory = layout_tests_directory
+ self.web_tests_directory = web_tests_directory
self.results_directory = results_directory
self.platforms = platforms
self.host = host
@@ -76,7 +76,7 @@ class RebaselineServer(AbstractLocalServerCommand):
result_dict['baselines'] = get_test_baselines(result.test_name(), self._test_config)
new_tests_subtree[result.test_name()] = result_dict
- LayoutTestResults(results_json).for_each_test(gather_baselines_for_test)
+ WebTestResults(results_json).for_each_test(gather_baselines_for_test)
results_json['tests'] = new_tests_subtree
def _prepare_config(self, options, args, tool):
@@ -88,9 +88,9 @@ class RebaselineServer(AbstractLocalServerCommand):
results_json = json_results_generator.load_json(host.filesystem, results_json_path)
port = tool.port_factory.get()
- layout_tests_directory = port.layout_tests_dir()
- platforms = host.filesystem.listdir(host.filesystem.join(layout_tests_directory, 'platform'))
- self._test_config = TestConfig(port, layout_tests_directory, results_directory, platforms, host)
+ web_tests_directory = port.web_tests_dir()
+ platforms = host.filesystem.listdir(host.filesystem.join(web_tests_directory, 'platform'))
+ self._test_config = TestConfig(port, web_tests_directory, results_directory, platforms, host)
print 'Gathering current baselines...'
self._gather_baselines(results_json)
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py
index 4e43e313989..7bc85ca9ec1 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_test_unittest.py
@@ -30,7 +30,7 @@ class TestRebaselineTest(BaseTestCase):
port = self.tool.port_factory.get('test-win-win7')
baseline_relative_path = 'platform/test-win-win10/failures/expected/image-expected.txt'
- baseline_local_absolute_path = port.host.filesystem.join(port.layout_tests_dir(), baseline_relative_path)
+ baseline_local_absolute_path = port.host.filesystem.join(port.web_tests_dir(), baseline_relative_path)
self._write(baseline_local_absolute_path, 'original win10 result')
actual_result_url = ('https://test-results.appspot.com/data/layout_results/MOCK_Win10/' +
'results/layout-test-results/failures/expected/image-actual.txt')
@@ -58,7 +58,7 @@ class TestRebaselineTest(BaseTestCase):
self.assertMultiLineEqual(self._read(baseline_local_absolute_path),
'new win10 result')
self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
- port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')))
+ port.web_tests_dir(), 'platform/test-win-win7/failures/expected/image-expected.txt')))
self.assertMultiLineEqual(
out, '{"remove-lines": [{"test": "failures/expected/image.html", "port_name": "test-win-win10"}]}\n')
diff --git a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py
index 91e779b0a72..6ad5402efb9 100644
--- a/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/tool/commands/rebaseline_unittest.py
@@ -7,7 +7,7 @@ import optparse
import unittest
from blinkpy.common.net.buildbot import Build
-from blinkpy.common.net.layout_test_results import LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResults
from blinkpy.common.path_finder import RELATIVE_WEB_TESTS
from blinkpy.common.system.executive_mock import MockExecutive
from blinkpy.tool.commands.rebaseline import (
@@ -53,7 +53,7 @@ class BaseTestCase(unittest.TestCase):
# In AbstractParallelRebaselineCommand._rebaseline_commands, a default port
# object is gotten using self.tool.port_factory.get(), which is used to get
- # test paths -- and the layout tests directory may be different for the "test"
+ # test paths -- and the web tests directory may be different for the "test"
# ports and real ports. Since only "test" ports are used in this class,
# we can make the default port also a "test" port.
self.original_port_factory_get = self.tool.port_factory.get
@@ -72,7 +72,7 @@ class BaseTestCase(unittest.TestCase):
def _expand(self, path):
if self.tool.filesystem.isabs(path):
return path
- return self.tool.filesystem.join(self.mac_port.layout_tests_dir(), path)
+ return self.tool.filesystem.join(self.mac_port.web_tests_dir(), path)
def _read(self, path):
return self.tool.filesystem.read_text_file(self._expand(path))
@@ -89,7 +89,7 @@ class BaseTestCase(unittest.TestCase):
def _setup_mock_build_data(self):
for builder in ['MOCK Win7', 'MOCK Win7 (dbg)', 'MOCK Mac10.11']:
- self.tool.buildbot.set_results(Build(builder), LayoutTestResults({
+ self.tool.buildbot.set_results(Build(builder), WebTestResults({
'tests': {
'userscripts': {
'first-test.html': {
@@ -178,7 +178,7 @@ class TestRebaseline(BaseTestCase):
}, **kwargs))
def test_rebaseline_test_passes_on_all_builders(self):
- self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Win7'), WebTestResults({
'tests': {
'userscripts': {
'first-test.html': {
@@ -467,7 +467,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
('Bug(x) [ Mac ] userscripts/skipped-test.html [ WontFix ]\n'
'Bug(y) [ Win ] userscripts/skipped-test.html [ Skip ]\n'))
self._write('userscripts/skipped-test.html', 'Dummy test contents')
- self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Mac10.11'), WebTestResults({
'tests': {
'userscripts': {
'skipped-test.html': {
@@ -477,7 +477,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
}
}
}))
- self.tool.buildbot.set_results(Build('MOCK Win7'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Win7'), WebTestResults({
'tests': {
'userscripts': {
'skipped-test.html': {
@@ -504,7 +504,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
# Flaky expectations should be kept even if the test passes.
self._write(self.test_expectations_path, 'Bug(x) userscripts/flaky-test.html [ Pass Failure ]\n')
self._write('userscripts/flaky-test.html', 'Dummy test contents')
- self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Mac10.11'), WebTestResults({
'tests': {
'userscripts': {
'flaky-test.html': {
@@ -530,7 +530,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
self._write(self.test_expectations_path, 'Bug(foo) userscripts/all-pass.html [ Failure ]\n')
self._write('userscripts/all-pass.html', 'Dummy test contents')
test_baseline_set = TestBaselineSet(self.tool)
- self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Mac10.11'), WebTestResults({
'tests': {
'userscripts': {
'all-pass.html': {
@@ -557,7 +557,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
self._write('userscripts/all-pass.html', 'Dummy test contents')
test_baseline_set = TestBaselineSet(self.tool)
for builder in ['MOCK Win7', 'MOCK Win10', 'MOCK Mac10.10', 'MOCK Mac10.11', 'MOCK Precise', 'MOCK Trusty']:
- self.tool.buildbot.set_results(Build(builder), LayoutTestResults({
+ self.tool.buildbot.set_results(Build(builder), WebTestResults({
'tests': {
'userscripts': {
'all-pass.html': {
@@ -584,7 +584,7 @@ class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
self._write(self.test_expectations_path, 'Bug(foo) userscripts/all-pass.html [ Failure ]\n')
self._write('userscripts/all-pass.html', 'Dummy test contents')
test_baseline_set = TestBaselineSet(self.tool)
- self.tool.buildbot.set_results(Build('MOCK Mac10.11'), LayoutTestResults({
+ self.tool.buildbot.set_results(Build('MOCK Mac10.11'), WebTestResults({
'tests': {
'userscripts': {
'all-pass.html': {
@@ -702,7 +702,7 @@ class TestBaselineSetTest(unittest.TestCase):
host = MockBlinkTool()
host.port_factory = MockPortFactory(host)
port = host.port_factory.get()
- base_dir = port.layout_tests_dir()
+ base_dir = port.web_tests_dir()
host.filesystem.write_text_file(base_dir + '/a/x.html', '<html>')
host.filesystem.write_text_file(base_dir + '/a/y.html', '<html>')
host.filesystem.write_text_file(base_dir + '/a/z.html', '<html>')
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/chromium_commit_mock.py b/chromium/third_party/blink/tools/blinkpy/w3c/chromium_commit_mock.py
index e9ee0ddd4a1..3d7c7c4743f 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/chromium_commit_mock.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/chromium_commit_mock.py
@@ -29,8 +29,8 @@ class MockChromiumCommit(object):
def filtered_changed_files(self):
return [
- 'third_party/WebKit/LayoutTests/external/wpt/one.html',
- 'third_party/WebKit/LayoutTests/external/wpt/two.html',
+ 'third_party/blink/web_tests/external/wpt/one.html',
+ 'third_party/blink/web_tests/external/wpt/two.html',
]
def url(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/chromium_finder.py b/chromium/third_party/blink/tools/blinkpy/w3c/chromium_finder.py
index 72e4e417b43..a9665d620f4 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/chromium_finder.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/chromium_finder.py
@@ -9,7 +9,7 @@ from blinkpy.common.path_finder import PathFinder
@memoized
def absolute_chromium_wpt_dir(host):
finder = PathFinder(host.filesystem)
- return finder.path_from_layout_tests('external', 'wpt')
+ return finder.path_from_web_tests('external', 'wpt')
@memoized
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py b/chromium/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py
index 0e57805fd62..e7b126413ec 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/directory_owners_extractor.py
@@ -43,10 +43,10 @@ class DirectoryOwnersExtractor(object):
Returns:
A dict mapping tuples of owner email addresses to lists of
- owned directories (paths relative to the root of layout tests).
+ owned directories (paths relative to the root of web tests).
"""
email_map = collections.defaultdict(set)
- external_root_owners = self.finder.path_from_layout_tests('external', 'OWNERS')
+ external_root_owners = self.finder.path_from_web_tests('external', 'OWNERS')
for relpath in changed_files:
# Try to find the first *non-empty* OWNERS file.
absolute_path = self.finder.path_from_chromium_base(relpath)
@@ -64,7 +64,7 @@ class DirectoryOwnersExtractor(object):
continue
owned_directory = self.filesystem.dirname(owners_file)
- owned_directory_relpath = self.filesystem.relpath(owned_directory, self.finder.layout_tests_dir())
+ owned_directory_relpath = self.filesystem.relpath(owned_directory, self.finder.web_tests_dir())
email_map[tuple(owners)].add(owned_directory_relpath)
return {owners: sorted(owned_directories) for owners, owned_directories in email_map.iteritems()}
@@ -86,11 +86,11 @@ class DirectoryOwnersExtractor(object):
else self.finder.path_from_chromium_base(start_path))
directory = (abs_start_path if self.filesystem.isdir(abs_start_path)
else self.filesystem.dirname(abs_start_path))
- external_root = self.finder.path_from_layout_tests('external')
+ external_root = self.finder.path_from_web_tests('external')
if not directory.startswith(external_root):
return None
# Stop at web_tests, which is the parent of external_root.
- while directory != self.finder.layout_tests_dir():
+ while directory != self.finder.web_tests_dir():
owners_file = self.filesystem.join(directory, 'OWNERS')
if self.filesystem.isfile(self.finder.path_from_chromium_base(owners_file)):
return owners_file
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/import_notifier.py b/chromium/third_party/blink/tools/blinkpy/w3c/import_notifier.py
index 37b7bfd5111..11e405a9d7f 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/import_notifier.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/import_notifier.py
@@ -88,7 +88,7 @@ class ImportNotifier(object):
for test_name in rebaselined_tests:
test_without_ext, _ = self.host.filesystem.splitext(test_name)
changed_baselines = []
- # TODO(robertma): Refactor this into layout_tests.port.base.
+ # TODO(robertma): Refactor this into web_tests.port.base.
baseline_name = test_without_ext + '-expected.txt'
for changed_file in changed_files:
if changed_file.endswith(baseline_name):
@@ -165,7 +165,7 @@ class ImportNotifier(object):
for directory, failures in self.new_failures_by_directory.iteritems():
summary = '[WPT] New failures introduced in {} by import {}'.format(directory, gerrit_url)
- full_directory = self.host.filesystem.join(self.finder.layout_tests_dir(), directory)
+ full_directory = self.host.filesystem.join(self.finder.web_tests_dir(), directory)
owners_file = self.host.filesystem.join(full_directory, 'OWNERS')
is_wpt_notify_enabled = self.owners_extractor.is_wpt_notify_enabled(owners_file)
@@ -214,7 +214,7 @@ class ImportNotifier(object):
A multi-line string.
"""
path_from_wpt = self.host.filesystem.relpath(
- directory, self.finder.path_from_layout_tests('external', 'wpt'))
+ directory, self.finder.path_from_web_tests('external', 'wpt'))
commit_list = ''
for sha, subject in imported_commits:
# subject is a Unicode string and can contain non-ASCII characters.
@@ -238,12 +238,12 @@ class ImportNotifier(object):
test_name = self.default_port.lookup_virtual_test_base(test_name)
# find_owners_file takes either a relative path from the *root* of the
# repository, or an absolute path.
- abs_test_path = self.finder.path_from_layout_tests(test_name)
+ abs_test_path = self.finder.path_from_web_tests(test_name)
owners_file = self.owners_extractor.find_owners_file(self.host.filesystem.dirname(abs_test_path))
if not owners_file:
return None
owned_directory = self.host.filesystem.dirname(owners_file)
- short_directory = self.host.filesystem.relpath(owned_directory, self.finder.layout_tests_dir())
+ short_directory = self.host.filesystem.relpath(owned_directory, self.finder.web_tests_dir())
return short_directory
def file_bugs(self, bugs, dry_run, service_account_key_json=None):
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/test_copier.py b/chromium/third_party/blink/tools/blinkpy/w3c/test_copier.py
index 2ce4ab93401..2aa9013df2a 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/test_copier.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/test_copier.py
@@ -39,7 +39,7 @@ from blinkpy.w3c.common import is_basename_skipped
_log = logging.getLogger(__name__)
-# Directory for imported tests relative to the layout tests base directory.
+# Directory for imported tests relative to the web tests base directory.
DEST_DIR_NAME = 'external'
class TestCopier(object):
@@ -58,10 +58,10 @@ class TestCopier(object):
self.filesystem = self.host.filesystem
self.path_finder = PathFinder(self.filesystem)
- self.layout_tests_dir = self.path_finder.layout_tests_dir()
+ self.web_tests_dir = self.path_finder.web_tests_dir()
self.destination_directory = self.filesystem.normpath(
self.filesystem.join(
- self.layout_tests_dir,
+ self.web_tests_dir,
DEST_DIR_NAME,
self.filesystem.basename(self.source_repo_path)))
self.import_in_place = (self.source_repo_path == self.destination_directory)
@@ -112,7 +112,7 @@ class TestCopier(object):
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(self.source_repo_path + '/', '')
- path_base = self.destination_directory.replace(self.layout_tests_dir + '/', '') + '/' + path_base
+ path_base = self.destination_directory.replace(self.web_tests_dir + '/', '') + '/' + path_base
if path_base in paths_to_skip:
if self.import_in_place:
_log.debug('Pruning: %s', path_base)
@@ -136,7 +136,7 @@ class TestCopier(object):
def find_paths_to_skip(self):
paths_to_skip = set()
port = self.host.port_factory.get()
- w3c_import_expectations_path = self.path_finder.path_from_layout_tests('W3CImportExpectations')
+ w3c_import_expectations_path = self.path_finder.path_from_web_tests('W3CImportExpectations')
w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expectations_path)
parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False)
expectation_lines = parser.parse(w3c_import_expectations_path, w3c_import_expectations)
@@ -201,7 +201,7 @@ class TestCopier(object):
if not self.import_in_place:
self.filesystem.maybe_make_directory(self.filesystem.dirname(dest_path))
- relpath = self.filesystem.relpath(dest_path, self.layout_tests_dir)
+ relpath = self.filesystem.relpath(dest_path, self.web_tests_dir)
# FIXME: Maybe doing a file diff is in order here for existing files?
# In other words, there's no sense in overwriting identical files, but
# there's no harm in copying the identical thing.
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/test_importer.py b/chromium/third_party/blink/tools/blinkpy/w3c/test_importer.py
index 788c5da4617..74c094ffa81 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/test_importer.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/test_importer.py
@@ -39,7 +39,7 @@ POLL_DELAY_SECONDS = 2 * 60
TIMEOUT_SECONDS = 210 * 60
# Sheriff calendar URL, used for getting the ecosystem infra sheriff to TBR.
-ROTATIONS_URL = 'https://build.chromium.org/deprecated/chromium/all_rotations.js'
+ROTATIONS_URL = 'https://rota-ng.appspot.com/legacy/all_rotations.js'
TBR_FALLBACK = 'robertma'
_log = logging.getLogger(__file__)
@@ -55,7 +55,7 @@ class TestImporter(object):
self.fs = host.filesystem
self.finder = PathFinder(self.fs)
self.chromium_git = self.host.git(self.finder.chromium_base())
- self.dest_path = self.finder.path_from_layout_tests('external', 'wpt')
+ self.dest_path = self.finder.path_from_web_tests('external', 'wpt')
# A common.net.git_cl.GitCL instance.
self.git_cl = None
@@ -389,7 +389,7 @@ class TestImporter(object):
is_file_exportable(fs.relpath(fs.join(dirname, basename), self.finder.chromium_base())))
files_to_delete = self.fs.files_under(self.dest_path, file_filter=should_remove)
for subpath in files_to_delete:
- self.remove(self.finder.path_from_layout_tests('external', subpath))
+ self.remove(self.finder.path_from_web_tests('external', subpath))
def _commit_changes(self, commit_message):
_log.info('Committing changes.')
@@ -423,7 +423,7 @@ class TestImporter(object):
# - the manifest path could be factored out to a common location, and
# - the logic for reading the manifest could be factored out from here
# and the Port class.
- manifest_path = self.finder.path_from_layout_tests('external', 'wpt', 'MANIFEST.json')
+ manifest_path = self.finder.path_from_web_tests('external', 'wpt', 'MANIFEST.json')
manifest = WPTManifest(self.fs.read_text_file(manifest_path))
wpt_urls = manifest.all_urls()
@@ -433,7 +433,7 @@ class TestImporter(object):
# TODO(qyearsley): Remove this when this behavior is fixed.
wpt_urls = [url.split('?')[0] for url in wpt_urls]
- wpt_dir = self.finder.path_from_layout_tests('external', 'wpt')
+ wpt_dir = self.finder.path_from_web_tests('external', 'wpt')
for full_path in baselines:
rel_path = self.fs.relpath(full_path, wpt_dir)
if not self._has_corresponding_test(rel_path, wpt_urls):
@@ -608,12 +608,12 @@ class TestImporter(object):
self.host.filesystem.write_text_file(path, new_file_contents)
def _list_deleted_tests(self):
- """List of layout tests that have been deleted."""
+ """List of web tests that have been deleted."""
# TODO(robertma): Improve Git.changed_files so that we can use it here.
out = self.chromium_git.run(['diff', 'origin/master', '-M100%', '--diff-filter=D', '--name-only'])
deleted_tests = []
for path in out.splitlines():
- test = self._relative_to_layout_test_dir(path)
+ test = self._relative_to_web_test_dir(path)
if test:
deleted_tests.append(test)
return deleted_tests
@@ -627,18 +627,18 @@ class TestImporter(object):
renamed_tests = {}
for line in out.splitlines():
_, source_path, dest_path = line.split()
- source_test = self._relative_to_layout_test_dir(source_path)
- dest_test = self._relative_to_layout_test_dir(dest_path)
+ source_test = self._relative_to_web_test_dir(source_path)
+ dest_test = self._relative_to_web_test_dir(dest_path)
if source_test and dest_test:
renamed_tests[source_test] = dest_test
return renamed_tests
- def _relative_to_layout_test_dir(self, path_relative_to_repo_root):
- """Returns a path that's relative to the layout tests directory."""
+ def _relative_to_web_test_dir(self, path_relative_to_repo_root):
+ """Returns a path that's relative to the web tests directory."""
abs_path = self.finder.path_from_chromium_base(path_relative_to_repo_root)
- if not abs_path.startswith(self.finder.layout_tests_dir()):
+ if not abs_path.startswith(self.finder.web_tests_dir()):
return None
- return self.fs.relpath(abs_path, self.finder.layout_tests_dir())
+ return self.fs.relpath(abs_path, self.finder.web_tests_dir())
def _get_last_imported_wpt_revision(self):
"""Finds the last imported WPT revision."""
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater.py b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater.py
index 6c71e5b57f5..ce7695b14e4 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater.py
@@ -26,7 +26,7 @@ _log = logging.getLogger(__name__)
MARKER_COMMENT = '# ====== New tests from wpt-importer added here ======'
UMBRELLA_BUG = 'crbug.com/626703'
-# TODO(robertma): Investigate reusing layout_tests.models.test_expectations and
+# TODO(robertma): Investigate reusing web_tests.models.test_expectations and
# alike in this module.
SimpleTestResult = namedtuple('SimpleTestResult', ['expected', 'actual', 'bug'])
@@ -114,7 +114,7 @@ class WPTExpectationsUpdater(object):
def get_failing_results_dict(self, build):
"""Returns a nested dict of failing test results.
- Retrieves a full list of layout test results from a builder result URL.
+ Retrieves a full list of web test results from a builder result URL.
Collects the builder name, platform and a list of tests that did not
run as expected.
@@ -134,24 +134,24 @@ class WPTExpectationsUpdater(object):
if port_name in self.ports_with_all_pass:
# All tests passed, so there should be no failing results.
return {}
- layout_test_results = self.host.buildbot.fetch_results(build)
- if layout_test_results is None:
+ web_test_results = self.host.buildbot.fetch_results(build)
+ if web_test_results is None:
_log.warning('No results for build %s', build)
self.ports_with_no_results.add(self.port_name(build))
return {}
- failing_test_results = [result for result in layout_test_results.didnt_run_as_expected_results() if not result.did_pass()]
+ failing_test_results = [result for result in web_test_results.didnt_run_as_expected_results() if not result.did_pass()]
return self.generate_results_dict(self.port_name(build), failing_test_results)
@memoized
def port_name(self, build):
return self.host.builders.port_name_for_builder_name(build.builder_name)
- def generate_results_dict(self, full_port_name, layout_test_results):
+ def generate_results_dict(self, full_port_name, web_test_results):
"""Makes a dict with results for one platform.
Args:
full_port_name: The fully-qualified port name, e.g. "win-win10".
- layout_test_results: A list of LayoutTestResult objects.
+ web_test_results: A list of WebTestResult objects.
Returns:
A dictionary with the structure: {
@@ -161,7 +161,7 @@ class WPTExpectationsUpdater(object):
}
"""
test_dict = {}
- for result in layout_test_results:
+ for result in web_test_results:
test_name = result.test_name()
if not self.port.is_wpt_test(test_name):
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py
index cc6236c8159..5308a22ddf0 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_expectations_updater_unittest.py
@@ -10,7 +10,7 @@ from blinkpy.common.net.buildbot import Build
from blinkpy.common.net.buildbot_mock import MockBuildBot
from blinkpy.common.net.git_cl import TryJobStatus
from blinkpy.common.net.git_cl_mock import MockGitCL
-from blinkpy.common.net.layout_test_results import LayoutTestResult, LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResult, WebTestResults
from blinkpy.common.system.executive import ScriptError
from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater, SimpleTestResult, MARKER_COMMENT
@@ -61,7 +61,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
# Write a dummy manifest file, describing what tests exist.
host.filesystem.write_text_file(
- host.port_factory.get().layout_tests_dir() + '/external/wpt/MANIFEST.json',
+ host.port_factory.get().web_tests_dir() + '/external/wpt/MANIFEST.json',
json.dumps({
'items': {
'reftest': {
@@ -106,7 +106,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
# of the tests passed.
host.buildbot.set_results(
Build('MOCK Try Mac10.10', 333),
- LayoutTestResults({
+ WebTestResults({
'tests': {
'external': {
'wpt': {
@@ -133,7 +133,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_get_failing_results_dict_only_passing_results(self):
host = self.mock_host()
- host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), LayoutTestResults({
+ host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), WebTestResults({
'tests': {
'external': {
'wpt': {
@@ -153,7 +153,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_get_failing_results_dict_unexpected_pass(self):
host = self.mock_host()
- host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), LayoutTestResults({
+ host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), WebTestResults({
'tests': {
'external': {
'wpt': {
@@ -182,7 +182,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_get_failing_results_dict_some_failing_results(self):
host = self.mock_host()
- host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), LayoutTestResults({
+ host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), WebTestResults({
'tests': {
'external': {
'wpt': {
@@ -213,7 +213,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_get_failing_results_dict_non_wpt_test(self):
host = self.mock_host()
- host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), LayoutTestResults({
+ host.buildbot.set_results(Build('MOCK Try Mac10.10', 123), WebTestResults({
'tests': {
'x': {
'failing-test.html': {
@@ -469,8 +469,8 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_generate_results_dict(self):
updater = WPTExpectationsUpdater(self.mock_host())
- layout_test_list = [
- LayoutTestResult(
+ web_test_list = [
+ WebTestResult(
'external/wpt/test/name.html', {
'expected': 'bar',
'actual': 'foo',
@@ -478,7 +478,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
'has_stderr': True,
})
]
- self.assertEqual(updater.generate_results_dict('test-mac-mac10.10', layout_test_list), {
+ self.assertEqual(updater.generate_results_dict('test-mac-mac10.10', web_test_list), {
'external/wpt/test/name.html': {
'test-mac-mac10.10': SimpleTestResult(
expected='bar',
diff --git a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py
index 2876b3aec80..7e18f3b3712 100644
--- a/chromium/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py
+++ b/chromium/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py
@@ -181,8 +181,8 @@ class WPTManifest(object):
def ensure_manifest(host):
"""Updates the MANIFEST.json file, or generates if it does not exist."""
finder = PathFinder(host.filesystem)
- manifest_path = finder.path_from_layout_tests('external', 'wpt', 'MANIFEST.json')
- base_manifest_path = finder.path_from_layout_tests('external', BASE_MANIFEST_NAME)
+ manifest_path = finder.path_from_web_tests('external', 'wpt', 'MANIFEST.json')
+ base_manifest_path = finder.path_from_web_tests('external', BASE_MANIFEST_NAME)
if not host.filesystem.exists(base_manifest_path):
_log.error('Manifest base not found at "%s".', base_manifest_path)
@@ -196,7 +196,7 @@ class WPTManifest(object):
host.filesystem.remove(manifest_path)
host.filesystem.copyfile(base_manifest_path, manifest_path)
- wpt_path = finder.path_from_layout_tests('external', 'wpt')
+ wpt_path = finder.path_from_web_tests('external', 'wpt')
WPTManifest.generate_manifest(host, wpt_path)
_log.debug('Manifest generation completed.')
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py b/chromium/third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py
index bd506b3b8b4..a37d447e42b 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_win.py
@@ -29,7 +29,6 @@
import errno
import logging
import os
-import shlex
from blinkpy.web_tests.breakpad.dump_reader import DumpReader
@@ -111,15 +110,6 @@ class DumpReaderWin(DumpReader):
for program_files in program_files_directories:
possible_cdb_locations.append(template % program_files)
- gyp_defines = self._host.environ.get('GYP_DEFINES', [])
- if gyp_defines:
- gyp_defines = shlex.split(gyp_defines)
- if 'windows_sdk_path' in gyp_defines:
- possible_cdb_locations.extend([
- '%s\\Debuggers\\x86' % gyp_defines['windows_sdk_path'],
- '%s\\Debuggers\\x64' % gyp_defines['windows_sdk_path'],
- ])
-
# Look in depot_tools win_toolchain too.
depot_tools = self._find_depot_tools_path()
if depot_tools:
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/builder_list.py b/chromium/third_party/blink/tools/blinkpy/web_tests/builder_list.py
index 96760fbee90..3bc7758f914 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/builder_list.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/builder_list.py
@@ -26,9 +26,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Represents a set of builder bots running layout tests.
+"""Represents a set of builder bots running web tests.
-This class is used to hold a list of builder bots running layout tests and their
+This class is used to hold a list of builder bots running web tests and their
corresponding port names and TestExpectations specifiers.
"""
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
index 41b0fb02ad8..661ccdbdce7 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
@@ -27,7 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""The Manager orchestrates the overall process of running layout tests.
+"""The Manager orchestrates the overall process of running web tests.
This includes finding tests to run, reading the test expectations,
starting the required helper servers, deciding the order and way to
@@ -48,9 +48,9 @@ from blinkpy.common.net.file_uploader import FileUploader
from blinkpy.common.path_finder import PathFinder
from blinkpy.tool import grammar
from blinkpy.w3c.wpt_manifest import WPTManifest
-from blinkpy.web_tests.controllers.layout_test_finder import LayoutTestFinder
-from blinkpy.web_tests.controllers.layout_test_runner import LayoutTestRunner
from blinkpy.web_tests.controllers.test_result_writer import TestResultWriter
+from blinkpy.web_tests.controllers.web_test_finder import WebTestFinder
+from blinkpy.web_tests.controllers.web_test_runner import WebTestRunner
from blinkpy.web_tests.layout_package import json_results_generator
from blinkpy.web_tests.models import test_expectations
from blinkpy.web_tests.models import test_failures
@@ -63,7 +63,7 @@ TestExpectations = test_expectations.TestExpectations
class Manager(object):
- """A class for managing running a series of layout tests."""
+ """A class for managing running a series of web tests."""
HTTP_SUBDIR = 'http'
PERF_SUBDIR = 'perf'
@@ -89,9 +89,9 @@ class Manager(object):
self._websockets_server_started = False
self._results_directory = self._port.results_directory()
- self._finder = LayoutTestFinder(self._port, self._options)
+ self._finder = WebTestFinder(self._port, self._options)
self._path_finder = PathFinder(port.host.filesystem)
- self._runner = LayoutTestRunner(self._options, self._port, self._printer, self._results_directory, self._test_is_slow)
+ self._runner = WebTestRunner(self._options, self._port, self._printer, self._results_directory, self._test_is_slow)
def run(self, args):
"""Runs the tests and return a RunDetails object with the results."""
@@ -99,7 +99,7 @@ class Manager(object):
self._printer.write_update('Collecting tests ...')
running_all_tests = False
- if not args or any('external' in path for path in args):
+ if self._options.manifest_update and (not args or any('external' in path for path in args)):
self._printer.write_update('Generating MANIFEST.json for web-platform-tests ...')
WPTManifest.ensure_manifest(self._port.host)
self._printer.write_update('Completed generating manifest.')
@@ -193,7 +193,6 @@ class Manager(object):
self._upload_json_files()
self._copy_results_html_file(self._results_directory, 'results.html')
- self._copy_results_html_file(self._results_directory, 'legacy-results.html')
if initial_results.keyboard_interrupted:
exit_code = exit_codes.INTERRUPTED_EXIT_STATUS
else:
@@ -566,7 +565,7 @@ class Manager(object):
def _copy_results_html_file(self, destination_dir, filename):
"""Copies a file from the template directory to the results directory."""
- template_dir = self._path_finder.path_from_layout_tests('fast', 'harness')
+ template_dir = self._path_finder.path_from_web_tests('fast', 'harness')
source_path = self._filesystem.join(template_dir, filename)
destination_path = self._filesystem.join(destination_dir, filename)
# Note that the results.html template file won't exist when
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/single_test_runner.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/single_test_runner.py
index e6782ee9e76..fd4774ce253 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/single_test_runner.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/single_test_runner.py
@@ -201,7 +201,7 @@ class SingleTestRunner(object):
# Remove |output_path| if it exists and is not the generic expectation to
# avoid extra baseline if the new baseline is the same as the fallback baseline.
- generic_dir = fs.join(port.layout_tests_dir(),
+ generic_dir = fs.join(port.web_tests_dir(),
fs.dirname(port.lookup_virtual_test_base(self._test_name) or self._test_name))
if (not data or output_dir != generic_dir) and fs.exists(output_path):
_log.info('Removing the current baseline "%s"', port.relative_test_filename(output_path))
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder.py
index 44921dccce7..3a2cdbc1e05 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder.py
@@ -39,13 +39,13 @@ from blinkpy.web_tests.models import test_expectations
_log = logging.getLogger(__name__)
-class LayoutTestFinder(object):
+class WebTestFinder(object):
def __init__(self, port, options):
self._port = port
self._options = options
self._filesystem = self._port.host.filesystem
- self.LAYOUT_TESTS_DIRECTORIES = ('src', 'third_party', 'blink', 'web_tests')
+ self.WEB_TESTS_DIRECTORIES = ('src', 'third_party', 'blink', 'web_tests')
def find_tests(self, args, test_list=None, fastest_percentile=None):
paths = self._strip_test_dir_prefixes(args)
@@ -118,11 +118,11 @@ class LayoutTestFinder(object):
def _strip_test_dir_prefix(self, path):
# Remove src/third_party/blink/web_tests/ from the front of the test path,
# or any subset of these.
- for i in range(len(self.LAYOUT_TESTS_DIRECTORIES)):
+ for i in range(len(self.WEB_TESTS_DIRECTORIES)):
# Handle both "web_tests/foo/bar.html" and "web_tests\foo\bar.html" if
# the filesystem uses '\\' as a directory separator
for separator in (self._port.TEST_PATH_SEPARATOR, self._filesystem.sep):
- directory_prefix = separator.join(self.LAYOUT_TESTS_DIRECTORIES[i:]) + separator
+ directory_prefix = separator.join(self.WEB_TESTS_DIRECTORIES[i:]) + separator
if path.startswith(directory_prefix):
return path[len(directory_prefix):]
return path
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py
index a3474ac48e5..f932b7cdc74 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_finder_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_finder_unittest.py
@@ -8,7 +8,7 @@ import unittest
from blinkpy.common import path_finder
from blinkpy.common.host_mock import MockHost
-from blinkpy.web_tests.controllers import layout_test_finder
+from blinkpy.web_tests.controllers import web_test_finder
_MOCK_ROOT = os.path.join(
path_finder.get_chromium_src_dir(), 'third_party', 'pymock')
@@ -16,7 +16,7 @@ sys.path.append(_MOCK_ROOT)
import mock
-class LayoutTestFinderTests(unittest.TestCase):
+class WebTestFinderTests(unittest.TestCase):
def test_find_fastest_tests(self):
host = MockHost()
@@ -37,7 +37,7 @@ class LayoutTestFinderTests(unittest.TestCase):
port.tests = lambda paths: paths or all_tests
- finder = layout_test_finder.LayoutTestFinder(port, {})
+ finder = web_test_finder.WebTestFinder(port, {})
finder._times_trie = lambda: {
'fast': {
'css': {
@@ -79,7 +79,7 @@ class LayoutTestFinderTests(unittest.TestCase):
port.tests = lambda paths: paths or all_tests
- finder = layout_test_finder.LayoutTestFinder(port, {})
+ finder = web_test_finder.WebTestFinder(port, {})
finder._times_trie = lambda: {
'fast': {
@@ -95,7 +95,7 @@ class LayoutTestFinderTests(unittest.TestCase):
self.assertEqual(set(tests[1]), set(['fast/css/1.html']))
def test_split_chunks(self):
- split = layout_test_finder.LayoutTestFinder._split_into_chunks # pylint: disable=protected-access
+ split = web_test_finder.WebTestFinder._split_into_chunks # pylint: disable=protected-access
with mock.patch('__builtin__.hash', int):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner.py
index c4f21406e59..1d7ec88c1ea 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner.py
@@ -55,7 +55,7 @@ class TestRunInterruptedException(Exception):
return self.__class__, (self.reason,)
-class LayoutTestRunner(object):
+class WebTestRunner(object):
def __init__(self, options, port, printer, results_directory, test_is_slow_fn):
self._options = options
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner_unittes.py
index 0df3ce427db..bd90f363d45 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/layout_test_runner_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/controllers/web_test_runner_unittes.py
@@ -32,7 +32,7 @@ import unittest
from blinkpy.common.host_mock import MockHost
from blinkpy.common.system.system_host_mock import MockSystemHost
from blinkpy.web_tests import run_webkit_tests
-from blinkpy.web_tests.controllers.layout_test_runner import LayoutTestRunner, Sharder, TestRunInterruptedException
+from blinkpy.web_tests.controllers.web_test_runner import WebTestRunner, Sharder, TestRunInterruptedException
from blinkpy.web_tests.models import test_expectations
from blinkpy.web_tests.models import test_failures
from blinkpy.web_tests.models.test_run_results import TestRunResults
@@ -70,7 +70,7 @@ class FakePrinter(object):
pass
-class LockCheckingRunner(LayoutTestRunner):
+class LockCheckingRunner(WebTestRunner):
def __init__(self, port, options, printer, tester, http_lock):
super(LockCheckingRunner, self).__init__(options, port, printer, port.results_directory(), lambda test_name: False)
@@ -79,7 +79,7 @@ class LockCheckingRunner(LayoutTestRunner):
self._should_have_http_lock = http_lock
-class LayoutTestRunnerTests(unittest.TestCase):
+class WebTestRunnerTests(unittest.TestCase):
# pylint: disable=protected-access
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py b/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py
index 5b7acc9b97f..ef056416391 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py
@@ -82,7 +82,7 @@ def lint(host, options):
def check_virtual_test_suites(host, options):
port = host.port_factory.get(options=options)
fs = host.filesystem
- layout_tests_dir = port.layout_tests_dir()
+ web_tests_dir = port.web_tests_dir()
virtual_suites = port.virtual_test_suites()
failures = []
@@ -91,9 +91,9 @@ def check_virtual_test_suites(host, options):
# - a top-level README.md (e.g. virtual/foo/README.md)
# - a README.txt for each covered dir/file (e.g.
# virtual/foo/http/tests/README.txt, virtual/foo/fast/README.txt, ...)
- comps = [layout_tests_dir] + suite.name.split('/') + ['README.txt']
+ comps = [web_tests_dir] + suite.name.split('/') + ['README.txt']
path_to_readme_txt = fs.join(*comps)
- comps = [layout_tests_dir] + suite.name.split('/')[:2] + ['README.md']
+ comps = [web_tests_dir] + suite.name.split('/')[:2] + ['README.md']
path_to_readme_md = fs.join(*comps)
if not fs.exists(path_to_readme_txt) and not fs.exists(path_to_readme_md):
failure = '{} and {} are both missing (each virtual suite must have one).'.format(
@@ -107,7 +107,7 @@ def check_virtual_test_suites(host, options):
def check_smoke_tests(host, options):
port = host.port_factory.get(options=options)
- smoke_tests_file = host.filesystem.join(port.layout_tests_dir(), 'SmokeTests')
+ smoke_tests_file = host.filesystem.join(port.web_tests_dir(), 'SmokeTests')
failures = []
if not host.filesystem.exists(smoke_tests_file):
return failures
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py
index 16e695a173e..3102a1756ab 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/lint_test_expectations_unittest.py
@@ -71,7 +71,7 @@ class FakePort(object):
def extra_expectations_files(self):
return ['/fake-port-base-directory/web_tests/ExtraExpectations']
- def layout_tests_dir(self):
+ def web_tests_dir(self):
return '/fake-port-base-directory/web_tests'
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results.py b/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results.py
index d8071aa5adc..a5c6e3f44eb 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results.py
@@ -2,13 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Classes for merging layout tests results directories together.
+"""Classes for merging web tests results directories together.
This is split into three parts:
* Generic code to merge JSON data together.
* Generic code to merge directories together.
- * Code to specifically merge the layout tests result data together.
+ * Code to specifically merge the web tests result data together.
The JSON data merger will recursively merge dictionaries by default.
@@ -518,7 +518,7 @@ class DirMerger(Merger):
break
-# Classes specific to merging LayoutTest results directory.
+# Classes specific to merging web test results directory.
# ------------------------------------------------------------------------
@@ -577,7 +577,7 @@ class JSONTestResultsMerger(JSONMerger):
NameRegexMatch(':interrupted$'),
lambda o, name=None: bool(sum(o)))
- # Layout test directory value is randomly created on each shard, so
+ # Web test directory value is randomly created on each shard, so
# clear it.
self.add_helper(
NameRegexMatch(':layout_tests_dir$'),
@@ -596,8 +596,8 @@ class JSONTestResultsMerger(JSONMerger):
return JSONMerger.fallback_matcher(self, objs, name)
-class LayoutTestDirMerger(DirMerger):
- """Merge layout test result directory."""
+class WebTestDirMerger(DirMerger):
+ """Merge web test result directory."""
def __init__(self, filesystem=None,
results_json_value_overrides=None,
@@ -674,7 +674,7 @@ def main(argv):
parser = argparse.ArgumentParser()
parser.description = """\
-Merges sharded layout test results into a single output directory.
+Merges sharded web test results into a single output directory.
"""
parser.epilog = """\
@@ -812,7 +812,7 @@ directory. The script will be given the arguments plus
results_json_value_overrides[result_key] = build_properties[build_prop_key]
logging.debug('results_json_value_overrides: %r', results_json_value_overrides)
- merger = LayoutTestDirMerger(
+ merger = WebTestDirMerger(
results_json_value_overrides=results_json_value_overrides,
results_json_allow_unknown_if_matching=args.results_json_allow_unknown_if_matching)
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results_unittest.py
index c217d41c73f..5035db04de5 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/merge_results_unittest.py
@@ -541,7 +541,7 @@ class JSONTestResultsMerger(unittest.TestCase):
merger.merge([{'seconds_since_epoch': 12}, {}]))
-class LayoutTestDirMergerTests(unittest.TestCase):
+class WebTestDirMergerTests(unittest.TestCase):
# JSON files for shard 1
# Shard1 has the following tests;
@@ -555,7 +555,7 @@ class LayoutTestDirMergerTests(unittest.TestCase):
"chromium_revision": "123",
"fixable": 1,
"interrupted": false,
- "layout_tests_dir": "/b/s/w/irJ1McdS/third_party/WebKit/LayoutTests",
+ "layout_tests_dir": "/b/s/w/irJ1McdS/third_party/blink/web_tests",
"num_failures_by_type": {
"AUDIO": 2,
"CRASH": 3
@@ -677,7 +677,7 @@ ADD_RESULTS({
"chromium_revision": "123",
"fixable": 9,
"interrupted": false,
- "layout_tests_dir": "/b/s/w/sadfa124/third_party/WebKit/LayoutTests",
+ "layout_tests_dir": "/b/s/w/sadfa124/third_party/blink/web_tests",
"num_failures_by_type": {
"AUDIO": 10,
"CRASH": 11
@@ -772,7 +772,7 @@ ADD_RESULTS({
[Wed Mar 01 22:20:07.400802 2017] [ssl:warn] [pid 15010] AH01909: RSA certificate configured for 127.0.0.1:443 does NOT include an ID which matches the server name
"""
- layout_test_filesystem = {
+ web_test_filesystem = {
# Files for shard0
'/shards/0/layout-test-results/access_log.txt': shard0_access_log,
'/shards/0/layout-test-results/archived_results.json': shard0_archived_results_json,
@@ -1008,7 +1008,7 @@ ADD_RESULTS({
[Wed Mar 01 22:20:07.400802 2017] [ssl:warn] [pid 15010] AH01909: RSA certificate configured for 127.0.0.1:443 does NOT include an ID which matches the server name
"""
- layout_test_output_filesystem = {
+ web_test_output_filesystem = {
'/out/layout-test-results/access_log.txt': output_access_log,
'/out/layout-test-results/archived_results.json': output_archived_results_json,
'/out/layout-test-results/error_log.txt': output_error_log,
@@ -1040,11 +1040,11 @@ ADD_RESULTS({
}
def test(self):
- fs = MockFileSystem(self.layout_test_filesystem)
+ fs = MockFileSystem(self.web_test_filesystem)
- merger = merge_results.LayoutTestDirMerger(fs, results_json_value_overrides={'layout_tests_dir': 'src'})
+ merger = merge_results.WebTestDirMerger(fs, results_json_value_overrides={'layout_tests_dir': 'src'})
merger.merge('/out', ['/shards/0', '/shards/1'])
- for fname, contents in self.layout_test_output_filesystem.items():
+ for fname, contents in self.web_test_output_filesystem.items():
self.assertIn(fname, fs.files)
self.assertMultiLineEqual(contents, fs.files[fname])
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py
index c38853af5c0..cd64e3e4e07 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations.py
@@ -26,7 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""A helper class for reading in and dealing with tests expectations for layout tests."""
+"""A helper class for reading in and dealing with tests expectations for web tests."""
from collections import defaultdict
@@ -880,7 +880,7 @@ class TestExpectationsModel(object):
class TestExpectations(object):
"""Test expectations consist of lines with specifications of what
- to expect from layout test cases. The test cases can be directories
+ to expect from web test cases. The test cases can be directories
in which case the expectations apply to all test cases in that
directory and any subdirectory. The format is along the lines of:
@@ -1017,7 +1017,7 @@ class TestExpectations(object):
return set(suffixes)
@staticmethod
- # test_result is an instance of blinkpy.common.net.layout_test_results.LayoutTestResult
+ # test_result is an instance of blinkpy.common.net.web_test_results.WebTestResult
def suffixes_for_test_result(test_result):
suffixes = set()
actual_results = test_result.actual_results()
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py
index a81fbaa7f01..8331deaa53f 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_expectations_unittest.py
@@ -168,8 +168,8 @@ class MiscTests(Base):
def test_parse_warning(self):
try:
filesystem = self._port.host.filesystem
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'disabled-test.html-disabled'), 'content')
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'test-to-rebaseline.html'), 'content')
+ filesystem.write_text_file(filesystem.join(self._port.web_tests_dir(), 'disabled-test.html-disabled'), 'content')
+ filesystem.write_text_file(filesystem.join(self._port.web_tests_dir(), 'test-to-rebaseline.html'), 'content')
self.parse_exp('Bug(user) [ FOO ] failures/expected/text.html [ Failure ]\n'
'Bug(user) non-existent-test.html [ Failure ]\n'
'Bug(user) disabled-test.html-disabled [ Failure ]\n',
@@ -242,7 +242,7 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
self.assert_exp('failures/expected/text.html', FAIL)
self.assertNotIn(
self._port.host.filesystem.join(
- self._port.layout_tests_dir(),
+ self._port.web_tests_dir(),
'failures/expected/text.html'),
self._exp.get_tests_with_result_type(SKIP))
@@ -284,7 +284,7 @@ class SkippedTests(Base):
options=optparse.Values({'ignore_tests': ignore_tests}))
port.host.filesystem.write_text_file(
port.host.filesystem.join(
- port.layout_tests_dir(), 'failures/expected/text.html'),
+ port.web_tests_dir(), 'failures/expected/text.html'),
'foo')
expectations_dict = OrderedDict()
expectations_dict['expectations'] = expectations
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
index fff5ba524ec..9ad7bcc2f4b 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_run_results.py
@@ -61,7 +61,7 @@ class TestRunResults(object):
self.unexpected_failures = 0
self.unexpected_timeouts = 0
- # The wall clock time spent running the tests (layout_test_runner.run()).
+ # The wall clock time spent running the tests (web_test_runner.run()).
self.run_time = 0
# Map of test name to the *last* result for the test.
@@ -365,7 +365,7 @@ def summarize_results(port_obj, expectations, initial_results,
# Does results.html have enough information to compute this itself? (by
# checking total number of results vs. total number of tests?)
results['interrupted'] = initial_results.interrupted
- results['layout_tests_dir'] = port_obj.layout_tests_dir()
+ results['layout_tests_dir'] = port_obj.web_tests_dir()
results['seconds_since_epoch'] = int(time.time())
results['build_number'] = port_obj.get_option('build_number')
results['builder_name'] = port_obj.get_option('builder_name')
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/android.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/android.py
index a89cfb44762..39d20f7d5fe 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/android.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/android.py
@@ -101,11 +101,11 @@ _log = logging.getLogger(__name__)
# This path is defined in Chromium's base/test/test_support_android.cc.
DEVICE_SOURCE_ROOT_DIR = '/data/local/tmp/'
-# The layout tests directory on device, which has two usages:
+# The web tests directory on device, which has two usages:
# 1. as a virtual path in file urls that will be bridged to HTTP.
# 2. pointing to some files that are pushed to the device for tests that
# don't work on file-over-http (e.g. blob protocol tests).
-DEVICE_LAYOUT_TESTS_DIR = DEVICE_SOURCE_ROOT_DIR + RELATIVE_WEB_TESTS
+DEVICE_WEB_TESTS_DIR = DEVICE_SOURCE_ROOT_DIR + RELATIVE_WEB_TESTS
KPTR_RESTRICT_PATH = '/proc/sys/kernel/kptr_restrict'
@@ -143,7 +143,7 @@ TEST_RESOURCES_TO_PUSH = [
]
-# Information required when running layout tests using content_shell as the test runner.
+# Information required when running web tests using content_shell as the test runner.
class ContentShellDriverDetails():
def device_cache_directory(self):
@@ -187,7 +187,7 @@ class ContentShellDriverDetails():
# instances and whether the device has been set up.
class AndroidDevices(object):
# Percentage of battery a device needs to have in order for it to be considered
- # to participate in running the layout tests.
+ # to participate in running the web tests.
MINIMUM_BATTERY_PERCENTAGE = 30
def __init__(self, default_devices=None, debug_logging=False):
@@ -258,7 +258,7 @@ class AndroidPort(base.Port):
self._dump_reader = DumpReaderAndroid(host, self._build_path())
if self.driver_name() != self.CONTENT_SHELL_NAME:
- raise AssertionError('Layout tests on Android only support content_shell as the driver.')
+ raise AssertionError('Web tests on Android only support content_shell as the driver.')
self._driver_details = ContentShellDriverDetails()
@@ -404,8 +404,8 @@ class AndroidPort(base.Port):
# - the test resources
host_device_tuples.extend(
- (self.host.filesystem.join(self.layout_tests_dir(), resource),
- posixpath.join(DEVICE_LAYOUT_TESTS_DIR, resource))
+ (self.host.filesystem.join(self.web_tests_dir(), resource),
+ posixpath.join(DEVICE_WEB_TESTS_DIR, resource))
for resource in TEST_RESOURCES_TO_PUSH)
# ... and then push them to the device.
@@ -467,13 +467,13 @@ class AndroidPort(base.Port):
def requires_http_server(self):
"""Chromium Android runs tests on devices, and uses the HTTP server to
- serve the actual layout tests to the test driver.
+ serve the actual web tests to the test driver.
"""
return True
def start_http_server(self, additional_dirs, number_of_drivers):
additional_dirs[PERF_TEST_PATH_PREFIX] = self._perf_tests_dir()
- additional_dirs[WEB_TESTS_PATH_PREFIX] = self.layout_tests_dir()
+ additional_dirs[WEB_TESTS_PATH_PREFIX] = self.web_tests_dir()
super(AndroidPort, self).start_http_server(additional_dirs, number_of_drivers)
def create_driver(self, worker_number, no_timeout=False):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py
index 26ad8ed0404..d97470d7e25 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py
@@ -29,7 +29,7 @@
"""Abstract base class for Port classes.
The Port classes encapsulate Port-specific (platform-specific) behavior
-in the layout test infrastructure.
+in the web test infrastructure.
"""
import collections
@@ -106,7 +106,7 @@ SXG_FINGERPRINT = '55qC1nKu2A88ESbFmk5sTPQS/ScG+8DD7P+2bgFA9iM='
SXG_WPT_FINGERPRINT = '0Rt4mT6SJXojEMHTnKnlJ/hBKMBcI4kteBlhR1eTTdk='
class Port(object):
- """Abstract class for Port-specific hooks for the layout_test package."""
+ """Abstract class for Port-specific hooks for the web_test package."""
# Subclasses override this. This should indicate the basic implementation
# part of the port name, e.g., 'mac', 'win', 'gtk'; there is one unique
@@ -234,7 +234,7 @@ class Port(object):
is the flag in web_tests/additional-driver-flag.setting, if present, otherwise the
first flag passed by --additional-driver-flag.
"""
- flag_file = self._filesystem.join(self.layout_tests_dir(), 'additional-driver-flag.setting')
+ flag_file = self._filesystem.join(self.web_tests_dir(), 'additional-driver-flag.setting')
if self._filesystem.exists(flag_file):
flag = self._filesystem.read_text_file(flag_file).strip()
if flag:
@@ -560,7 +560,7 @@ class Port(object):
# If it wasn't found in a platform directory, return the expected
# result in the test directory, even if no such file actually exists.
- platform_dir = self.layout_tests_dir()
+ platform_dir = self.web_tests_dir()
if self._filesystem.exists(self._filesystem.join(platform_dir, baseline_filename)):
baselines.append((platform_dir, baseline_filename))
@@ -609,7 +609,7 @@ class Port(object):
return self.expected_filename(actual_test_name, extension, return_default, match=match)
if return_default:
- return self._filesystem.join(self.layout_tests_dir(), baseline_filename)
+ return self._filesystem.join(self.web_tests_dir(), baseline_filename)
return None
def fallback_expected_filename(self, test_name, extension):
@@ -698,7 +698,7 @@ class Port(object):
return []
path_in_wpt = match.group(1)
for expectation, ref_path_in_wpt in self._wpt_manifest().extract_reference_list(path_in_wpt):
- ref_absolute_path = self._filesystem.join(self.layout_tests_dir(), 'external/wpt' + ref_path_in_wpt)
+ ref_absolute_path = self._filesystem.join(self.web_tests_dir(), 'external/wpt' + ref_path_in_wpt)
reftest_list.append((expectation, ref_absolute_path))
return reftest_list
@@ -738,7 +738,7 @@ class Port(object):
self.is_test_file(fs, dirname, filename)
and not re.search(r'[/\\]external[/\\]wpt([/\\].*)?$', dirname)
)
- files = find_files.find(self._filesystem, self.layout_tests_dir(), paths, skipped_directories,
+ files = find_files.find(self._filesystem, self.web_tests_dir(), paths, skipped_directories,
is_non_wpt_real_test_file, self.test_key)
return [self.relative_test_filename(f) for f in files]
@@ -796,9 +796,9 @@ class Port(object):
@memoized
def _wpt_manifest(self):
- manifest_path = self._filesystem.join(self.layout_tests_dir(), 'external', 'wpt', 'MANIFEST.json')
+ manifest_path = self._filesystem.join(self.web_tests_dir(), 'external', 'wpt', 'MANIFEST.json')
if not self._filesystem.exists(manifest_path):
- _log.error('Manifest not found at %s. See http://crbug.com/698294', manifest_path)
+ _log.error('Manifest not found at %s. Remove the --no-manifest-update argument to generate it.', manifest_path)
return WPTManifest('{}')
return WPTManifest(self._filesystem.read_text_file(manifest_path))
@@ -844,9 +844,9 @@ class Port(object):
def test_dirs(self):
"""Returns the list of top-level test directories."""
- layout_tests_dir = self.layout_tests_dir()
+ web_tests_dir = self.web_tests_dir()
fs = self._filesystem
- return [d for d in fs.listdir(layout_tests_dir) if fs.isdir(fs.join(layout_tests_dir, d))]
+ return [d for d in fs.listdir(web_tests_dir) if fs.isdir(fs.join(web_tests_dir, d))]
@memoized
def test_isfile(self, test_name):
@@ -909,11 +909,11 @@ class Port(object):
def _perf_tests_dir(self):
return self._path_finder.perf_tests_dir()
- def layout_tests_dir(self):
- custom_layout_tests_dir = self.get_option('layout_tests_directory')
- if custom_layout_tests_dir:
- return custom_layout_tests_dir
- return self._path_finder.layout_tests_dir()
+ def web_tests_dir(self):
+ custom_web_tests_dir = self.get_option('layout_tests_directory')
+ if custom_web_tests_dir:
+ return custom_web_tests_dir
+ return self._path_finder.web_tests_dir()
def skips_test(self, test):
"""Checks whether the given test is skipped for this port.
@@ -950,7 +950,7 @@ class Port(object):
return test not in smoke_tests
def path_to_smoke_tests_file(self):
- return self._filesystem.join(self.layout_tests_dir(), 'SmokeTests')
+ return self._filesystem.join(self.web_tests_dir(), 'SmokeTests')
def skipped_in_never_fix_tests(self, test):
"""Checks if the test is marked as WontFix for this port.
@@ -974,7 +974,7 @@ class Port(object):
return False
def path_to_never_fix_tests_file(self):
- return self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests')
+ return self._filesystem.join(self.web_tests_dir(), 'NeverFixTests')
def name(self):
"""Returns a name that uniquely identifies this particular type of port.
@@ -1014,8 +1014,8 @@ class Port(object):
"""
# Ports that run on windows need to override this method to deal with
# filenames with backslashes in them.
- if filename.startswith(self.layout_tests_dir()):
- return self.host.filesystem.relpath(filename, self.layout_tests_dir())
+ if filename.startswith(self.web_tests_dir()):
+ return self.host.filesystem.relpath(filename, self.web_tests_dir())
else:
return self.host.filesystem.abspath(filename)
@@ -1025,7 +1025,7 @@ class Port(object):
This is the inverse of relative_test_filename().
"""
- return self._filesystem.join(self.layout_tests_dir(), test_name)
+ return self._filesystem.join(self.web_tests_dir(), test_name)
@memoized
def args_for_test(self, test_name):
@@ -1128,7 +1128,6 @@ class Port(object):
if self.host.platform.is_win():
variables_to_copy += [
'PATH',
- 'GYP_DEFINES', # Required to locate win sdk.
]
for variable in variables_to_copy:
@@ -1211,6 +1210,8 @@ class Port(object):
httpd_path = self.path_to_apache()
intentional_syntax_error = 'INTENTIONAL_SYNTAX_ERROR'
cmd = [httpd_path,
+ '-t',
+ '-f', self.path_to_apache_config_file(),
'-C', 'HttpProtocolOptions Unsafe',
'-C', intentional_syntax_error]
env = self.setup_environ_for_server()
@@ -1284,14 +1285,14 @@ class Port(object):
flag = self.primary_driver_flag()
if flag:
return self._filesystem.join(
- self.layout_tests_dir(), self.FLAG_EXPECTATIONS_PREFIX, flag.lstrip('-'))
+ self.web_tests_dir(), self.FLAG_EXPECTATIONS_PREFIX, flag.lstrip('-'))
def _flag_specific_baseline_search_path(self):
flag = self.primary_driver_flag()
if not flag:
return []
flag_dir = self._filesystem.join(
- self.layout_tests_dir(), 'flag-specific', flag.lstrip('-'))
+ self.web_tests_dir(), 'flag-specific', flag.lstrip('-'))
platform_dirs = [
self._filesystem.join(flag_dir, 'platform', platform_dir)
for platform_dir in self.FALLBACK_PATHS[self.version()]]
@@ -1331,7 +1332,7 @@ class Port(object):
"""Returns an OrderedDict of name -> expectations strings."""
expectations = self.expectations_dict()
- flag_path = self._filesystem.join(self.layout_tests_dir(), 'FlagExpectations')
+ flag_path = self._filesystem.join(self.web_tests_dir(), 'FlagExpectations')
if not self._filesystem.exists(flag_path):
return expectations
@@ -1381,9 +1382,9 @@ class Port(object):
"""
return filter(None, [
self.path_to_generic_test_expectations_file(),
- self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests'),
- self._filesystem.join(self.layout_tests_dir(), 'StaleTestExpectations'),
- self._filesystem.join(self.layout_tests_dir(), 'SlowTests'),
+ self._filesystem.join(self.web_tests_dir(), 'NeverFixTests'),
+ self._filesystem.join(self.web_tests_dir(), 'StaleTestExpectations'),
+ self._filesystem.join(self.web_tests_dir(), 'SlowTests'),
self._flag_specific_expectations_path()
])
@@ -1393,14 +1394,14 @@ class Port(object):
These paths are passed via --additional-expectations on some builders.
"""
return [
- self._filesystem.join(self.layout_tests_dir(), 'ASANExpectations'),
- self._filesystem.join(self.layout_tests_dir(), 'LeakExpectations'),
- self._filesystem.join(self.layout_tests_dir(), 'MSANExpectations'),
+ self._filesystem.join(self.web_tests_dir(), 'ASANExpectations'),
+ self._filesystem.join(self.web_tests_dir(), 'LeakExpectations'),
+ self._filesystem.join(self.web_tests_dir(), 'MSANExpectations'),
]
@memoized
def path_to_generic_test_expectations_file(self):
- return self._filesystem.join(self.layout_tests_dir(), 'TestExpectations')
+ return self._filesystem.join(self.web_tests_dir(), 'TestExpectations')
def repository_path(self):
"""Returns the repository path for the chromium code base."""
@@ -1473,7 +1474,7 @@ class Port(object):
"""Return the absolute path to the top of the baseline tree for a
given platform directory.
"""
- return self._filesystem.join(self.layout_tests_dir(), 'platform', platform_dir)
+ return self._filesystem.join(self.web_tests_dir(), 'platform', platform_dir)
def _driver_class(self):
"""Returns the port's driver implementation."""
@@ -1562,7 +1563,7 @@ class Port(object):
def virtual_test_suites(self):
if self._virtual_test_suites is None:
- path_to_virtual_test_suites = self._filesystem.join(self.layout_tests_dir(), 'VirtualTestSuites')
+ path_to_virtual_test_suites = self._filesystem.join(self.web_tests_dir(), 'VirtualTestSuites')
assert self._filesystem.exists(path_to_virtual_test_suites), path_to_virtual_test_suites + ' not found'
try:
test_suite_json = json.loads(self._filesystem.read_text_file(path_to_virtual_test_suites))
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py
index 6b7be1ea917..60a10f8fea4 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py
@@ -42,7 +42,7 @@ from blinkpy.common.system.system_host import SystemHost
from blinkpy.common.system.system_host_mock import MockSystemHost
from blinkpy.web_tests.models.test_input import TestInput
from blinkpy.web_tests.port.base import Port, VirtualTestSuite
-from blinkpy.web_tests.port.test import add_unit_tests_to_mock_filesystem, LAYOUT_TEST_DIR, TestPort
+from blinkpy.web_tests.port.test import add_unit_tests_to_mock_filesystem, WEB_TEST_DIR, TestPort
MOCK_WEB_TESTS = '/mock-checkout/' + RELATIVE_WEB_TESTS
@@ -65,8 +65,8 @@ class PortTest(LoggingTestCase):
def test_test_dirs(self):
port = self.make_port()
- port.host.filesystem.write_text_file(port.layout_tests_dir() + '/canvas/test', '')
- port.host.filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/test', '')
+ port.host.filesystem.write_text_file(port.web_tests_dir() + '/canvas/test', '')
+ port.host.filesystem.write_text_file(port.web_tests_dir() + '/css2.1/test', '')
dirs = port.test_dirs()
self.assertIn('canvas', dirs)
self.assertIn('css2.1', dirs)
@@ -465,7 +465,7 @@ class PortTest(LoggingTestCase):
@staticmethod
def _add_manifest_to_mock_file_system(filesystem):
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/MANIFEST.json', json.dumps({
+ filesystem.write_text_file(WEB_TEST_DIR + '/external/wpt/MANIFEST.json', json.dumps({
'items': {
'testharness': {
'dom/ranges/Range-attributes.html': [
@@ -499,9 +499,9 @@ class PortTest(LoggingTestCase):
],
},
}}))
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/dom/ranges/Range-attributes.html', '')
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/console/console-is-a-namespace.any.js', '')
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/common/blank.html', 'foo')
+ filesystem.write_text_file(WEB_TEST_DIR + '/external/wpt/dom/ranges/Range-attributes.html', '')
+ filesystem.write_text_file(WEB_TEST_DIR + '/external/wpt/console/console-is-a-namespace.any.js', '')
+ filesystem.write_text_file(WEB_TEST_DIR + '/external/wpt/common/blank.html', 'foo')
def test_find_none_if_not_in_manifest(self):
port = self.make_port(with_tests=True)
@@ -610,16 +610,16 @@ class PortTest(LoggingTestCase):
PortTest._add_manifest_to_mock_file_system(filesystem)
# A file not in MANIFEST.json is not a test even if it has .html suffix.
- self.assertFalse(port.is_test_file(filesystem, LAYOUT_TEST_DIR + '/external/wpt/common', 'blank.html'))
+ self.assertFalse(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt/common', 'blank.html'))
# .js is not a test in general, but it is if MANIFEST.json contains an
# entry for it.
- self.assertTrue(port.is_test_file(filesystem, LAYOUT_TEST_DIR + '/external/wpt/console', 'console-is-a-namespace.any.js'))
+ self.assertTrue(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt/console', 'console-is-a-namespace.any.js'))
# A file in external/wpt, not a sub directory.
- self.assertFalse(port.is_test_file(filesystem, LAYOUT_TEST_DIR + '/external/wpt', 'testharness_runner.html'))
+ self.assertFalse(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt', 'testharness_runner.html'))
# A file in external/wpt_automation.
- self.assertTrue(port.is_test_file(filesystem, LAYOUT_TEST_DIR + '/external/wpt_automation', 'foo.html'))
+ self.assertTrue(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt_automation', 'foo.html'))
def test_is_wpt_test(self):
self.assertTrue(Port.is_wpt_test('external/wpt/dom/ranges/Range-attributes.html'))
@@ -673,22 +673,22 @@ class PortTest(LoggingTestCase):
def test_reference_files(self):
port = self.make_port(with_tests=True)
self.assertEqual(port.reference_files('passes/svgreftest.svg'),
- [('==', port.layout_tests_dir() + '/passes/svgreftest-expected.svg')])
+ [('==', port.web_tests_dir() + '/passes/svgreftest-expected.svg')])
self.assertEqual(port.reference_files('passes/xhtreftest.svg'),
- [('==', port.layout_tests_dir() + '/passes/xhtreftest-expected.html')])
+ [('==', port.web_tests_dir() + '/passes/xhtreftest-expected.html')])
self.assertEqual(port.reference_files('passes/phpreftest.php'),
- [('!=', port.layout_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')])
+ [('!=', port.web_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')])
def test_reference_files_from_manifest(self):
port = self.make_port(with_tests=True)
PortTest._add_manifest_to_mock_file_system(port.host.filesystem)
self.assertEqual(port.reference_files('external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L.html'),
- [('==', port.layout_tests_dir() +
+ [('==', port.web_tests_dir() +
'/external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html')])
self.assertEqual(port.reference_files('virtual/layout_ng/' +
'external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L.html'),
- [('==', port.layout_tests_dir() +
+ [('==', port.web_tests_dir() +
'/external/wpt/html/dom/elements/global-attributes/dir_auto-EN-L-ref.html')])
def test_operating_system(self):
@@ -813,7 +813,7 @@ class PortTest(LoggingTestCase):
def test_good_virtual_test_suite_file(self):
port = self.make_port()
port.host.filesystem.write_text_file(
- port.host.filesystem.join(port.layout_tests_dir(), 'VirtualTestSuites'),
+ port.host.filesystem.join(port.web_tests_dir(), 'VirtualTestSuites'),
'[{"prefix": "bar", "base": "fast/bar", "args": ["--bar"]}]')
# If this call returns successfully, we found and loaded the web_tests/VirtualTestSuites.
@@ -822,7 +822,7 @@ class PortTest(LoggingTestCase):
def test_duplicate_virtual_test_suite_in_file(self):
port = self.make_port()
port.host.filesystem.write_text_file(
- port.host.filesystem.join(port.layout_tests_dir(), 'VirtualTestSuites'),
+ port.host.filesystem.join(port.web_tests_dir(), 'VirtualTestSuites'),
'['
'{"prefix": "bar", "base": "fast/bar", "args": ["--bar"]},'
'{"prefix": "bar", "base": "fast/bar", "args": ["--bar"]}'
@@ -833,7 +833,7 @@ class PortTest(LoggingTestCase):
def test_virtual_test_suite_file_is_not_json(self):
port = self.make_port()
port.host.filesystem.write_text_file(
- port.host.filesystem.join(port.layout_tests_dir(), 'VirtualTestSuites'),
+ port.host.filesystem.join(port.web_tests_dir(), 'VirtualTestSuites'),
'{[{[')
self.assertRaises(ValueError, port.virtual_test_suites)
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test.py
index 956cae91f52..ea773718930 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test.py
@@ -53,7 +53,7 @@ class BrowserTestPortOverrides(object):
def _driver_class(self):
return browser_test_driver.BrowserTestDriver
- def layout_tests_dir(self):
+ def web_tests_dir(self):
"""Overridden function from the base port class. Redirects everything
to src/chrome/test/data/printing/layout_tests.
"""
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_driver.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_driver.py
index b580a810c5a..4cdaa786864 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_driver.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_driver.py
@@ -43,7 +43,7 @@ class BrowserTestDriver(Driver):
assign it to the stdin of the process that is owned by this driver's
server process.
"""
- # FIXME(ivandavid): Need to handle case where the layout test doesn't
+ # FIXME(ivandavid): Need to handle case where the web test doesn't
# get a file name.
new_cmd_line = self.cmd_line(per_test_args)
if not self._server_process or new_cmd_line != self._current_cmd_line:
@@ -52,7 +52,7 @@ class BrowserTestDriver(Driver):
self._open_stdin_path(deadline)
# Gets the path of the directory that the file for stdin communication is
- # in. Since the browser test cannot clean it up, the layout test framework
+ # in. Since the browser test cannot clean it up, the web test framework
# will. Everything the browser test uses is stored in the same directory as
# the stdin file, so deleting that directory recursively will remove all the
# other temp data, like the printed pdf. This function assumes the correct
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_unittest.py
index 71e9f80ed6f..b1a443704c3 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/browser_test_unittest.py
@@ -51,8 +51,8 @@ class _BrowserTestTestCaseMixin(object):
self.assertTrue(isinstance(self.make_port(options=optparse.Values({'driver_name': 'browser_tests'})
).create_driver(1), browser_test_driver.BrowserTestDriver))
- def test_layout_tests_dir(self):
- self.assertTrue(self.make_port().layout_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
+ def test_web_tests_dir(self):
+ self.assertTrue(self.make_port().web_tests_dir().endswith('chrome/test/data/printing/layout_tests'))
def test_virtual_test_suites(self):
# The browser_tests port do not use virtual test suites, so we are just testing the stub.
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver.py
index 249d5d79748..d966ec8cf9b 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver.py
@@ -329,15 +329,15 @@ class Driver(object):
'https://%s:%d/' % (hostname, secure_port)]
def uri_to_test(self, uri):
- """Return the base layout test name for a given URI.
+ """Return the base web test name for a given URI.
This returns the test name for a given URI, e.g., if you passed in
- "file:///src/LayoutTests/fast/html/keygen.html" it would return
+ "file:///src/web_tests/fast/html/keygen.html" it would return
"fast/html/keygen.html".
"""
if uri.startswith('file:///'):
- prefix = path.abspath_to_uri(self._port.host.platform, self._port.layout_tests_dir())
+ prefix = path.abspath_to_uri(self._port.host.platform, self._port.web_tests_dir())
if not prefix.endswith('/'):
prefix += '/'
return uri[len(prefix):]
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py
index 48e3e4df5b6..45fe2ecda67 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/driver_unittest.py
@@ -57,7 +57,7 @@ class DriverTest(unittest.TestCase):
def test_test_to_uri(self):
port = self.make_port()
driver = Driver(port, None)
- self.assertEqual(driver.test_to_uri('foo/bar.html'), 'file://%s/foo/bar.html' % port.layout_tests_dir())
+ self.assertEqual(driver.test_to_uri('foo/bar.html'), 'file://%s/foo/bar.html' % port.web_tests_dir())
self.assertEqual(driver.test_to_uri('http/tests/foo.html'), 'http://127.0.0.1:8000/foo.html')
self.assertEqual(driver.test_to_uri('http/tests/https/bar.html'), 'https://127.0.0.1:8443/https/bar.html')
self.assertEqual(driver.test_to_uri('http/tests/bar.https.html'), 'https://127.0.0.1:8443/bar.https.html')
@@ -69,7 +69,7 @@ class DriverTest(unittest.TestCase):
def test_uri_to_test(self):
port = self.make_port()
driver = Driver(port, None)
- self.assertEqual(driver.uri_to_test('file://%s/foo/bar.html' % port.layout_tests_dir()), 'foo/bar.html')
+ self.assertEqual(driver.uri_to_test('file://%s/foo/bar.html' % port.web_tests_dir()), 'foo/bar.html')
self.assertEqual(driver.uri_to_test('http://127.0.0.1:8000/foo.html'), 'http/tests/foo.html')
self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/https/bar.html'), 'http/tests/https/bar.html')
self.assertEqual(driver.uri_to_test('https://127.0.0.1:8443/bar.https.html'), 'http/tests/bar.https.html')
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py
index 945d65778b1..5233f4dc508 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/fuchsia.py
@@ -75,15 +75,17 @@ CONTENT_SHELL_PACKAGE_PATH = 'gen/content/shell/content_shell/content_shell.far'
# WEB_TEST_PATH_PREFIX should be matched to the local directory name of
# web_tests because some tests and test_runner find test root directory
# with it.
-PERF_TEST_PATH_PREFIX = '/PerformanceTests'
-WEB_TESTS_PATH_PREFIX = '/' + WEB_TESTS_LAST_COMPONENT
+WEB_TESTS_PATH_PREFIX = '/third_party/blink/' + WEB_TESTS_LAST_COMPONENT
# Paths to the directory where the fonts are copied to. Must match the path in
# content/shell/app/blink_test_platform_support_fuchsia.cc .
FONTS_DEVICE_PATH = '/system/fonts'
-# Number of content_shell instances to run in parallel.
-MAX_WORKERS = 8
+# Number of CPU cores in qemu.
+CPU_CORES = 4
+
+# Number of content_shell instances to run in parallel. 1 per CPU core.
+MAX_WORKERS = CPU_CORES
PROCESS_START_TIMEOUT = 20
@@ -117,13 +119,13 @@ class SubprocessOutputLogger(object):
def close(self):
self._process.kill()
-
class _TargetHost(object):
def __init__(self, build_path, ports_to_forward):
try:
self._target = None
self._target = qemu_target.QemuTarget(
- build_path, 'x64', require_kvm=True, ram_size_mb=8192)
+ build_path, 'x64', cpu_cores=CPU_CORES, system_log_file=None,
+ require_kvm=True, ram_size_mb=8192)
self._target.Start()
self._setup_target(build_path, ports_to_forward)
except:
@@ -163,13 +165,17 @@ class _TargetHost(object):
raise Exception('Failed to install content_shell: %s' % \
'\n'.join(output))
+ # Process will be forked for each worker, which may make QemuTarget
+ # unusable (e.g. waitpid() for qemu process returns ECHILD after
+ # fork() ). Save command runner before fork()ing, to use it later to
+ # connect to the target.
+ self.target_command_runner = self._target.GetCommandRunner()
+
+ def run_command(self, command):
+ return self.target_command_runner.RunCommandPiped(
+ command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
- def run_command(self, *args, **kvargs):
- return self._target.RunCommandPiped(*args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- **kvargs)
def cleanup(self):
if self._target:
# TODO(sergeyu): Currently __init__() always starts Qemu, so we can
@@ -242,14 +248,24 @@ class FuchsiaPort(base.Port):
# Run a single qemu instance.
return min(MAX_WORKERS, requested_num_workers)
+ def default_timeout_ms(self):
+ # Use 20s timeout instead of the default 6s. This is necessary because
+ # the tests are executed in qemu, so they run slower compared to other
+ # platforms.
+ return 20 * 1000
+
def requires_http_server(self):
"""HTTP server is always required to avoid copying the tests to the VM.
"""
return True
def start_http_server(self, additional_dirs, number_of_drivers):
- additional_dirs[PERF_TEST_PATH_PREFIX] = self._perf_tests_dir()
- additional_dirs[WEB_TESTS_PATH_PREFIX] = self.layout_tests_dir()
+ additional_dirs['/third_party/blink/PerformanceTests'] = \
+ self._perf_tests_dir()
+ additional_dirs[WEB_TESTS_PATH_PREFIX] = self.web_tests_dir()
+ additional_dirs['/gen'] = self.generated_sources_directory()
+ additional_dirs['/third_party/blink'] = \
+ self._path_from_chromium_base('third_party', 'blink')
super(FuchsiaPort, self).start_http_server(
additional_dirs, number_of_drivers)
@@ -272,14 +288,16 @@ class ChromiumFuchsiaDriver(driver.Driver):
port, worker_number, no_timeout)
def _base_cmd_line(self):
- return ['run', 'content_shell']
+ return ['run',
+ 'fuchsia-pkg://fuchsia.com/content_shell#meta/content_shell.cmx',
+ '--ozone-platform=headless']
def _command_from_driver_input(self, driver_input):
command = super(ChromiumFuchsiaDriver, self)._command_from_driver_input(
driver_input)
if command.startswith('/'):
relative_test_filename = \
- os.path.relpath(command, self._port.layout_tests_dir())
+ os.path.relpath(command, self._port.web_tests_dir())
command = 'http://127.0.0.1:8000' + WEB_TESTS_PATH_PREFIX + \
'/' + relative_test_filename
return command
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py
index c68c610bab9..11378b8d31a 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py
@@ -249,9 +249,9 @@ class PortTestCase(LoggingTestCase):
port = self.make_port()
self.assertEqual(port.expectations_files(), [
port.path_to_generic_test_expectations_file(),
- port.host.filesystem.join(port.layout_tests_dir(), 'NeverFixTests'),
- port.host.filesystem.join(port.layout_tests_dir(), 'StaleTestExpectations'),
- port.host.filesystem.join(port.layout_tests_dir(), 'SlowTests'),
+ port.host.filesystem.join(port.web_tests_dir(), 'NeverFixTests'),
+ port.host.filesystem.join(port.web_tests_dir(), 'StaleTestExpectations'),
+ port.host.filesystem.join(port.web_tests_dir(), 'SlowTests'),
])
def test_expectations_ordering(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/test.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/test.py
index d2bb138f69a..f7b6b6de907 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/test.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/test.py
@@ -37,10 +37,10 @@ from blinkpy.web_tests.port.base import Port, VirtualTestSuite
from blinkpy.web_tests.port.driver import DeviceFailure, Driver, DriverOutput
-# Here we use a non-standard location for the layout tests, to ensure that
+# Here we use a non-standard location for the web tests, to ensure that
# this works. The path contains a '.' in the name because we've seen bugs
# related to this before.
-LAYOUT_TEST_DIR = '/test.checkout/wtests'
+WEB_TEST_DIR = '/test.checkout/wtests'
PERF_TEST_DIR = '/test.checkout/PerformanceTests'
@@ -278,9 +278,9 @@ layer at (0,0) size 800x34
# we don't need a real filesystem to run the tests.
def add_unit_tests_to_mock_filesystem(filesystem):
# Add the test_expectations file.
- filesystem.maybe_make_directory(LAYOUT_TEST_DIR)
- if not filesystem.exists(LAYOUT_TEST_DIR + '/TestExpectations'):
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/TestExpectations', """
+ filesystem.maybe_make_directory(WEB_TEST_DIR)
+ if not filesystem.exists(WEB_TEST_DIR + '/TestExpectations'):
+ filesystem.write_text_file(WEB_TEST_DIR + '/TestExpectations', """
Bug(test) failures/expected/audio.html [ Failure ]
Bug(test) failures/expected/crash.html [ Crash ]
Bug(test) failures/expected/crash_then_text.html [ Failure ]
@@ -305,8 +305,8 @@ Bug(test) passes/text.html [ Pass ]
Bug(test) virtual/skipped/failures/expected [ Skip ]
""")
- if not filesystem.exists(LAYOUT_TEST_DIR + '/NeverFixTests'):
- filesystem.write_text_file(LAYOUT_TEST_DIR + '/NeverFixTests', """
+ if not filesystem.exists(WEB_TEST_DIR + '/NeverFixTests'):
+ filesystem.write_text_file(WEB_TEST_DIR + '/NeverFixTests', """
Bug(test) failures/expected/keyboard.html [ WontFix ]
Bug(test) failures/expected/exception.html [ WontFix ]
Bug(test) failures/expected/device_failure.html [ WontFix ]
@@ -315,10 +315,10 @@ Bug(test) failures/expected/device_failure.html [ WontFix ]
# FIXME: This test was only being ignored because of missing a leading '/'.
# Fixing the typo causes several tests to assert, so disabling the test entirely.
# Add in a file should be ignored by port.find_test_files().
- #files[LAYOUT_TEST_DIR + '/userscripts/resources/iframe.html'] = 'iframe'
+ #files[WEB_TEST_DIR + '/userscripts/resources/iframe.html'] = 'iframe'
def add_file(test, suffix, contents):
- dirname = filesystem.join(LAYOUT_TEST_DIR, test.name[0:test.name.rfind('/')])
+ dirname = filesystem.join(WEB_TEST_DIR, test.name[0:test.name.rfind('/')])
base = test.base
filesystem.maybe_make_directory(dirname)
filesystem.write_binary_file(filesystem.join(dirname, base + suffix), contents)
@@ -334,7 +334,7 @@ Bug(test) failures/expected/device_failure.html [ WontFix ]
if test.expected_image:
add_file(test, '-expected.png', test.expected_image)
- filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'virtual_passes',
+ filesystem.write_text_file(filesystem.join(WEB_TEST_DIR, 'virtual', 'virtual_passes',
'passes', 'args-expected.txt'), 'args-txt --virtual-arg')
# Clear the list of written files so that we can watch what happens during testing.
filesystem.clear_written_files()
@@ -364,7 +364,7 @@ class TestPort(Port):
self._tests = unit_test_list()
self._flakes = set()
- # FIXME: crbug.com/279494. This needs to be in the "real layout tests
+ # FIXME: crbug.com/279494. This needs to be in the "real web tests
# dir" in a mock filesystem, rather than outside of the checkout, so
# that tests that want to write to a TestExpectations file can share
# this between "test" ports and "real" ports. This is the result of
@@ -373,7 +373,7 @@ class TestPort(Port):
# test ports. rebaseline_unittest.py needs to not mix both "real" ports
# and "test" ports
- self._generic_expectations_path = LAYOUT_TEST_DIR + '/TestExpectations'
+ self._generic_expectations_path = WEB_TEST_DIR + '/TestExpectations'
self._results_directory = None
self._operating_system = 'mac'
@@ -439,8 +439,8 @@ class TestPort(Port):
return ('< %s\n---\n> %s\n' % (expected_contents, actual_contents), None)
return (None, None)
- def layout_tests_dir(self):
- return LAYOUT_TEST_DIR
+ def web_tests_dir(self):
+ return WEB_TEST_DIR
def _perf_tests_dir(self):
return PERF_TEST_DIR
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/port/win.py b/chromium/third_party/blink/tools/blinkpy/web_tests/port/win.py
index 063211e70cf..f235d47cb5f 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/port/win.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/port/win.py
@@ -160,7 +160,7 @@ class WinPort(base.Port):
return 'win'
def relative_test_filename(self, filename):
- path = filename[len(self.layout_tests_dir()) + 1:]
+ path = filename[len(self.web_tests_dir()) + 1:]
return path.replace('\\', '/')
def uses_apache(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times.py b/chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times.py
index d8b88c819f8..d8b88c819f8 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times.py
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times_unittest.py
index aab2bb3bfb6..a291b5927e7 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/print_layout_test_times_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/print_web_test_times_unittest.py
@@ -29,10 +29,10 @@
import unittest
from blinkpy.common.host_mock import MockHost
-from blinkpy.web_tests.print_layout_test_times import main
+from blinkpy.web_tests.print_web_test_times import main
-class PrintLayoutTestTimesTest(unittest.TestCase):
+class PrintWebTestTimesTest(unittest.TestCase):
def check(self, args, expected_output, files=None):
host = MockHost()
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests.py b/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests.py
index fac537df51f..00a33b66d18 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests.py
@@ -114,7 +114,7 @@ def parse_args(args):
action='append',
default=[],
dest='adb_devices',
- help='Run Android layout tests on these devices'),
+ help='Run Android web tests on these devices'),
# FIXME: Flip this to be off by default once we can log the
# device setup more cleanly.
optparse.make_option(
@@ -300,7 +300,7 @@ def parse_args(args):
help='Number of times to run the set of tests (e.g. ABCABCABC)'),
optparse.make_option(
'--layout-tests-directory',
- help=('Path to a custom layout tests directory')),
+ help=('Path to a custom web tests directory')),
optparse.make_option(
'--max-locked-shards',
type='int',
@@ -464,7 +464,17 @@ def parse_args(args):
'--zero-tests-executed-ok',
action='store_true',
help='If set, exit with a success code when no tests are run.'
- ' Used on trybots when layout tests are retried without patch.')
+ ' Used on trybots when web tests are retried without patch.')
+ ]))
+
+ option_group_definitions.append(
+ ('web-platform-tests (WPT) Options', [
+ optparse.make_option(
+ '--no-manifest-update',
+ dest='manifest_update',
+ action='store_false',
+ default=True,
+ help=('Do not update the web-platform-tests MANIFEST.json.')),
]))
# FIXME: Move these into json_results_generator.py.
@@ -499,7 +509,7 @@ def parse_args(args):
option_parser = optparse.OptionParser(
prog='run_web_tests.py',
usage='%prog [options] [tests]',
- description='Runs Blink layout tests as described in docs/testing/web_tests.md')
+ description='Runs Blink web tests as described in docs/testing/web_tests.md')
for group_name, group_options in option_group_definitions:
option_group = optparse.OptionGroup(option_parser, group_name)
@@ -564,7 +574,7 @@ def _set_up_derived_options(port, options, args):
if not options.test_list:
options.test_list = []
- options.test_list.append(port.host.filesystem.join(port.layout_tests_dir(), 'SmokeTests'))
+ options.test_list.append(port.host.filesystem.join(port.web_tests_dir(), 'SmokeTests'))
if not options.skipped:
options.skipped = 'always'
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests_unittest.py
index 9a79bfe490c..e85737d90c6 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/run_webkit_tests_unittest.py
@@ -581,7 +581,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_smoke_test(self):
host = MockHost()
- smoke_test_filename = test.LAYOUT_TEST_DIR + '/SmokeTests'
+ smoke_test_filename = test.WEB_TEST_DIR + '/SmokeTests'
host.filesystem.write_text_file(smoke_test_filename, 'passes/text.html\n')
# Test the default smoke testing.
@@ -612,7 +612,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_smoke_test_default_retry(self):
host = MockHost()
- smoke_test_filename = test.LAYOUT_TEST_DIR + '/SmokeTests'
+ smoke_test_filename = test.WEB_TEST_DIR + '/SmokeTests'
host.filesystem.write_text_file(
smoke_test_filename, 'failures/unexpected/text-image-checksum.html\n')
@@ -971,7 +971,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_reftest_mismatching_both_text_and_pixel(self):
test_name = 'failures/unexpected/reftest.html'
host = MockHost()
- host.filesystem.write_text_file(test.LAYOUT_TEST_DIR + '/failures/unexpected/reftest-expected.txt', 'mismatch')
+ host.filesystem.write_text_file(test.WEB_TEST_DIR + '/failures/unexpected/reftest-expected.txt', 'mismatch')
run_details, _, _ = logging_run([test_name], tests_included=True, host=host)
self.assertNotEqual(run_details.exit_code, 0)
self.assertEqual(run_details.initial_results.total, 1)
@@ -982,9 +982,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_extra_baselines(self):
host = MockHost()
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/image-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/image-expected.txt'
host.filesystem.write_text_file(extra_txt, 'Extra txt')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/image-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/image-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
test_name = 'passes/image.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1000,9 +1000,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_empty_overriding_baselines(self):
host = MockHost()
- base_baseline = test.LAYOUT_TEST_DIR + '/passes/image-expected.txt'
+ base_baseline = test.WEB_TEST_DIR + '/passes/image-expected.txt'
host.filesystem.write_text_file(base_baseline, 'Non-empty')
- platform_baseline = test.LAYOUT_TEST_DIR + '/platform/test-mac-mac10.10/passes/image-expected.txt'
+ platform_baseline = test.WEB_TEST_DIR + '/platform/test-mac-mac10.10/passes/image-expected.txt'
host.filesystem.write_text_file(platform_baseline, '')
test_name = 'passes/image.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1015,9 +1015,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_reftest_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/reftest-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/reftest-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
test_name = 'passes/reftest.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1033,9 +1033,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_reftest_with_text_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/reftest-with-text-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/reftest-with-text-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
test_name = 'passes/reftest-with-text.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1051,7 +1051,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_reftest_extra_png_baseline(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/reftest-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
test_name = 'passes/reftest.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1061,12 +1061,12 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_passing_testharness_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/testharness-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt'
host.filesystem.write_text_file(extra_txt,
'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/testharness-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
test_name = 'passes/testharness.html'
run_details, log_stream, _ = logging_run([test_name], tests_included=True, host=host)
@@ -1084,7 +1084,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_passing_testharness_extra_txt_baseline(self):
host = MockHost()
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt'
host.filesystem.write_text_file(extra_txt,
'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.')
test_name = 'passes/testharness.html'
@@ -1095,7 +1095,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
def test_passing_testharness_extra_mismatching_txt_baseline(self):
host = MockHost()
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt'
host.filesystem.write_text_file(extra_txt,
'This is a testharness.js-based test.\nFAIL: bah\nHarness: the test ran to completion.')
test_name = 'passes/testharness.html'
@@ -1112,9 +1112,9 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
# An all-pass testharness text baseline is necessary when it overrides a fallback baseline.
host = MockHost()
# The base baseline expects a failure.
- base_baseline = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.txt'
+ base_baseline = test.WEB_TEST_DIR + '/passes/testharness-expected.txt'
host.filesystem.write_text_file(base_baseline, 'Failure')
- platform_baseline = test.LAYOUT_TEST_DIR + '/platform/test-mac-mac10.10/passes/testharness-expected.txt'
+ platform_baseline = test.WEB_TEST_DIR + '/platform/test-mac-mac10.10/passes/testharness-expected.txt'
host.filesystem.write_text_file(platform_baseline,
'This is a testharness.js-based test.\nPASS: bah\nHarness: the test ran to completion.')
run_details, log_stream, _ = logging_run(
@@ -1221,7 +1221,7 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
class RebaselineTest(unittest.TestCase, StreamTestingMixin):
"""Tests for flags which cause new baselines to be written.
- When running layout tests, there are several flags which write new
+ When running web tests, there are several flags which write new
baselines. This is separate from the "blink_tool.py rebaseline" commands,
which fetch new baselines from elsewhere rather than generating them.
"""
@@ -1233,19 +1233,19 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
written_files: from FileSystem.written_files.
log_stream: The log stream from the run.
expected_file_base: Relative path to the baseline,
- without the extension, from the layout test directory.
+ without the extension, from the web test directory.
expected_extensions: Expected extensions which should be written.
"""
for ext in expected_extensions:
baseline = '%s-expected%s' % (expected_file_base, ext)
- baseline_full_path = '%s/%s' % (test.LAYOUT_TEST_DIR, baseline)
+ baseline_full_path = '%s/%s' % (test.WEB_TEST_DIR, baseline)
self.assertIsNotNone(written_files.get(baseline_full_path))
baseline_message = 'Writing new baseline "%s"\n' % baseline
self.assert_contains(log_stream, baseline_message)
# Assert that baselines with other extensions were not written.
for ext in ({'.png', '.txt', '.wav'} - set(expected_extensions)):
baseline = '%s-expected%s' % (expected_file_base, ext)
- baseline_full_path = '%s/%s' % (test.LAYOUT_TEST_DIR, baseline)
+ baseline_full_path = '%s/%s' % (test.WEB_TEST_DIR, baseline)
self.assertIsNone(written_files.get(baseline_full_path))
def test_reset_results_basic(self):
@@ -1327,7 +1327,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# Tests that we update existing baseline for a testharness test.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR + '/failures/unexpected/testharness-expected.txt', 'foo')
+ test.WEB_TEST_DIR + '/failures/unexpected/testharness-expected.txt', 'foo')
details, log_stream, _ = logging_run(
[
'--reset-results',
@@ -1358,7 +1358,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# if the new baseline is different from the fallback baseline.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we also
@@ -1385,7 +1385,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# if the new baseline is different from the fallback baseline.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we also
@@ -1434,9 +1434,9 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
def test_reset_results_remove_extra_baselines(self):
host = MockHost()
- extra_txt = test.LAYOUT_TEST_DIR + '/failures/unexpected/image-only-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/failures/unexpected/image-only-expected.txt'
host.filesystem.write_text_file(extra_txt, 'Extra txt')
- extra_wav = test.LAYOUT_TEST_DIR + '/failures/unexpected/image-only-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/failures/unexpected/image-only-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
details, log_stream, _ = logging_run(
['--reset-results', 'failures/unexpected/image-only.html'],
@@ -1452,11 +1452,11 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
def test_reset_results_reftest_remove_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/reftest-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/reftest-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/reftest-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/reftest-expected.txt'
host.filesystem.write_text_file(extra_txt, 'reftest')
details, _, _ = logging_run(['--reset-results', 'passes/reftest.html'],
tests_included=True, host=host)
@@ -1469,9 +1469,9 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
def test_reset_results_reftest_with_text_remove_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/reftest-with-text-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_wav = test.LAYOUT_TEST_DIR + '/passes/reftest-with-text-expected.wav'
+ extra_wav = test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.wav'
host.filesystem.write_text_file(extra_wav, 'Extra wav')
details, _, _ = logging_run(['--reset-results', 'passes/reftest-with-text.html'],
tests_included=True, host=host)
@@ -1480,13 +1480,13 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
self.assertEqual(len(written_files.keys()), 7)
self.assertIsNone(written_files[extra_png])
self.assertIsNone(written_files[extra_wav])
- self.assertNotIn(test.LAYOUT_TEST_DIR + '/passes/reftest-with-text-expected.txt', written_files)
+ self.assertNotIn(test.WEB_TEST_DIR + '/passes/reftest-with-text-expected.txt', written_files)
def test_reset_results_passing_testharness_remove_extra_baselines(self):
host = MockHost()
- extra_png = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.png'
+ extra_png = test.WEB_TEST_DIR + '/passes/testharness-expected.png'
host.filesystem.write_text_file(extra_png, 'Extra png')
- extra_txt = test.LAYOUT_TEST_DIR + '/passes/testharness-expected.txt'
+ extra_txt = test.WEB_TEST_DIR + '/passes/testharness-expected.txt'
host.filesystem.write_text_file(extra_txt, 'Extra txt')
details, log_stream, _ = logging_run(
['--reset-results', 'passes/testharness.html'],
@@ -1517,7 +1517,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# results are different from the current baselines.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we also
@@ -1542,7 +1542,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# results are different from the current baselines.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we also
@@ -1568,7 +1568,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# actual results are the same as the fallback baselines.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we check
@@ -1576,7 +1576,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# result is the same as this fallback baseline.
'text-image-checksum_fail-txt')
flag_specific_baseline_txt = (
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/flag-specific/flag/failures/unexpected/text-image-checksum-expected.txt')
host.filesystem.write_text_file(
flag_specific_baseline_txt, 'existing-baseline-different-from-fallback')
@@ -1601,7 +1601,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# results are different from the current baselines.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we also
@@ -1626,7 +1626,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# baseline (which should not matter).
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png',
'wrong-png-baseline')
@@ -1651,11 +1651,11 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# baseline (which should not matter).
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/platform/test-mac-mac10.10/failures/unexpected/text-image-checksum-expected.png',
'wrong-png-baseline')
host.filesystem.remove(
- test.LAYOUT_TEST_DIR + '/failures/unexpected/text-image-checksum-expected.png')
+ test.WEB_TEST_DIR + '/failures/unexpected/text-image-checksum-expected.png')
details, log_stream, _ = logging_run(
[
@@ -1677,7 +1677,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# actual results are the same as the fallback baselines.
host = MockHost()
host.filesystem.write_text_file(
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/failures/unexpected/text-image-checksum-expected.txt',
# This value is the same as actual text result of the test defined
# in blinkpy.web_tests.port.test. This is added so that we check
@@ -1685,7 +1685,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin):
# result is the same as this fallback baseline.
'text-image-checksum_fail-txt')
virtual_baseline_txt = (
- test.LAYOUT_TEST_DIR +
+ test.WEB_TEST_DIR +
'/virtual/virtual_failures/failures/unexpected/text-image-checksum-expected.txt')
host.filesystem.write_text_file(
virtual_baseline_txt, 'existing-baseline-different-from-fallback')
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/apache_http.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/apache_http.py
index 991ae4ab03c..eb3e93c2eb3 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/apache_http.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/apache_http.py
@@ -26,7 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Start and stop the Apache HTTP server as it is used by the layout tests."""
+"""Start and stop the Apache HTTP server as it is used by the web tests."""
import logging
import socket
@@ -45,9 +45,9 @@ class ApacheHTTP(server_base.ServerBase):
# match old-run-webkit-tests: https://bugs.webkit.org/show_bug.cgi?id=63956
self._name = 'httpd'
self._log_prefixes = ('access_log', 'error_log')
- self._mappings = [{'port': 8000},
- {'port': 8080},
- {'port': 8443, 'sslcert': True}]
+ self._mappings = [{'port': 8000, 'scheme': 'http'},
+ {'port': 8080, 'scheme': 'http'},
+ {'port': 8443, 'scheme': 'https', 'sslcert': True}]
self._number_of_servers = number_of_servers
self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
@@ -55,10 +55,11 @@ class ApacheHTTP(server_base.ServerBase):
executable = self._port_obj.path_to_apache()
server_root = self._filesystem.dirname(self._filesystem.dirname(executable))
- test_dir = self._port_obj.layout_tests_dir()
+ test_dir = self._port_obj.web_tests_dir()
document_root = self._filesystem.join(test_dir, 'http', 'tests')
forms_test_resources_dir = self._filesystem.join(test_dir, 'fast', 'forms', 'resources')
media_resources_dir = self._filesystem.join(test_dir, 'media')
+ reporting_observer_resources_dir = self._filesystem.join(test_dir, 'reporting-observer', 'resources')
webaudio_resources_dir = self._filesystem.join(test_dir, 'webaudio', 'resources')
mime_types_path = self._filesystem.join(self._port_obj.apache_config_directory(), 'mime.types')
cert_file = self._filesystem.join(self._port_obj.apache_config_directory(), 'webkit-httpd.pem')
@@ -87,6 +88,7 @@ class ApacheHTTP(server_base.ServerBase):
'-c', 'Alias /bluetooth-resources "%s/external/wpt/bluetooth/resources"' % test_dir,
'-c', 'Alias /forms-test-resources "%s"' % forms_test_resources_dir,
'-c', 'Alias /media-resources "%s"' % media_resources_dir,
+ '-c', 'Alias /reporting-observer-resources "%s"' % reporting_observer_resources_dir,
'-c', 'Alias /webaudio-resources "%s"' % webaudio_resources_dir,
'-c', 'Alias /inspector-sources "%s"' % inspector_sources_dir,
'-c', 'Alias /gen "%s"' % generated_sources_dir,
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/cli_wrapper.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/cli_wrapper.py
index dd6d965a91b..d45341f2bf8 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/cli_wrapper.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/cli_wrapper.py
@@ -29,13 +29,14 @@
"""A utility module for making standalone scripts to start servers.
Scripts in tools/ can use this module to start servers that are normally used
-for layout tests, outside of the layout test runner.
+for web tests, outside of the web test runner.
"""
import logging
import optparse
from blinkpy.common.host import Host
+from blinkpy.common.system.log_utils import configure_logging
from blinkpy.web_tests.port.factory import configuration_options
@@ -56,9 +57,8 @@ def main(server_constructor, input_fn=None, argv=None, description=None, **kwarg
parser.add_option(opt)
options, _ = parser.parse_args(argv)
- logging.basicConfig()
- logger = logging.getLogger()
- logger.setLevel(logging.DEBUG if options.verbose else logging.INFO)
+ configure_logging(logging_level=logging.DEBUG if options.verbose else logging.INFO,
+ include_time=options.verbose)
host = Host()
port_obj = host.port_factory.get(options=options)
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/pywebsocket.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/pywebsocket.py
index 062ae111cac..2a5c9e04cbe 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/pywebsocket.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/pywebsocket.py
@@ -26,7 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""A class to help start/stop the PyWebSocket server as used by the layout tests."""
+"""A class to help start/stop the PyWebSocket server as used by the web tests."""
import os
import sys
@@ -47,12 +47,12 @@ class PyWebSocket(server_base.ServerBase):
super(PyWebSocket, self).__init__(port_obj, output_dir)
self._name = 'pywebsocket'
self._log_prefixes = (_WS_LOG_PREFIX,)
- self._mappings = [{'port': _DEFAULT_WS_PORT}]
+ self._mappings = [{'port': _DEFAULT_WS_PORT, 'scheme': 'ws'}]
self._pid_file = self._filesystem.join(self._runtime_path, '%s.pid' % self._name)
self._port = _DEFAULT_WS_PORT
- self._layout_tests = self._port_obj.layout_tests_dir()
- self._web_socket_tests = self._filesystem.join(self._layout_tests, 'http', 'tests', 'websocket')
+ self._web_tests = self._port_obj.web_tests_dir()
+ self._web_socket_tests = self._filesystem.join(self._web_tests, 'http', 'tests', 'websocket')
time_str = time.strftime('%d%b%Y-%H%M%S')
log_file_name = _WS_LOG_PREFIX + time_str
self._error_log = self._filesystem.join(self._output_dir, log_file_name + '-err.txt')
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py
index 34ded0fb12e..c70afdb6e15 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/server_base.py
@@ -26,7 +26,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Base class used to start servers used by the layout tests."""
+"""Base class used to start servers used by the web tests."""
import errno
import logging
@@ -42,7 +42,7 @@ class ServerError(Exception):
class ServerBase(object):
- """A skeleton class for starting and stopping servers used by the layout tests."""
+ """A skeleton class for starting and stopping servers used by the web tests."""
def __init__(self, port_obj, output_dir):
self._port_obj = port_obj
@@ -251,13 +251,14 @@ class ServerBase(object):
for mapping in self._mappings:
s = socket.socket()
port = mapping['port']
+ scheme = mapping['scheme']
try:
s.connect(('localhost', port))
- _log.debug('Server running on %d', port)
+ _log.info('Server running on %s://localhost:%d', scheme, port)
except IOError as error:
if error.errno not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise
- _log.debug('Server NOT running on %d: %s', port, error)
+ _log.debug('Server NOT running on %s://localhost:%d : %s', scheme, port, error)
return False
finally:
s.close()
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py
index e41aeb21aad..a94e337ba23 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Start and stop the WPTserve servers as they're used by the layout tests."""
+"""Start and stop the WPTserve servers as they're used by the web tests."""
import datetime
import json
@@ -24,11 +24,11 @@ class WPTServe(server_base.ServerBase):
ws_port, wss_port = (9001, 9444)
self._name = 'wptserve'
self._log_prefixes = ('access_log', 'error_log')
- self._mappings = [{'port': http_port},
- {'port': http_alt_port},
- {'port': https_port, 'sslcert': True},
- {'port': ws_port},
- {'port': wss_port, 'sslcert': True}]
+ self._mappings = [{'port': http_port, 'scheme': 'http'},
+ {'port': http_alt_port, 'scheme': 'http'},
+ {'port': https_port, 'scheme': 'https', 'sslcert': True},
+ {'port': ws_port, 'scheme': 'ws'},
+ {'port': wss_port, 'scheme': 'wss', 'sslcert': True}]
# TODO(burnik): We can probably avoid PID files for WPT in the future.
fs = self._filesystem
@@ -38,7 +38,7 @@ class WPTServe(server_base.ServerBase):
path_to_pywebsocket = finder.path_from_chromium_base('third_party', 'pywebsocket', 'src')
path_to_wpt_support = finder.path_from_blink_tools('blinkpy', 'third_party', 'wpt')
path_to_wpt_root = fs.join(path_to_wpt_support, 'wpt')
- path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.layout_tests_dir(), 'external', 'wpt'))
+ path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.web_tests_dir(), 'external', 'wpt'))
path_to_ws_handlers = fs.join(path_to_wpt_tests, 'websockets', 'handlers')
self._config_file = self._prepare_wptserve_config(path_to_wpt_support)
wpt_script = fs.join(path_to_wpt_root, 'wpt')
@@ -51,7 +51,6 @@ class WPTServe(server_base.ServerBase):
if self._port_obj.host.filesystem.exists(path_to_ws_handlers):
start_cmd += ['--ws_doc_root', path_to_ws_handlers]
- self._stdout = self._stderr = self._executive.DEVNULL
# TODO(burnik): We should stop setting the CWD once WPT can be run without it.
self._cwd = path_to_wpt_root
self._env = port_obj.host.environ.copy()
@@ -80,34 +79,39 @@ class WPTServe(server_base.ServerBase):
return temp_file
def _stop_running_server(self):
- self._wait_for_action(self._check_and_kill_wptserve)
+ if not self._wait_for_action(self._check_and_kill):
+ # This is mostly for POSIX systems. We send SIGINT in
+ # _check_and_kill() and here we use SIGKILL.
+ self._executive.kill_process(self._pid)
+
if self._filesystem.exists(self._pid_file):
self._filesystem.remove(self._pid_file)
if self._filesystem.exists(self._config_file):
self._filesystem.remove(self._config_file)
- def _check_and_kill_wptserve(self):
+ def _check_and_kill(self):
"""Tries to kill wptserve.
Returns True if it appears to be not running. Or, if it appears to be
running, tries to kill the process and returns False.
"""
- if not (self._pid and self._executive.check_running_pid(self._pid)):
+ if not (self._pid and self._process):
+ _log.warning('No process object or PID. wptserve has not started.')
+ return True
+
+ # Polls the process in case it has died; otherwise, the process might be
+ # defunct and check_running_pid can still succeed.
+ if self._process.poll() or not self._executive.check_running_pid(self._pid):
_log.debug('pid %d is not running', self._pid)
return True
_log.debug('pid %d is running, killing it', self._pid)
- # Executive.kill_process appears to not to effectively kill the
- # wptserve processes on Linux (and presumably other platforms).
+ # kill_process() kills the whole process tree on Windows, but not on
+ # POSIX, so we send SIGINT instead to allow wptserve to exit gracefully.
if self._platform.is_win():
self._executive.kill_process(self._pid)
else:
self._executive.interrupt(self._pid)
- # According to Popen.wait(), this can deadlock when using stdout=PIPE or
- # stderr=PIPE. We're using DEVNULL for both so that should not occur.
- if self._process is not None:
- self._process.wait()
-
return False
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py
index b1d77eb2958..3342f856e29 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/servers/wptserve_unittest.py
@@ -5,8 +5,9 @@
import json
import logging
-from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.common.host_mock import MockHost
+from blinkpy.common.system.executive_mock import MockProcess
+from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.web_tests.port import test
from blinkpy.web_tests.servers.wptserve import WPTServe
@@ -69,6 +70,7 @@ class TestWPTServe(LoggingTestCase):
server = WPTServe(self.port, '/log_file_dir')
server._pid_file = '/tmp/pidfile'
server._spawn_process = lambda: 4
+ server._process = MockProcess()
server._is_server_running_on_all_ports = lambda: True
# Simulate a process that never gets killed.
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag.py b/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag.py
index 805c0ec88b0..10c692fef1e 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag.py
@@ -49,14 +49,14 @@ class TryFlag(object):
def _force_flag_for_test_runner(self):
flag = self._args.flag
- path = self._path_finder.path_from_layout_tests(FLAG_FILE)
+ path = self._path_finder.path_from_web_tests(FLAG_FILE)
self._filesystem.write_text_file(path, flag + '\n')
self._git.add_list([path])
self._git.commit_locally_with_message(
'Flag try job: force %s for run_web_tests.py.' % flag)
def _flag_expectations_path(self):
- return self._path_finder.path_from_layout_tests(
+ return self._path_finder.path_from_web_tests(
'FlagExpectations', self._args.flag.lstrip('-'))
def _clear_expectations(self):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag_unittest.py
index 2283d8de1e0..166b1af23cb 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/try_flag_unittest.py
@@ -8,7 +8,7 @@ from blinkpy.common.host_mock import MockHost
from blinkpy.common.net.buildbot import Build
from blinkpy.common.net.git_cl import TryJobStatus
from blinkpy.common.net.git_cl_mock import MockGitCL
-from blinkpy.common.net.layout_test_results import LayoutTestResults
+from blinkpy.common.net.web_test_results import WebTestResults
from blinkpy.common.path_finder import PathFinder
from blinkpy.web_tests.try_flag import TryFlag
@@ -32,9 +32,9 @@ class TryFlagTest(unittest.TestCase):
git_cl = MockGitCL(host)
finder = PathFinder(host.filesystem)
- flag_file = finder.path_from_layout_tests(
+ flag_file = finder.path_from_web_tests(
'additional-driver-flag.setting')
- flag_expectations_file = finder.path_from_layout_tests(
+ flag_expectations_file = finder.path_from_web_tests(
'FlagExpectations', 'foo')
cmd = ['trigger', '--flag=--foo']
@@ -69,7 +69,7 @@ class TryFlagTest(unittest.TestCase):
self._run_trigger_test(regenerate=True)
def _setup_mock_results(self, buildbot):
- buildbot.set_results(self.linux_build, LayoutTestResults({
+ buildbot.set_results(self.linux_build, WebTestResults({
'tests': {
'something': {
'fail-everywhere.html': {
@@ -85,7 +85,7 @@ class TryFlagTest(unittest.TestCase):
}
}
}))
- buildbot.set_results(self.win_build, LayoutTestResults({
+ buildbot.set_results(self.win_build, WebTestResults({
'tests': {
'something': {
'fail-everywhere.html': {
@@ -101,7 +101,7 @@ class TryFlagTest(unittest.TestCase):
}
}
}))
- buildbot.set_results(self.mac_build, LayoutTestResults({
+ buildbot.set_results(self.mac_build, WebTestResults({
'tests': {
'something': {
'pass-unexpectedly-mac.html': {
@@ -123,7 +123,7 @@ class TryFlagTest(unittest.TestCase):
filesystem = host.filesystem
finder = PathFinder(filesystem)
- flag_expectations_file = finder.path_from_layout_tests(
+ flag_expectations_file = finder.path_from_web_tests(
'FlagExpectations', 'foo')
filesystem.write_text_file(
flag_expectations_file,
@@ -161,7 +161,7 @@ class TryFlagTest(unittest.TestCase):
host = MockHost()
filesystem = host.filesystem
finder = PathFinder(filesystem)
- flag_expectations_file = finder.path_from_layout_tests(
+ flag_expectations_file = finder.path_from_web_tests(
'FlagExpectations', 'foo')
self._setup_mock_results(host.buildbot)
cmd = ['update', '--flag=--foo']
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py b/chromium/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py
index 3eba7079965..f490a6b764f 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/update_expectations_unittest.py
@@ -12,7 +12,7 @@ from blinkpy.common.system.log_testing import LoggingTestCase
from blinkpy.web_tests.update_expectations import ExpectationsRemover
from blinkpy.web_tests.builder_list import BuilderList
from blinkpy.web_tests.port.factory import PortFactory
-from blinkpy.web_tests.port.test import LAYOUT_TEST_DIR
+from blinkpy.web_tests.port.test import WEB_TEST_DIR
from blinkpy.web_tests.update_expectations import main
from blinkpy.tool.commands.flaky_tests import FlakyTests
@@ -116,7 +116,7 @@ class UpdateTestExpectationsTest(LoggingTestCase):
'test/f.html',
'test/g.html']
for test in test_list:
- path = filesystem.join(LAYOUT_TEST_DIR, test)
+ path = filesystem.join(WEB_TEST_DIR, test)
filesystem.write_binary_file(path, '')
def _create_expectations_remover(self, type_flag='all', remove_missing=False):
diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/views/printing.py b/chromium/third_party/blink/tools/blinkpy/web_tests/views/printing.py
index 728b2b3bbff..11c45074f8c 100644
--- a/chromium/third_party/blink/tools/blinkpy/web_tests/views/printing.py
+++ b/chromium/third_party/blink/tools/blinkpy/web_tests/views/printing.py
@@ -165,7 +165,7 @@ class Printer(object):
if self._options.timing:
parallel_time = sum(result.total_run_time for result in run_results.results_by_name.values())
- # There is serial overhead in layout_test_runner.run() that we can't easily account for when
+ # There is serial overhead in web_test_runner.run() that we can't easily account for when
# really running in parallel, but taking the min() ensures that in the worst case
# (if parallel time is less than run_time) we do account for it.
serial_time = total_time - min(run_results.run_time, parallel_time)