Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1344)

Unified Diff: chrome/browser/PRESUBMIT.py

Issue 2653273003: Add presubmit scripts to check histograms.xml if bad_message.h changes. (Closed)
Patch Set: address isherman comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/nacl/browser/PRESUBMIT.py » ('j') | components/nacl/browser/PRESUBMIT.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | components/nacl/browser/PRESUBMIT.py » ('j') | components/nacl/browser/PRESUBMIT.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698