summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authornileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 23:39:32 +0000
committernileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 23:39:32 +0000
commit575ab5330492664079ea89804bec615d15ea3b33 (patch)
tree51cb64d342c135672055dd11ae59498027f1312c /testing
parentf3604ab2acda99a8c306dfa9fd578851ecb27ba1 (diff)
downloadchromium_src-575ab5330492664079ea89804bec615d15ea3b33.zip
chromium_src-575ab5330492664079ea89804bec615d15ea3b33.tar.gz
chromium_src-575ab5330492664079ea89804bec615d15ea3b33.tar.bz2
Use a test specific macro to call JNI registrars during APK tests.
TBR=rsleevi@chromium.org,jam@chromium.org (Using TBR as this is a trivial gyp change) BUG=125059 TEST= Review URL: https://chromiumcodereview.appspot.com/10658017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing')
-rw-r--r--testing/android/native_test_launcher.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc
index b88cb30..dad604b 100644
--- a/testing/android/native_test_launcher.cc
+++ b/testing/android/native_test_launcher.cc
@@ -13,10 +13,9 @@
#include <signal.h>
#include <stdio.h>
+#include "base/android/base_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
-#include "base/android/locale_utils.h"
-#include "base/android/path_utils.h"
#include "base/android/scoped_java_ref.h"
#include "base/at_exit.h"
#include "base/command_line.h"
@@ -29,6 +28,14 @@
#include "gtest/gtest.h"
#include "testing/android/jni/chrome_native_test_activity_jni.h"
+#if defined(REGISTER_NET_UNITTESTS_JNI)
+#include "net/android/net_jni_registrar.h"
+#endif
+
+#if defined(REGISTER_CONTENT_UNITTESTS_JNI)
+#include "content/app/android/content_jni_registrar.h"
+#endif
+
// The main function of the program to be wrapped as a test apk.
extern int main(int argc, char** argv);
@@ -176,8 +183,18 @@ static void RunTests(JNIEnv* env,
env, env->NewLocalRef(app_context));
base::android::InitApplicationContext(scoped_context);
- base::android::RegisterLocaleUtils(env);
- base::android::RegisterPathUtils(env);
+ base::android::RegisterJni(env);
+
+ // A unittest target may define these macros to register JNI dependencies.
+ // These should only be defined if the target also depends on the
+ // corresponding registrar.
+#if defined(REGISTER_NET_UNITTESTS_JNI)
+ net::android::RegisterJni(env);
+#endif
+
+#if defined(REGISTER_CONTENT_UNITTESTS_JNI)
+ content::android::RegisterJni(env);
+#endif
FilePath files_dir(base::android::ConvertJavaStringToUTF8(env, jfiles_dir));
// A few options, such "--gtest_list_tests", will just use printf directly