tools/metrics/histograms/expand_owners_unittest.py
def testExpandOwnersWithLongFilePath(self, mock_dirmd_extract):
    """Checks that long OWNERS file paths are supported.

    Most OWNERS file paths appear between owners tags on the same line, e.g.
    <owner>src/chrome/browser</owner>. However, especially long paths may appear
    on their own line between the tags.
    """
    mock_dirmd_extract.return_value = None
    absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
    src_relative_path = _GetSrcRelativePath(absolute_path)

    with open(absolute_path, 'w') as owners_file:
      owners_file.write('\n'.join(['amy@chromium.org']))

    histograms = xml.dom.minidom.parseString("""
<histograms>

<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>
    {path}
  </owner>
  <summary>I like coffee.</summary>
</histogram>

</histograms>
""".format(path=src_relative_path))

    expected_histograms = xml.dom.minidom.parseString("""
<histograms>

<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>amy@chromium.org</owner>
  <summary>I like coffee.</summary>
</histogram>

</histograms>
""")

    expand_owners.ExpandHistogramsOWNERS(histograms)
    self.assertMultiLineEqual(histograms.toxml(), expected_histograms.toxml())
Checks that long OWNERS file paths are supported.

    Most OWNERS file paths appear between owners tags on the same line, e.g.
    <owner>src/chrome/browser</owner>. However, especially long paths may appear
    on their own line between the tags.
    
Checks that long OWNERS file paths are supported.
Most OWNERS file paths appear between owners tags on the same line, e.g.
src/chrome/browser. However, especially long paths may appear
on their own line between the tags.
Checks that long OWNERS file paths are supported . Most OWNERS file paths appear between owners tags on the same line e . g . src / chrome / browser . However especially long paths may appear on their own line between the tags .
def testExpandOwnersWithLongFilePath(self, mock_dirmd_extract):
    mock_dirmd_extract.return_value = None
    absolute_path = _MakeOwnersFile('simple_OWNERS', self.temp_dir)
    src_relative_path = _GetSrcRelativePath(absolute_path)
    with open(absolute_path, 'w') as owners_file:
      owners_file.write('\n'.join(['amy@chromium.org']))
    histograms = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>
    {path}
  </owner>
  <summary>I like coffee.</summary>
</histogram>
</histograms>
""".format(path=src_relative_path))
    expected_histograms = xml.dom.minidom.parseString("""
<histograms>
<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>amy@chromium.org</owner>
  <summary>I like coffee.</summary>
</histogram>
</histograms>
""")
    expand_owners.ExpandHistogramsOWNERS(histograms)
    self.assertMultiLineEqual(histograms.toxml(), expected_histograms.toxml())
def testExpandOwnersWithLongFilePath ( self , mock_dirmd_extract ) : mock_dirmd_extract . return_value = None absolute_path = _MakeOwnersFile ( 'simple_OWNERS' , self . temp_dir ) src_relative_path = _GetSrcRelativePath ( absolute_path ) with open ( absolute_path , 'w' ) as owners_file : owners_file . write ( '\n' . join ( [ 'amy@chromium.org' ] ) ) histograms = xml . dom . minidom . parseString ( """
<histograms>

<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>
    {path}
  </owner>
  <summary>I like coffee.</summary>
</histogram>

</histograms>
""" . format ( path = src_relative_path ) ) expected_histograms = xml . dom . minidom . parseString ( """
<histograms>

<histogram name="Caffeination" units="mg">
  <owner>joe@chromium.org</owner>
  <owner>amy@chromium.org</owner>
  <summary>I like coffee.</summary>
</histogram>

</histograms>
""" ) expand_owners . ExpandHistogramsOWNERS ( histograms ) self . assertMultiLineEqual ( histograms . toxml ( ) , expected_histograms . toxml ( ) )
Checks that long OWNERS file paths are supported.
Checks that long OWNERS file paths are supported .
"""Checks that long OWNERS file paths are supported.

    Most OWNERS file paths appear between owners tags on the same line, e.g.
    <owner>src/chrome/browser</owner>. However, especially long paths may appear
    on their own line between the tags.
    """
self
mock_dirmd_extract