PRESUBMIT.py undestands line break in the middle of <affected-histogram> tag
Bug: 956838
Change-Id: Ic3868a4f85fc8e4c13f07022800234978b870ee7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598390
Commit-Queue: Makoto Shimazu <[email protected]>
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Alexei Svitkine <[email protected]>
Cr-Commit-Position: refs/heads/master@{#657577}
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index efd12ce0..970cc30 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -128,6 +128,28 @@
MockOutputApi())
self.assertEqual(0, len(warnings))
+ def testCorrectlyMatchedChangeViaSuffixesWithLineWrapping(self):
+ diff_cc = [
+ 'UMA_HISTOGRAM_BOOL("LongHistogramNameNeedsLineWrapping.Dummy", true)']
+ diff_java = ['RecordHistogram.recordBooleanHistogram(' +
+ '"LongHistogramNameNeedsLineWrapping.Dummy", true)']
+ diff_xml = ['<histogram_suffixes',
+ ' name="LongHistogramNameNeedsLineWrapping"',
+ ' separator=".">',
+ ' <suffix name="Dummy"/>',
+ ' <affected-histogram',
+ ' name="LongHistogramNameNeedsLineWrapping"/>',
+ '</histogram>']
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockFile('some/path/foo.cc', diff_cc),
+ MockFile('some/path/foo.java', diff_java),
+ MockFile('tools/metrics/histograms/histograms.xml', diff_xml),
+ ]
+ warnings = PRESUBMIT._CheckUmaHistogramChanges(mock_input_api,
+ MockOutputApi())
+ self.assertEqual(0, len(warnings))
+
def testNameMatch(self):
# Check that the detected histogram name is "Dummy" and not, e.g.,
# "Dummy\", true); // The \"correct"