| Index: chrome/browser/PRESUBMIT.py
|
| diff --git a/chrome/browser/PRESUBMIT.py b/chrome/browser/PRESUBMIT.py
|
| index 0dbbdae8a50666555dc6ce47b35e04ad60f4936b..0350a0624b30978bfd71b8b700d672338bc64f98 100644
|
| --- a/chrome/browser/PRESUBMIT.py
|
| +++ b/chrome/browser/PRESUBMIT.py
|
| @@ -20,6 +20,23 @@ def CheckChangeOnUpload(input_api, output_api):
|
| def CheckChangeOnCommit(input_api, output_api):
|
| return _CommonChecks(input_api, output_api)
|
|
|
| +def _RunHistogramChecks(input_api, output_api, histogram_name):
|
| + try:
|
| + # Setup sys.path so that we can call histrogram code
|
| + import sys
|
| + original_sys_path = sys.path
|
| + sys.path = sys.path + [input_api.os_path.join(
|
| + input_api.change.RepositoryRoot(),
|
| + 'tools', 'metrics', 'histograms')]
|
| +
|
| + import presubmit_bad_message_reasons
|
| + return presubmit_bad_message_reasons.PrecheckBadMessage(input_api,
|
| + output_api, histogram_name)
|
| + except:
|
| + return [output_api.PresubmitError('Could not verify histogram!')]
|
| + finally:
|
| + sys.path = original_sys_path
|
| +
|
|
|
| def _CommonChecks(input_api, output_api):
|
| """Checks common to both upload and commit."""
|
| @@ -75,6 +92,8 @@ def _CommonChecks(input_api, output_api):
|
| input_api, output_api, file_filter=is_resource).RunChecks())
|
| results.extend(js_checker.JSChecker(
|
| input_api, output_api, file_filter=is_resource).RunChecks())
|
| + results.extend(_RunHistogramChecks(input_api, output_api,
|
| + "BadMessageReasonChrome"))
|
| finally:
|
| sys.path = old_path
|
|
|
|
|