| 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 """Top-level presubmit script for Blink. | 5 """Top-level 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 'compositing'), | 287 'compositing'), |
| 288 os.path.join('third_party', 'WebKit', 'Source', 'core', 'paint'), | 288 os.path.join('third_party', 'WebKit', 'Source', 'core', 'paint'), |
| 289 ] | 289 ] |
| 290 for affected_file in change.AffectedFiles(): | 290 for affected_file in change.AffectedFiles(): |
| 291 file_path = affected_file.LocalPath() | 291 file_path = affected_file.LocalPath() |
| 292 if any(x in file_path for x in paint_or_compositing_paths): | 292 if any(x in file_path for x in paint_or_compositing_paths): |
| 293 return True | 293 return True |
| 294 return False | 294 return False |
| 295 | 295 |
| 296 | 296 |
| 297 def _AreLayoutNGDirectoriesModified(change): # pylint: disable=C0103 | |
| 298 """Checks whether CL has changes to a layout ng directory.""" | |
| 299 layout_ng_paths = [ | |
| 300 os.path.join('third_party', 'WebKit', 'Source', 'core', 'layout', | |
| 301 'ng'), | |
| 302 ] | |
| 303 for affected_file in change.AffectedFiles(): | |
| 304 file_path = affected_file.LocalPath() | |
| 305 if any(x in file_path for x in layout_ng_paths): | |
| 306 return True | |
| 307 return False | |
| 308 | |
| 309 | |
| 310 def PostUploadHook(cl, change, output_api): # pylint: disable=C0103 | 297 def PostUploadHook(cl, change, output_api): # pylint: disable=C0103 |
| 311 """git cl upload will call this hook after the issue is created/modified. | 298 """git cl upload will call this hook after the issue is created/modified. |
| 312 | 299 |
| 313 This hook adds extra try bots to the CL description in order to run slimming | 300 This hook adds extra try bots to the CL description in order to run slimming |
| 314 paint v2 tests or LayoutNG tests in addition to the CQ try bots if the | 301 paint v2 tests in addition to the CQ try bots if the change contains paint |
| 315 change contains changes in a relevant direcotry (see: | 302 or compositing changes (see: _ArePaintOrCompositingDirectoriesModified). For |
| 316 _ArePaintOrCompositingDirectoriesModified and | 303 more information about slimming-paint-v2 tests see https://crbug.com/601275. |
| 317 _AreLayoutNGDirectoriesModified). For more information about | |
| 318 slimming-paint-v2 tests see https://crbug.com/601275 and for information | |
| 319 about the LayoutNG tests see https://crbug.com/706183. | |
| 320 """ | 304 """ |
| 321 results = [] | 305 if not _ArePaintOrCompositingDirectoriesModified(change): |
| 322 if _ArePaintOrCompositingDirectoriesModified(change): | 306 return [] |
| 323 results.extend(output_api.EnsureCQIncludeTrybotsAreAdded( | 307 return output_api.EnsureCQIncludeTrybotsAreAdded( |
| 324 cl, | 308 cl, |
| 325 ['master.tryserver.chromium.linux:' | 309 ['master.tryserver.chromium.linux:' |
| 326 'linux_layout_tests_slimming_paint_v2'], | 310 'linux_layout_tests_slimming_paint_v2'], |
| 327 'Automatically added slimming-paint-v2 tests to run on CQ due to ' | 311 'Automatically added slimming-paint-v2 tests to run on CQ due to ' |
| 328 'changes in paint or compositing directories.')) | 312 'changes in paint or compositing directories.') |
| 329 if _AreLayoutNGDirectoriesModified(change): | |
| 330 results.extend(output_api.EnsureCQIncludeTrybotsAreAdded( | |
| 331 cl, | |
| 332 ['master.tryserver.chromium.linux:' | |
| 333 'linux_layout_tests_layout_ng'], | |
| 334 'Automatically added linux_layout_tests_layout_ng to run on CQ due ' | |
| 335 'to changes in LayoutNG directories.')) | |
| 336 return results | |
| OLD | NEW |