Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1017)

Unified Diff: third_party/WebKit/PRESUBMIT.py

Issue 2080663004: Deprecate 'js-test.js' with an overridable pre-upload check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pdr@ Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/PRESUBMIT.py
diff --git a/third_party/WebKit/PRESUBMIT.py b/third_party/WebKit/PRESUBMIT.py
index f0a4cb0d7786f032ab16a37701a7f9cc4dc99234..b6d2afc15a6900d5073d68c54063817ef65331d8 100644
--- a/third_party/WebKit/PRESUBMIT.py
+++ b/third_party/WebKit/PRESUBMIT.py
@@ -188,6 +188,28 @@ def _CheckForPrintfDebugging(input_api, output_api):
return []
+def _CheckForJSTest(input_api, output_api):
+ """'js-test.js' is the past, 'testharness.js' is our glorious future"""
+ jstest_re = input_api.re.compile(r'resources/js-test.js')
+
+ def source_file_filter(path):
+ return input_api.FilterSourceFile(path,
+ white_list=[r'third_party/WebKit/LayoutTests/.*\.(html|js|php|pl|svg)$'])
+
+ errors = input_api.canned_checks._FindNewViolationsOfRule(
+ lambda _, x: not jstest_re.search(x), input_api, source_file_filter)
+ errors = [' * %s' % violation for violation in errors]
+ if errors:
+ return [output_api.PresubmitPromptOrNotify(
+ '"resources/js-test.js" is deprecated; please write new layout '
+ 'tests using the assertions in "resources/testharness.js" '
+ 'instead, as these can be more easily upstreamed to Web Platform '
+ 'Tests for cross-vendor compatibility testing. If you\'re not '
+ 'already familiar with this framework, a tutorial is available at '
+ 'https://darobin.github.io/test-harness-tutorial/docs/using-testharness.html.'
+ 'with the new framework.\n\n%s' % '\n'.join(errors))]
+ return []
+
def _CheckForFailInFile(input_api, f):
pattern = input_api.re.compile('^FAIL')
errors = []
@@ -283,6 +305,7 @@ def CheckChangeOnUpload(input_api, output_api):
results.extend(_CommonChecks(input_api, output_api))
results.extend(_CheckStyle(input_api, output_api))
results.extend(_CheckForPrintfDebugging(input_api, output_api))
+ results.extend(_CheckForJSTest(input_api, output_api))
results.extend(_CheckForInvalidPreferenceError(input_api, output_api))
results.extend(_CheckForForbiddenNamespace(input_api, output_api))
return results
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698