Commit c3729156 authored by Weilun Shi's avatar Weilun Shi Committed by Commit Bot

Summary tag should not be empty

The summary child in the histogram tag should not be empty.

Change-Id: I7030df527b7852bd36de9e37ab48d09fca600d51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422985
Auto-Submit: Weilun Shi <sweilun@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Weilun Shi <sweilun@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810015}
parent a1f57397
......@@ -567,8 +567,9 @@ def _ExtractHistogramsFromXmlTree(tree, enums):
reason = _GetTextFromChildNodes(obsolete_nodes[0])
histogram_entry['obsolete'] = reason
# Non-obsolete histograms should provide a <summary>.
if not obsolete_nodes and not summary_nodes:
# Non-obsolete histograms should provide a non-empty <summary>.
if not obsolete_nodes and (not summary_nodes or
not histogram_entry['summary']):
logging.error('histogram %s should provide a <summary>', name)
have_errors = True
......
......@@ -459,6 +459,21 @@ class ExtractHistogramsTest(unittest.TestCase):
histogram_without_summary, {})
self.assertTrue(have_errors)
def testNewHistogramWithEmptySummary(self):
histogram_with_empty_summary = xml.dom.minidom.parseString("""
<histogram-configuration>
<histograms>
<histogram name="Test.Histogram" units="things" expires_after="2019-01-01">
<owner>person@chromium.org</owner>
<summary/>
</histogram>
</histograms>
</histogram-configuration>
""")
_, have_errors = extract_histograms._ExtractHistogramsFromXmlTree(
histogram_with_empty_summary, {})
self.assertTrue(have_errors)
def testNewHistogramWithoutEnumOrUnit(self):
histogram_without_enum_or_unit = xml.dom.minidom.parseString("""
<histogram-configuration>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment