Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: testing/android/generate_native_test.py

Issue 10408091: Chromium support of running DumpRenderTree as an apk on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed media dependency from testing/android. And style changes. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/android/generate_native_test.py
diff --git a/testing/android/generate_native_test.py b/testing/android/generate_native_test.py
index 2062144bcd88f265302cba1907c61fdd34474363..eaef995c744a21d1dc82ab237f19d76b98cb0b18 100755
--- a/testing/android/generate_native_test.py
+++ b/testing/android/generate_native_test.py
@@ -136,8 +136,11 @@ class NativeTestApkGenerator(object):
logging.warn('%s --> %s' % (jar, dest))
shutil.copyfile(jar, dest)
- def CreateBundle(self):
+ def CreateBundle(self, ant_compile):
"""Create the apk bundle source and assemble components."""
+ if not ant_compile:
+ self._SOURCE_FILES.append('Android.mk')
+ self._REPLACEME_FILES.append('Android.mk')
self._CopyTemplateFiles()
self._ReplaceStrings()
self._CopyLibraryAndJars()
@@ -161,6 +164,16 @@ class NativeTestApkGenerator(object):
logging.error('Ant return code %d' % p.returncode)
sys.exit(p.returncode)
+ def CompileAndroidMk(self):
+ """Build the generated apk within Android source tree using Android.mk."""
+ try:
+ import compile_android_mk # pylint: disable=F0401
+ except:
+ raise AssertionError('Not in Android source tree. '
+ 'Please use --ant-compile.')
+ compile_android_mk.CompileAndroidMk(self._native_library,
+ self._output_directory)
+
def main(argv):
parser = optparse.OptionParser()
@@ -173,7 +186,9 @@ def main(argv):
parser.add_option('--output',
help='Output directory for generated files.')
parser.add_option('--ant-compile', action='store_true',
- help='If specified, build the generated apk with ant')
+ help='If specified, build the generated apk with ant. '
+ 'Otherwise assume compiling within the Android '
+ 'source tree using Android.mk.')
parser.add_option('--ant-args',
help='extra args for ant')
@@ -188,12 +203,19 @@ def main(argv):
if options.verbose:
logging.basicConfig(level=logging.DEBUG, format=' %(message)s')
+ # Ignore --ant-compile when building with Android source.
+ if 'ANDROID_BUILD_TOP' in os.environ:
+ options.ant_compile = False
+
ntag = NativeTestApkGenerator(native_library=options.native_library,
jars=options.jar,
output_directory=options.output)
- ntag.CreateBundle()
+ ntag.CreateBundle(options.ant_compile)
+
if options.ant_compile:
ntag.Compile(options.ant_args)
+ else:
+ ntag.CompileAndroidMk()
logging.warn('COMPLETE.')

Powered by Google App Engine
This is Rietveld 408576698