diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 21:02:09 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 21:02:09 +0000 |
commit | d9f9695633f8ea3dd1d4d02136c12cf2ffe429b8 (patch) | |
tree | 18b8981c285c249d714b079cafce988ad66d5f8d /base/base.gyp | |
parent | d9426956e7653f57361544bfa9ff7cfd84590a5a (diff) | |
download | chromium_src-d9f9695633f8ea3dd1d4d02136c12cf2ffe429b8.zip chromium_src-d9f9695633f8ea3dd1d4d02136c12cf2ffe429b8.tar.gz chromium_src-d9f9695633f8ea3dd1d4d02136c12cf2ffe429b8.tar.bz2 |
apk-based test runner work for android. 2 unit test bundles converted over (ipc, base).
OFF by default; enable with a gyp var. E.g.
GYP_DEFINES="$GYP_DEFINES gtest_target_type=shared_library" android_gyp
Some useful commands:
adb uninstall org.chromium.native_test
adb install -r out/Release/base_unittests_apk/ChromeNativeTests-debug.apk
adb shell am start -n org.chromium.native_test/org.chromium.native_test.ChromeNativeTestActivity
For the moment, all apks can be built simultaneously but use the same
activity name. Thus you cannot have more than one installed at the
same time.
BUG=None
TEST=
Review URL: http://codereview.chromium.org/10051021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base.gyp')
-rw-r--r-- | base/base.gyp | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/base/base.gyp b/base/base.gyp index 4d8a7d9..be281dc 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -128,7 +128,7 @@ }, { 'target_name': 'base_unittests', - 'type': 'executable', + 'type': '<(gtest_target_type)', 'sources': [ # Tests. 'android/jni_android_unittest.cc', @@ -313,6 +313,11 @@ 'android/jni_generator/jni_generator.gyp:jni_generator_tests', ], }], + ['OS=="android" and "<(gtest_target_type)"=="shared_library"', { + 'dependencies': [ + '../testing/android/native_test.gyp:native_test_native_code', + ], + }], ['use_glib==1', { 'sources!': [ 'file_version_info_unittest.cc', @@ -627,5 +632,54 @@ }, ], }], + # Special target to wrap a <(gtest_target_type)==shared_library + # base_unittests into an android apk for execution. + # TODO(jrg): lib.target comes from _InstallableTargetInstallPath() + # in the gyp make generator. What is the correct way to extract + # this path from gyp and into 'raw' for input to antfiles? + # Hard-coding in the gypfile seems a poor choice. + # TODO(jrg): there has to be a shorter way to do all this. Try + # and convert this entire target cluster into ~5 lines that can be + # trivially copied to other projects with only a deps change, such + # as with a new gtest_target_type called + # 'shared_library_apk_wrapper' that does a lot of this magically. + ['OS=="android" and "<(gtest_target_type)"=="shared_library"', { + 'targets': [ + { + 'target_name': 'base_unittests_apk', + 'type': 'none', + 'dependencies': [ + 'base', # So that android/java/java.gyp:base_java is built + 'base_unittests', + ], + 'actions': [ + { + # Generate apk files (including source and antfile) from + # a template, and builds them. + 'action_name': 'generate_and_build', + 'inputs': [ + '../testing/android/generate_native_test.py', + '<(PRODUCT_DIR)/lib.target/libbase_unittests.so', + '<(PRODUCT_DIR)/chromium_base.jar' + ], + 'outputs': [ + '<(PRODUCT_DIR)/ChromeNativeTests_base_unittests-debug.apk', + ], + 'action': [ + '../testing/android/generate_native_test.py', + '--native_library', + '<(PRODUCT_DIR)/lib.target/libbase_unittests.so', + '--jar', + '<(PRODUCT_DIR)/chromium_base.jar', + '--output', + '<(PRODUCT_DIR)/base_unittests_apk', + '--ant-args', + '-DPRODUCT_DIR=<(PRODUCT_DIR)', + '--ant-compile' + ], + }, + ] + }], + }], ], } |