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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 namespace content { | 51 namespace content { |
52 | 52 |
53 // TODO(nileshagrawal): Refactor and deduplicate with | 53 // TODO(nileshagrawal): Refactor and deduplicate with |
54 // testing/android/native_test_launcher.cc | 54 // testing/android/native_test_launcher.cc |
55 static void RunTests(JNIEnv* env, | 55 static void RunTests(JNIEnv* env, |
56 jobject obj, | 56 jobject obj, |
57 jstring jfiles_dir, | 57 jstring jfiles_dir, |
58 jobject app_context) { | 58 jobject app_context) { |
59 // Command line basic initialization, will be fully initialized later. | 59 // Command line basic initialization, will be fully initialized later. |
60 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; | 60 static const char* const kInitialArgv[] = { "ContentBrowserTestsActivity" }; |
61 CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); | 61 base::CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); |
62 | 62 |
63 // Set the application context in base. | 63 // Set the application context in base. |
64 base::android::ScopedJavaLocalRef<jobject> scoped_context( | 64 base::android::ScopedJavaLocalRef<jobject> scoped_context( |
65 env, env->NewLocalRef(app_context)); | 65 env, env->NewLocalRef(app_context)); |
66 base::android::InitApplicationContext(env, scoped_context); | 66 base::android::InitApplicationContext(env, scoped_context); |
67 base::android::RegisterJni(env); | 67 base::android::RegisterJni(env); |
68 | 68 |
69 std::vector<std::string> args; | 69 std::vector<std::string> args; |
70 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); | 70 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); |
71 | 71 |
72 std::vector<char*> argv; | 72 std::vector<char*> argv; |
73 int argc = ArgsToArgv(args, &argv); | 73 int argc = ArgsToArgv(args, &argv); |
74 | 74 |
75 // Fully initialize command line with arguments. | 75 // Fully initialize command line with arguments. |
76 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 76 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
77 command_line->AppendArguments(CommandLine(argc, &argv[0]), false); | 77 command_line->AppendArguments(base::CommandLine(argc, &argv[0]), false); |
78 | 78 |
79 // Append required switches. | 79 // Append required switches. |
80 command_line->AppendSwitch(content::kSingleProcessTestsFlag); | 80 command_line->AppendSwitch(content::kSingleProcessTestsFlag); |
81 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 81 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
82 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 82 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
83 // Specify a socket name to not conflict with the default one used | 83 // Specify a socket name to not conflict with the default one used |
84 // in content_shell. | 84 // in content_shell. |
85 command_line->AppendSwitchASCII(switches::kRemoteDebuggingSocketName, | 85 command_line->AppendSwitchASCII(switches::kRemoteDebuggingSocketName, |
86 "content_browsertests_devtools_remote"); | 86 "content_browsertests_devtools_remote"); |
87 | 87 |
(...skipping 26 matching lines...) Expand all Loading... |
114 | 114 |
115 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) | 115 if (!content::NestedMessagePumpAndroid::RegisterJni(env)) |
116 return -1; | 116 return -1; |
117 | 117 |
118 if (!content::RegisterNativesImpl(env)) | 118 if (!content::RegisterNativesImpl(env)) |
119 return -1; | 119 return -1; |
120 | 120 |
121 content::SetContentMainDelegate(new content::ShellMainDelegate()); | 121 content::SetContentMainDelegate(new content::ShellMainDelegate()); |
122 return JNI_VERSION_1_4; | 122 return JNI_VERSION_1_4; |
123 } | 123 } |
OLD | NEW |