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

Unified Diff: net/android/keystore_unittest.cc

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android: Don't require RegisterNatives if there are none Created 4 years, 4 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: net/android/keystore_unittest.cc
diff --git a/net/android/keystore_unittest.cc b/net/android/keystore_unittest.cc
index b6f4aaa6ae8b7d3e5f2918a2095630f9b94e5f7f..d28d6fa2bb4ab210a2735e75593642a1fb02e193 100644
--- a/net/android/keystore_unittest.cc
+++ b/net/android/keystore_unittest.cc
@@ -58,16 +58,6 @@ namespace {
typedef base::android::ScopedJavaLocalRef<jobject> ScopedJava;
-JNIEnv* InitEnv() {
- JNIEnv* env = base::android::AttachCurrentThread();
- static bool inited = false;
- if (!inited) {
- RegisterNativesImpl(env);
- inited = true;
- }
- return env;
-}
-
// Returns true if running on an Android version older than 4.2
bool IsOnAndroidOlderThan_4_2(void) {
const int kAndroid42ApiLevel = 17;
@@ -171,7 +161,7 @@ EVP_PKEY* ImportPublicKeyFile(const char* filename) {
// Retrieve a JNI local ref from encoded PKCS#8 data.
ScopedJava GetPKCS8PrivateKeyJava(PrivateKeyType key_type,
const std::string& pkcs8_key) {
- JNIEnv* env = InitEnv();
+ JNIEnv* env = base::android::AttachCurrentThread();
base::android::ScopedJavaLocalRef<jbyteArray> bytes(
base::android::ToJavaByteArray(
env, reinterpret_cast<const uint8_t*>(pkcs8_key.data()),
@@ -408,7 +398,6 @@ void DoKeySigningWithWrapper(EVP_PKEY* wrapper_key,
TEST(AndroidKeyStore, GetRSAKeyModulus) {
crypto::OpenSSLErrStackTracer err_trace(FROM_HERE);
- InitEnv();
// Load the test RSA key.
crypto::ScopedEVP_PKEY pkey(ImportPrivateKeyFile(kTestRsaKeyFile));

Powered by Google App Engine
This is Rietveld 408576698