| Index: build/android/gyp/write_build_config.py
|
| diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py
|
| index d636f31d7c195e530ccb669311c94ba361ebfcc4..251df4e9120547ff0a5be260dadc4b826c42bc3c 100755
|
| --- a/build/android/gyp/write_build_config.py
|
| +++ b/build/android/gyp/write_build_config.py
|
| @@ -50,25 +50,23 @@ class AndroidManifest(object):
|
| assert len(manifests) == 1
|
| self.manifest = manifests[0]
|
|
|
| - def GetInstrumentation(self):
|
| + def GetInstrumentationElements(self):
|
| instrumentation_els = self.manifest.getElementsByTagName('instrumentation')
|
| if len(instrumentation_els) == 0:
|
| return None
|
| - if len(instrumentation_els) != 1:
|
| - raise Exception(
|
| - 'More than one <instrumentation> element found in %s' % self.path)
|
| - return instrumentation_els[0]
|
| + return instrumentation_els
|
|
|
| - def CheckInstrumentation(self, expected_package):
|
| - instr = self.GetInstrumentation()
|
| - if not instr:
|
| + def CheckInstrumentationElements(self, expected_package):
|
| + instrs = self.GetInstrumentationElements()
|
| + if not instrs:
|
| raise Exception('No <instrumentation> elements found in %s' % self.path)
|
| - instrumented_package = instr.getAttributeNS(
|
| - 'http://schemas.android.com/apk/res/android', 'targetPackage')
|
| - if instrumented_package != expected_package:
|
| - raise Exception(
|
| - 'Wrong instrumented package. Expected %s, got %s'
|
| - % (expected_package, instrumented_package))
|
| + for instr in instrs:
|
| + instrumented_package = instr.getAttributeNS(
|
| + 'http://schemas.android.com/apk/res/android', 'targetPackage')
|
| + if instrumented_package != expected_package:
|
| + raise Exception(
|
| + 'Wrong instrumented package. Expected %s, got %s'
|
| + % (expected_package, instrumented_package))
|
|
|
| def GetPackageName(self):
|
| return self.manifest.getAttribute('package')
|
| @@ -578,7 +576,7 @@ def main(argv):
|
| tested_apk_config = GetDepConfig(options.tested_apk_config)
|
|
|
| expected_tested_package = tested_apk_config['package_name']
|
| - AndroidManifest(options.android_manifest).CheckInstrumentation(
|
| + AndroidManifest(options.android_manifest).CheckInstrumentationElements(
|
| expected_tested_package)
|
| if options.proguard_enabled:
|
| # Add all tested classes to the test's classpath to ensure that the test's
|
| @@ -653,9 +651,9 @@ def main(argv):
|
| dependency_jars = [c['jar_path'] for c in all_library_deps]
|
| manifest = AndroidManifest(options.android_manifest)
|
| deps_info['package_name'] = manifest.GetPackageName()
|
| - if not options.tested_apk_config and manifest.GetInstrumentation():
|
| + if not options.tested_apk_config and manifest.GetInstrumentationElements():
|
| # This must then have instrumentation only for itself.
|
| - manifest.CheckInstrumentation(manifest.GetPackageName())
|
| + manifest.CheckInstrumentationElements(manifest.GetPackageName())
|
|
|
| library_paths = []
|
| java_libraries_list = None
|
|
|