Index: third_party/WebKit/LayoutTests/PRESUBMIT.py |
diff --git a/third_party/WebKit/LayoutTests/PRESUBMIT.py b/third_party/WebKit/LayoutTests/PRESUBMIT.py |
index 87d981c1ca1ce40e1cffc024c45c13cd5ede8745..ca7b4f986f0f2f6355e4740ab46787a44503aa97 100644 |
--- a/third_party/WebKit/LayoutTests/PRESUBMIT.py |
+++ b/third_party/WebKit/LayoutTests/PRESUBMIT.py |
@@ -87,10 +87,27 @@ def _CheckIdenticalFiles(input_api, output_api): |
return errors |
+def _CheckFilesUsingEventSender(input_api, output_api): |
+ """Check if any new layout tests still use eventSender. If they do, we encourage replacing them with |
+ chrome.gpuBenchmarking.pointerActionSequence. |
+ """ |
+ results = [] |
+ actions = ["eventSender.touch", "eventSender.mouse", "eventSender.gesture"] |
+ for f in input_api.AffectedFiles(): |
+ if f.Action() == 'A': |
+ for line_num, line in f.ChangedContents(): |
+ if any(action in line for action in actions): |
+ results.append(output_api.PresubmitError( |
+ 'Files that still use eventSender: %s:%d %s, please use chrome.gpuBenchmarking.pointerActionSequence instead.' % |
+ (f.LocalPath(), line_num, line))) |
+ return results |
+ |
+ |
def CheckChangeOnUpload(input_api, output_api): |
results = [] |
results.extend(_CheckTestharnessResults(input_api, output_api)) |
results.extend(_CheckIdenticalFiles(input_api, output_api)) |
+ results.extend(_CheckFilesUsingEventSender(input_api, output_api)) |
return results |
@@ -98,4 +115,5 @@ def CheckChangeOnCommit(input_api, output_api): |
results = [] |
results.extend(_CheckTestharnessResults(input_api, output_api)) |
results.extend(_CheckIdenticalFiles(input_api, output_api)) |
+ results.extend(_CheckFilesUsingEventSender(input_api, output_api)) |
return results |