chrome/android/monochrome/scripts/monochrome_apk_checker_test.py
def SuperSetOf(self, monochrome, apk, apk_name):
    """Verify Monochrome is super set of apk."""

    def exists_in_some_form(f):
      if f in monochrome:
        return True
      # Chrome.apk may have an extra classes.dex due to jdk library desugaring.
      if f.startswith('classes') and f.endswith('.dex'):
        return True
      if not f.startswith('res/'):
        return False
      name = '/' + posixpath.basename(f)
      # Some resources will exists in apk but not in monochrome due to the
      # difference in minSdkVersion. https://crbug.com/794438
      # E.g.:
      # apk could have: res/drawable/foo.png, res/drawable-v23/foo.png
      # monochrome (minSdkVersion=24) would need only: res/drawable-v23/foo.png
      return any(x.endswith(name) for x in monochrome)

    missing_files = [f for f in apk if not exists_in_some_form(f)]
    self.assertEquals(len(missing_files), 0, """\
Monochrome is expected to have a superset of the files in {0}.
However these files were present in {0} but not in Monochrome:
{1}
""".format(apk_name, '\n'.join(missing_files)))
Verify Monochrome is super set of apk.
Verify Monochrome is super set of apk.
Verify Monochrome is super set of apk .
def SuperSetOf(self, monochrome, apk, apk_name):
    def exists_in_some_form(f):
      if f in monochrome:
        return True
      if f.startswith('classes') and f.endswith('.dex'):
        return True
      if not f.startswith('res/'):
        return False
      name = '/' + posixpath.basename(f)
      return any(x.endswith(name) for x in monochrome)
    missing_files = [f for f in apk if not exists_in_some_form(f)]
    self.assertEquals(len(missing_files), 0, """\
Monochrome is expected to have a superset of the files in {0}.
However these files were present in {0} but not in Monochrome:
{1}
""".format(apk_name, '\n'.join(missing_files)))
def SuperSetOf ( self , monochrome , apk , apk_name ) : def exists_in_some_form ( f ) : if f in monochrome : return True if f . startswith ( 'classes' ) and f . endswith ( '.dex' ) : return True if not f . startswith ( 'res/' ) : return False name = '/' + posixpath . basename ( f ) return any ( x . endswith ( name ) for x in monochrome ) missing_files = [ f for f in apk if not exists_in_some_form ( f ) ] self . assertEquals ( len ( missing_files ) , 0 , """\
Monochrome is expected to have a superset of the files in {0}.
However these files were present in {0} but not in Monochrome:
{1}
""" . format ( apk_name , '\n' . join ( missing_files ) ) )
Verify Monochrome is super set of apk.
Verify Monochrome is super set of apk .
"""Verify Monochrome is super set of apk.""" # Chrome.apk may have an extra classes.dex due to jdk library desugaring. # Some resources will exists in apk but not in monochrome due to the # difference in minSdkVersion. https://crbug.com/794438 # E.g.: # apk could have: res/drawable/foo.png, res/drawable-v23/foo.png # monochrome (minSdkVersion=24) would need only: res/drawable-v23/foo.png
self
monochrome
apk
apk_name