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 | 9 |
10 #include "base/android/base_jni_registrar.h" | 10 #include "base/android/base_jni_registrar.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
14 #include "base/base_switches.h" | 14 #include "base/base_switches.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/string_tokenizer.h" | |
20 #include "base/string_util.h" | 19 #include "base/string_util.h" |
21 #include "base/stringprintf.h" | 20 #include "base/stringprintf.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/shell/android/shell_jni_registrar.h" | 23 #include "content/shell/android/shell_jni_registrar.h" |
24 #include "jni/ContentBrowserTestsActivity_jni.h" | 24 #include "jni/ContentBrowserTestsActivity_jni.h" |
25 | 25 |
26 // The main function of the program to be wrapped as an apk. | 26 // The main function of the program to be wrapped as an apk. |
27 extern int main(int argc, char** argv); | 27 extern int main(int argc, char** argv); |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 void ParseArgsFromString(const std::string& command_line, | 31 void ParseArgsFromString(const std::string& command_line, |
32 std::vector<std::string>* args) { | 32 std::vector<std::string>* args) { |
33 StringTokenizer tokenizer(command_line, kWhitespaceASCII); | 33 base::StringTokenizer tokenizer(command_line, kWhitespaceASCII); |
34 tokenizer.set_quote_chars("\""); | 34 tokenizer.set_quote_chars("\""); |
35 while (tokenizer.GetNext()) { | 35 while (tokenizer.GetNext()) { |
36 std::string token; | 36 std::string token; |
37 RemoveChars(tokenizer.token(), "\"", &token); | 37 RemoveChars(tokenizer.token(), "\"", &token); |
38 args->push_back(token); | 38 args->push_back(token); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 void ParseArgsFromCommandLineFile(std::vector<std::string>* args) { | 42 void ParseArgsFromCommandLineFile(std::vector<std::string>* args) { |
43 // The test runner script writes the command line file in | 43 // The test runner script writes the command line file in |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return -1; | 118 return -1; |
119 | 119 |
120 if (!content::android::RegisterShellJni(env)) | 120 if (!content::android::RegisterShellJni(env)) |
121 return -1; | 121 return -1; |
122 | 122 |
123 if (!RegisterNativesImpl(env)) | 123 if (!RegisterNativesImpl(env)) |
124 return -1; | 124 return -1; |
125 | 125 |
126 return JNI_VERSION_1_4; | 126 return JNI_VERSION_1_4; |
127 } | 127 } |
OLD | NEW |