OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ) | 107 ) |
108 | 108 |
109 | 109 |
110 _BANNED_CPP_FUNCTIONS = ( | 110 _BANNED_CPP_FUNCTIONS = ( |
111 # Make sure that gtest's FRIEND_TEST() macro is not used; the | 111 # Make sure that gtest's FRIEND_TEST() macro is not used; the |
112 # FRIEND_TEST_ALL_PREFIXES() macro from base/gtest_prod_util.h should be | 112 # FRIEND_TEST_ALL_PREFIXES() macro from base/gtest_prod_util.h should be |
113 # used instead since that allows for FLAKY_, FAILS_ and DISABLED_ prefixes. | 113 # used instead since that allows for FLAKY_, FAILS_ and DISABLED_ prefixes. |
114 ( | 114 ( |
115 'FRIEND_TEST(', | 115 'FRIEND_TEST(', |
116 ( | 116 ( |
117 'Chromium code should not use gtest\'s FRIEND_TEST() macro. Include' | 117 'Chromium code should not use gtest\'s FRIEND_TEST() macro. Include', |
118 'base/gtest_prod_util.h and use FRIEND_TEST_ALL_PREFIXES() instead.', | 118 'base/gtest_prod_util.h and use FRIEND_TEST_ALL_PREFIXES() instead.', |
119 ), | 119 ), |
120 False, | 120 False, |
121 ), | 121 ), |
122 ( | 122 ( |
123 'ScopedAllowIO', | 123 'ScopedAllowIO', |
124 ( | 124 ( |
125 'New code should not use ScopedAllowIO. Post a task to the blocking pool' | 125 'New code should not use ScopedAllowIO. Post a task to the blocking', |
126 'or the FILE thread instead.', | 126 'pool or the FILE thread instead.', |
| 127 ), |
| 128 True, |
| 129 ), |
| 130 ( |
| 131 'FilePathWatcher::Delegate', |
| 132 ( |
| 133 'New code should not use FilePathWatcher::Delegate. Use the callback', |
| 134 'interface instead.', |
127 ), | 135 ), |
128 False, | 136 False, |
129 ), | 137 ), |
130 ( | 138 ( |
131 'FilePathWatcher::Delegate', | 139 'browser::FindLastActiveWithProfile', |
132 ( | 140 ( |
133 'New code should not use FilePathWatcher::Delegate. Use the callback' | 141 'This function is deprecated and we\'re working on removing it. Pass', |
134 'interface instead.', | 142 'more context to get a Browser*, like a WebContents, window, or session', |
| 143 'id. Talk to ben@ or jam@ for more information.', |
135 ), | 144 ), |
136 False, | 145 True, |
| 146 ), |
| 147 ( |
| 148 'browser::FindBrowserWithProfile', |
| 149 ( |
| 150 'This function is deprecated and we\'re working on removing it. Pass', |
| 151 'more context to get a Browser*, like a WebContents, window, or session', |
| 152 'id. Talk to ben@ or jam@ for more information.', |
| 153 ), |
| 154 True, |
| 155 ), |
| 156 ( |
| 157 'browser::FindAnyBrowser', |
| 158 ( |
| 159 'This function is deprecated and we\'re working on removing it. Pass', |
| 160 'more context to get a Browser*, like a WebContents, window, or session', |
| 161 'id. Talk to ben@ or jam@ for more information.', |
| 162 ), |
| 163 True, |
| 164 ), |
| 165 ( |
| 166 'browser::FindOrCreateTabbedBrowser', |
| 167 ( |
| 168 'This function is deprecated and we\'re working on removing it. Pass', |
| 169 'more context to get a Browser*, like a WebContents, window, or session', |
| 170 'id. Talk to ben@ or jam@ for more information.', |
| 171 ), |
| 172 True, |
| 173 ), |
| 174 ( |
| 175 'browser::FindTabbedBrowser', |
| 176 ( |
| 177 'This function is deprecated and we\'re working on removing it. Pass', |
| 178 'more context to get a Browser*, like a WebContents, window, or session', |
| 179 'id. Talk to ben@ or jam@ for more information.', |
| 180 ), |
| 181 True, |
137 ), | 182 ), |
138 ) | 183 ) |
139 | 184 |
140 | 185 |
141 | 186 |
142 def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api): | 187 def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api): |
143 """Attempts to prevent use of functions intended only for testing in | 188 """Attempts to prevent use of functions intended only for testing in |
144 non-testing code. For now this is just a best-effort implementation | 189 non-testing code. For now this is just a best-effort implementation |
145 that ignores header files and may have some false positives. A | 190 that ignores header files and may have some false positives. A |
146 better implementation would probably need a proper C++ parser. | 191 better implementation would probably need a proper C++ parser. |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 for non_android_re in (aura_re, win_re): | 501 for non_android_re in (aura_re, win_re): |
457 if all(re.search(non_android_re, f) for f in affected_files): | 502 if all(re.search(non_android_re, f) for f in affected_files): |
458 possibly_android = False | 503 possibly_android = False |
459 break | 504 break |
460 if possibly_android: | 505 if possibly_android: |
461 for f in change.AffectedFiles(): | 506 for f in change.AffectedFiles(): |
462 if any(re.search(r, f.LocalPath()) for r in android_re_list): | 507 if any(re.search(r, f.LocalPath()) for r in android_re_list): |
463 preferred.append('android') | 508 preferred.append('android') |
464 break | 509 break |
465 return preferred | 510 return preferred |
OLD | NEW |