| 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 // This class sets up the environment for running the content browser tests | 5 // This class sets up the environment for running the content browser tests |
| 6 // inside an android application. | 6 // inside an android application. |
| 7 | 7 |
| 8 #include <android/log.h> | 8 #include <android/log.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include "base/android/base_jni_registrar.h" | 11 #include "base/android/base_jni_registrar.h" |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
| 14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/logging.h" | 18 #include "base/logging.h" |
| 19 #include "base/strings/string_tokenizer.h" | 19 #include "base/strings/string_tokenizer.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "content/public/app/android_library_loader_hooks.h" | 22 #include "content/public/app/android_library_loader_hooks.h" |
| 23 #include "content/public/app/content_main.h" | 23 #include "content/public/app/content_main.h" |
| 24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/test/nested_message_pump_android.h" |
| 25 #include "content/public/test/test_launcher.h" | 26 #include "content/public/test/test_launcher.h" |
| 26 #include "content/shell/android/shell_jni_registrar.h" | 27 #include "content/shell/android/shell_jni_registrar.h" |
| 27 #include "content/shell/app/shell_main_delegate.h" | 28 #include "content/shell/app/shell_main_delegate.h" |
| 28 #include "content/test/browser_test_message_pump_android.h" | |
| 29 #include "jni/ContentBrowserTestsActivity_jni.h" | 29 #include "jni/ContentBrowserTestsActivity_jni.h" |
| 30 #include "testing/android/native_test_util.h" | 30 #include "testing/android/native_test_util.h" |
| 31 | 31 |
| 32 using testing::native_test_util::ArgsToArgv; | 32 using testing::native_test_util::ArgsToArgv; |
| 33 using testing::native_test_util::CreateFIFO; | 33 using testing::native_test_util::CreateFIFO; |
| 34 using testing::native_test_util::ParseArgsFromCommandLineFile; | 34 using testing::native_test_util::ParseArgsFromCommandLineFile; |
| 35 using testing::native_test_util::RedirectStream; | 35 using testing::native_test_util::RedirectStream; |
| 36 using testing::native_test_util::ScopedMainEntryLogger; | 36 using testing::native_test_util::ScopedMainEntryLogger; |
| 37 | 37 |
| 38 // The main function of the program to be wrapped as an apk. | 38 // The main function of the program to be wrapped as an apk. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 98 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 99 base::android::InitVM(vm); | 99 base::android::InitVM(vm); |
| 100 JNIEnv* env = base::android::AttachCurrentThread(); | 100 JNIEnv* env = base::android::AttachCurrentThread(); |
| 101 | 101 |
| 102 if (!content::RegisterLibraryLoaderEntryHook(env)) | 102 if (!content::RegisterLibraryLoaderEntryHook(env)) |
| 103 return -1; | 103 return -1; |
| 104 | 104 |
| 105 if (!content::android::RegisterShellJni(env)) | 105 if (!content::android::RegisterShellJni(env)) |
| 106 return -1; | 106 return -1; |
| 107 | 107 |
| 108 if (!content::BrowserTestMessagePumpAndroid::RegisterJni(env)) | 108 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) |
| 109 return -1; | 109 return -1; |
| 110 | 110 |
| 111 if (!content::RegisterNativesImpl(env)) | 111 if (!content::RegisterNativesImpl(env)) |
| 112 return -1; | 112 return -1; |
| 113 | 113 |
| 114 content::SetContentMainDelegate(new content::ShellMainDelegate()); | 114 content::SetContentMainDelegate(new content::ShellMainDelegate()); |
| 115 return JNI_VERSION_1_4; | 115 return JNI_VERSION_1_4; |
| 116 } | 116 } |
| OLD | NEW |