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 | 10 |
10 #include "base/android/base_jni_registrar.h" | 11 #include "base/android/base_jni_registrar.h" |
11 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
12 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
13 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
14 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/file_util.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/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
21 #include "base/strings/string_tokenizer.h" | 21 #include "base/strings/string_tokenizer.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/test_launcher.h" | 25 #include "content/public/test/test_launcher.h" |
26 #include "content/shell/android/shell_jni_registrar.h" | 26 #include "content/shell/android/shell_jni_registrar.h" |
(...skipping 19 matching lines...) Expand all Loading... |
46 "/data/local/tmp/content-browser-tests-command-line"; | 46 "/data/local/tmp/content-browser-tests-command-line"; |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 namespace content { | 50 namespace content { |
51 | 51 |
52 static void RunTests(JNIEnv* env, | 52 static void RunTests(JNIEnv* env, |
53 jobject obj, | 53 jobject obj, |
54 jstring jfiles_dir, | 54 jstring jfiles_dir, |
55 jobject app_context) { | 55 jobject app_context) { |
56 | |
57 // Command line basic initialization, will be fully initialized later. | 56 // Command line basic initialization, will be fully initialized later. |
58 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; | 57 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; |
59 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); | 58 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); |
60 | 59 |
61 // Set the application context in base. | 60 // Set the application context in base. |
62 base::android::ScopedJavaLocalRef<jobject> scoped_context( | 61 base::android::ScopedJavaLocalRef<jobject> scoped_context( |
63 env, env->NewLocalRef(app_context)); | 62 env, env->NewLocalRef(app_context)); |
64 base::android::InitApplicationContext(scoped_context); | 63 base::android::InitApplicationContext(scoped_context); |
65 base::android::RegisterJni(env); | 64 base::android::RegisterJni(env); |
66 | 65 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 107 |
109 if (!content::BrowserTestMessagePumpAndroid::RegisterJni(env)) | 108 if (!content::BrowserTestMessagePumpAndroid::RegisterJni(env)) |
110 return -1; | 109 return -1; |
111 | 110 |
112 if (!content::RegisterNativesImpl(env)) | 111 if (!content::RegisterNativesImpl(env)) |
113 return -1; | 112 return -1; |
114 | 113 |
115 content::SetContentMainDelegate(new content::ShellMainDelegate()); | 114 content::SetContentMainDelegate(new content::ShellMainDelegate()); |
116 return JNI_VERSION_1_4; | 115 return JNI_VERSION_1_4; |
117 } | 116 } |
OLD | NEW |