OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """LayoutTests/ presubmit script for Blink. | 5 """LayoutTests/ presubmit script for Blink. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if any(_local_path(p) in dirty_files for p in group): | 80 if any(_local_path(p) in dirty_files for p in group): |
81 a = group[0] | 81 a = group[0] |
82 for b in group[1:]: | 82 for b in group[1:]: |
83 if not filecmp.cmp(_absolute_path(a), _absolute_path(b), shallow
=False): | 83 if not filecmp.cmp(_absolute_path(a), _absolute_path(b), shallow
=False): |
84 errors.append(output_api.PresubmitError( | 84 errors.append(output_api.PresubmitError( |
85 'Files that should match differ: (see https://crbug.com/
362788)\n' + | 85 'Files that should match differ: (see https://crbug.com/
362788)\n' + |
86 ' %s <=> %s' % (_local_path(a), _local_path(b)))) | 86 ' %s <=> %s' % (_local_path(a), _local_path(b)))) |
87 return errors | 87 return errors |
88 | 88 |
89 | 89 |
| 90 def _CheckFilesUsingEventSender(input_api, output_api): |
| 91 """Check if any new layout tests still use eventSender. If they do, we encou
rage replacing them with |
| 92 chrome.gpuBenchmarking.pointerActionSequence. |
| 93 """ |
| 94 results = [] |
| 95 actions = ["eventSender.touch", "eventSender.mouse", "eventSender.gesture"] |
| 96 for f in input_api.AffectedFiles(): |
| 97 if f.Action() == 'A': |
| 98 for line_num, line in f.ChangedContents(): |
| 99 if any(action in line for action in actions): |
| 100 results.append(output_api.PresubmitError( |
| 101 'Files that still use eventSender: %s:%d %s, please use
chrome.gpuBenchmarking.pointerActionSequence instead.' % |
| 102 (f.LocalPath(), line_num, line))) |
| 103 return results |
| 104 |
| 105 |
90 def CheckChangeOnUpload(input_api, output_api): | 106 def CheckChangeOnUpload(input_api, output_api): |
91 results = [] | 107 results = [] |
92 results.extend(_CheckTestharnessResults(input_api, output_api)) | 108 results.extend(_CheckTestharnessResults(input_api, output_api)) |
93 results.extend(_CheckIdenticalFiles(input_api, output_api)) | 109 results.extend(_CheckIdenticalFiles(input_api, output_api)) |
| 110 results.extend(_CheckFilesUsingEventSender(input_api, output_api)) |
94 return results | 111 return results |
95 | 112 |
96 | 113 |
97 def CheckChangeOnCommit(input_api, output_api): | 114 def CheckChangeOnCommit(input_api, output_api): |
98 results = [] | 115 results = [] |
99 results.extend(_CheckTestharnessResults(input_api, output_api)) | 116 results.extend(_CheckTestharnessResults(input_api, output_api)) |
100 results.extend(_CheckIdenticalFiles(input_api, output_api)) | 117 results.extend(_CheckIdenticalFiles(input_api, output_api)) |
| 118 results.extend(_CheckFilesUsingEventSender(input_api, output_api)) |
101 return results | 119 return results |
OLD | NEW |