| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 src/components/cronet. | 5 """Top-level presubmit script for src/components/cronet. |
| 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 depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 if problems: | 65 if problems: |
| 66 return [output_api.PresubmitError( | 66 return [output_api.PresubmitError( |
| 67 'API classes must be in org.chromium.net package, and implementation\n' | 67 'API classes must be in org.chromium.net package, and implementation\n' |
| 68 'classes must not be in org.chromium.net package.', | 68 'classes must not be in org.chromium.net package.', |
| 69 problems)] | 69 problems)] |
| 70 else: | 70 else: |
| 71 return [] | 71 return [] |
| 72 | 72 |
| 73 | 73 |
| 74 def _RunUnittests(input_api, output_api): |
| 75 return input_api.canned_checks.RunUnitTestsInDirectory( |
| 76 input_api, output_api, '.', [ r'^.+_unittest\.py$']) |
| 77 |
| 78 |
| 74 def CheckChangeOnUpload(input_api, output_api): | 79 def CheckChangeOnUpload(input_api, output_api): |
| 75 results = [] | 80 results = [] |
| 76 results.extend(_PyLintChecks(input_api, output_api)) | 81 results.extend(_PyLintChecks(input_api, output_api)) |
| 77 results.extend( | 82 results.extend( |
| 78 input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) | 83 input_api.canned_checks.CheckPatchFormatted(input_api, output_api)) |
| 79 results.extend(_PackageChecks(input_api, output_api)) | 84 results.extend(_PackageChecks(input_api, output_api)) |
| 85 results.extend(_RunUnittests(input_api, output_api)) |
| 80 return results | 86 return results |
| 81 | 87 |
| 82 | 88 |
| 89 def CheckChangeOnCommit(input_api, output_api): |
| 90 return _RunUnittests(input_api, output_api) |
| 91 |
| 92 |
| 83 def _GetTryMasters(project, change): | 93 def _GetTryMasters(project, change): |
| 84 return { | 94 return { |
| 85 'master.tryserver.chromium.android': { | 95 'master.tryserver.chromium.android': { |
| 86 'android_cronet_tester': [], | 96 'android_cronet_tester': [], |
| 87 }, | 97 }, |
| 88 } | 98 } |
| 89 | 99 |
| 90 | 100 |
| 91 def GetPreferredTryMasters(project, change): | 101 def GetPreferredTryMasters(project, change): |
| 92 # TODO(nick, dcheng): Using the value of _GetTryMasters() instead of an empty | 102 # TODO(nick, dcheng): Using the value of _GetTryMasters() instead of an empty |
| (...skipping 21 matching lines...) Expand all Loading... |
| 114 new_description = description | 124 new_description = description |
| 115 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join( | 125 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join( |
| 116 '%s:%s' % (master, ','.join(bots)) | 126 '%s:%s' % (master, ','.join(bots)) |
| 117 for master, bots in masters.iteritems()) | 127 for master, bots in masters.iteritems()) |
| 118 results.append(output_api.PresubmitNotifyResult( | 128 results.append(output_api.PresubmitNotifyResult( |
| 119 'Automatically added Cronet trybot to run tests on CQ.')) | 129 'Automatically added Cronet trybot to run tests on CQ.')) |
| 120 | 130 |
| 121 rietveld_obj.update_description(issue, new_description) | 131 rietveld_obj.update_description(issue, new_description) |
| 122 | 132 |
| 123 return results | 133 return results |
| OLD | NEW |