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

Side by Side Diff: content/shell/android/browsertests_apk/content_browser_tests_android.cc

Issue 141223002: Move the android library loader from content to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix final nits Created 6 years, 10 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 unified diff | Download patch
OLDNEW
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/fifo_utils.h" 12 #include "base/android/fifo_utils.h"
13 #include "base/android/jni_android.h" 13 #include "base/android/jni_android.h"
14 #include "base/android/jni_string.h" 14 #include "base/android/jni_string.h"
15 #include "base/android/library_loader/library_loader_hooks.h"
15 #include "base/android/scoped_java_ref.h" 16 #include "base/android/scoped_java_ref.h"
16 #include "base/base_switches.h" 17 #include "base/base_switches.h"
17 #include "base/command_line.h" 18 #include "base/command_line.h"
18 #include "base/files/file_path.h" 19 #include "base/files/file_path.h"
19 #include "base/logging.h" 20 #include "base/logging.h"
20 #include "base/strings/string_tokenizer.h" 21 #include "base/strings/string_tokenizer.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "content/public/app/android_library_loader_hooks.h" 24 #include "content/public/app/android_library_loader_hooks.h"
24 #include "content/public/app/content_main.h" 25 #include "content/public/app/content_main.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 base::android::RedirectStream(stdout, fifo_path, "w"); 92 base::android::RedirectStream(stdout, fifo_path, "w");
92 dup2(STDOUT_FILENO, STDERR_FILENO); 93 dup2(STDOUT_FILENO, STDERR_FILENO);
93 94
94 ScopedMainEntryLogger scoped_main_entry_logger; 95 ScopedMainEntryLogger scoped_main_entry_logger;
95 main(argc, &argv[0]); 96 main(argc, &argv[0]);
96 } 97 }
97 } // namespace content 98 } // namespace content
98 99
99 // This is called by the VM when the shared library is first loaded. 100 // This is called by the VM when the shared library is first loaded.
100 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { 101 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
102
103 base::android::SetLibraryLoadedHook(&content::LibraryLoaded);
104
101 base::android::InitVM(vm); 105 base::android::InitVM(vm);
102 JNIEnv* env = base::android::AttachCurrentThread(); 106 JNIEnv* env = base::android::AttachCurrentThread();
103 107
104 if (!content::RegisterLibraryLoaderEntryHook(env)) 108 if (!base::android::RegisterLibraryLoaderEntryHook(env))
105 return -1; 109 return -1;
106 110
107 if (!content::android::RegisterShellJni(env)) 111 if (!content::android::RegisterShellJni(env))
108 return -1; 112 return -1;
109 113
110 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) 114 if (!content::NestedMessagePumpAndroid::RegisterJni(env))
111 return -1; 115 return -1;
112 116
113 if (!content::RegisterNativesImpl(env)) 117 if (!content::RegisterNativesImpl(env))
114 return -1; 118 return -1;
115 119
116 content::SetContentMainDelegate(new content::ShellMainDelegate()); 120 content::SetContentMainDelegate(new content::ShellMainDelegate());
117 return JNI_VERSION_1_4; 121 return JNI_VERSION_1_4;
118 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698