| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/path_utils.h" | 9 #include "base/android/path_utils.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 void LibraryLoadedOnMainThread(JNIEnv* env) { | 122 void LibraryLoadedOnMainThread(JNIEnv* env) { |
| 123 static const char* const kInitialArgv[] = { "ChromeTestActivity" }; | 123 static const char* const kInitialArgv[] = { "ChromeTestActivity" }; |
| 124 | 124 |
| 125 { | 125 { |
| 126 // We need a test suite to be created before we do any tracing or | 126 // We need a test suite to be created before we do any tracing or |
| 127 // logging: it creates a global at_exit_manager and initializes | 127 // logging: it creates a global at_exit_manager and initializes |
| 128 // internal gtest data structures based on the command line. | 128 // internal gtest data structures based on the command line. |
| 129 // It needs to be scoped as it also resets the CommandLine. | 129 // It needs to be scoped as it also resets the CommandLine. |
| 130 std::vector<std::string> args; | 130 std::vector<std::string> args; |
| 131 FilePath path("/data/user/0/org.chromium.native_tests/files/"); | 131 FilePath path("/data/user/0/org.chromium.native_test/files/"); |
| 132 ParseArgsFromCommandLineFile(path, &args); | 132 ParseArgsFromCommandLineFile(path, &args); |
| 133 std::vector<char*> argv; | 133 std::vector<char*> argv; |
| 134 ArgsToArgv(args, &argv); | 134 ArgsToArgv(args, &argv); |
| 135 base::TestSuite test_suite(argv.size(), &argv[0]); | 135 base::TestSuite test_suite(argv.size(), &argv[0]); |
| 136 } | 136 } |
| 137 | 137 |
| 138 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); | 138 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); |
| 139 | 139 |
| 140 logging::InitLogging(NULL, | 140 logging::InitLogging(NULL, |
| 141 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 141 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // This is called by the VM when the shared library is first loaded. | 181 // This is called by the VM when the shared library is first loaded. |
| 182 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 182 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 183 base::android::InitVM(vm); | 183 base::android::InitVM(vm); |
| 184 JNIEnv* env = base::android::AttachCurrentThread(); | 184 JNIEnv* env = base::android::AttachCurrentThread(); |
| 185 if (!RegisterNativesImpl(env)) { | 185 if (!RegisterNativesImpl(env)) { |
| 186 return -1; | 186 return -1; |
| 187 } | 187 } |
| 188 LibraryLoadedOnMainThread(env); | 188 LibraryLoadedOnMainThread(env); |
| 189 return JNI_VERSION_1_4; | 189 return JNI_VERSION_1_4; |
| 190 } | 190 } |
| OLD | NEW |