summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 02:21:02 +0000
committernileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 02:21:02 +0000
commit6e4cc8f8417bf4eae3720e42e9bd0051da774d63 (patch)
treef65bb87e4061529583b11cbc25f0c34d531e303a
parent4ce995ea36b4cf6cc027f6d4abe9db904f703b8f (diff)
downloadchromium_src-6e4cc8f8417bf4eae3720e42e9bd0051da774d63.zip
chromium_src-6e4cc8f8417bf4eae3720e42e9bd0051da774d63.tar.gz
chromium_src-6e4cc8f8417bf4eae3720e42e9bd0051da774d63.tar.bz2
Register JNI methods before running unittests on android.
A better way to implement: http://codereview.chromium.org/10658017/ BUG=125059 TEST= Review URL: https://chromiumcodereview.appspot.com/10668047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144374 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/android/gtest_filter/net_unittests_disabled11
-rw-r--r--net/base/run_all_unittests.cc12
-rw-r--r--testing/android/native_test_launcher.cc5
3 files changed, 20 insertions, 8 deletions
diff --git a/build/android/gtest_filter/net_unittests_disabled b/build/android/gtest_filter/net_unittests_disabled
index acd8ea3..46aae2a 100644
--- a/build/android/gtest_filter/net_unittests_disabled
+++ b/build/android/gtest_filter/net_unittests_disabled
@@ -117,8 +117,9 @@ VerifyRoot/CertVerifyProcWeakDigestTest.*
# Relies on TestServer which isn't yet configured upstream.
URLRequestContextBuilderTest.*
-# Lack of JNI, Should be enabled after we move to APK tests.
-# crbug/125059
-MimeUtilTest.ExtensionTest
-MimeUtilTest.FileTest
-HostResolverImplDnsTest.*
+# All cert_verify_proc_unittest.cc failing since JNI was enabled.
+VerifyIntermediate/CertVerifyProcWeakDigestTest.*
+VerifyEndEntity/CertVerifyProcWeakDigestTest.*
+VerifyIncompleteIntermediate/CertVerifyProcWeakDigestTest.*
+VerifyIncompleteEndEntity/CertVerifyProcWeakDigestTest.*
+VerifyMixed/CertVerifyProcWeakDigestTest.*
diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc
index a7b82e9..a139a8f 100644
--- a/net/base/run_all_unittests.cc
+++ b/net/base/run_all_unittests.cc
@@ -10,12 +10,24 @@
#include "net/socket/ssl_server_socket.h"
#include "net/spdy/spdy_session.h"
+#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#include "net/android/net_jni_registrar.h"
+#endif
+
using net::internal::ClientSocketPoolBaseHelper;
using net::SpdySession;
int main(int argc, char** argv) {
// Record histograms, so we can get histograms data in tests.
base::StatisticsRecorder recorder;
+
+#if defined(OS_ANDROID)
+ // Register JNI bindings for android. Doing it early as the test suite setup
+ // may initiate a call to Java.
+ net::android::RegisterJni(base::android::AttachCurrentThread());
+#endif
+
NetTestSuite test_suite(argc, argv);
ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled(false);
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc
index b88cb30..b9e78d2 100644
--- a/testing/android/native_test_launcher.cc
+++ b/testing/android/native_test_launcher.cc
@@ -13,6 +13,7 @@
#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"
@@ -175,9 +176,7 @@ static void RunTests(JNIEnv* env,
base::android::ScopedJavaLocalRef<jobject> scoped_context(
env, env->NewLocalRef(app_context));
base::android::InitApplicationContext(scoped_context);
-
- base::android::RegisterLocaleUtils(env);
- base::android::RegisterPathUtils(env);
+ base::android::RegisterJni(env);
FilePath files_dir(base::android::ConvertJavaStringToUTF8(env, jfiles_dir));
// A few options, such "--gtest_list_tests", will just use printf directly