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 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 jobject obj, | 54 jobject obj, |
55 jstring jfiles_dir, | 55 jstring jfiles_dir, |
56 jobject app_context) { | 56 jobject app_context) { |
57 // Command line basic initialization, will be fully initialized later. | 57 // Command line basic initialization, will be fully initialized later. |
58 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; | 58 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; |
59 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); | 59 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); |
60 | 60 |
61 // Set the application context in base. | 61 // Set the application context in base. |
62 base::android::ScopedJavaLocalRef<jobject> scoped_context( | 62 base::android::ScopedJavaLocalRef<jobject> scoped_context( |
63 env, env->NewLocalRef(app_context)); | 63 env, env->NewLocalRef(app_context)); |
64 base::android::InitApplicationContext(scoped_context); | 64 base::android::InitApplicationContext(env, scoped_context); |
65 base::android::RegisterJni(env); | 65 base::android::RegisterJni(env); |
66 | 66 |
67 std::vector<std::string> args; | 67 std::vector<std::string> args; |
68 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); | 68 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); |
69 | 69 |
70 std::vector<char*> argv; | 70 std::vector<char*> argv; |
71 int argc = ArgsToArgv(args, &argv); | 71 int argc = ArgsToArgv(args, &argv); |
72 | 72 |
73 // Fully initialize command line with arguments. | 73 // Fully initialize command line with arguments. |
74 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 74 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) | 110 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) |
111 return -1; | 111 return -1; |
112 | 112 |
113 if (!content::RegisterNativesImpl(env)) | 113 if (!content::RegisterNativesImpl(env)) |
114 return -1; | 114 return -1; |
115 | 115 |
116 content::SetContentMainDelegate(new content::ShellMainDelegate()); | 116 content::SetContentMainDelegate(new content::ShellMainDelegate()); |
117 return JNI_VERSION_1_4; | 117 return JNI_VERSION_1_4; |
118 } | 118 } |
OLD | NEW |