| 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 native tests inside an | 5 // This class sets up the environment for running the native tests inside an |
| 6 // android application. It outputs (to a fifo) markers identifying the | 6 // android application. It outputs (to a fifo) markers identifying the |
| 7 // START/PASSED/CRASH of the test suite, FAILURE/SUCCESS of individual tests, | 7 // START/PASSED/CRASH of the test suite, FAILURE/SUCCESS of individual tests, |
| 8 // etc. | 8 // etc. |
| 9 // These markers are read by the test runner script to generate test results. | 9 // These markers are read by the test runner script to generate test results. |
| 10 // It installs signal handlers to detect crashes. | 10 // It installs signal handlers to detect crashes. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const JavaParamRef<jstring>& jcommand_line_flags, | 74 const JavaParamRef<jstring>& jcommand_line_flags, |
| 75 const JavaParamRef<jstring>& jcommand_line_file_path, | 75 const JavaParamRef<jstring>& jcommand_line_file_path, |
| 76 const JavaParamRef<jstring>& jstdout_file_path, | 76 const JavaParamRef<jstring>& jstdout_file_path, |
| 77 jboolean jstdout_fifo, | 77 jboolean jstdout_fifo, |
| 78 const JavaParamRef<jobject>& app_context) { | 78 const JavaParamRef<jobject>& app_context) { |
| 79 // Command line initialized basically, will be fully initialized later. | 79 // Command line initialized basically, will be fully initialized later. |
| 80 static const char* const kInitialArgv[] = { "ChromeTestActivity" }; | 80 static const char* const kInitialArgv[] = { "ChromeTestActivity" }; |
| 81 base::CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); | 81 base::CommandLine::Init(arraysize(kInitialArgv), kInitialArgv); |
| 82 | 82 |
| 83 // Set the application context in base. | 83 // Set the application context in base. |
| 84 base::android::ScopedJavaLocalRef<jobject> scoped_context( | 84 base::android::InitApplicationContext(env, app_context); |
| 85 env, env->NewLocalRef(app_context)); | |
| 86 base::android::InitApplicationContext(env, scoped_context); | |
| 87 base::android::RegisterJni(env); | 85 base::android::RegisterJni(env); |
| 88 | 86 |
| 89 std::vector<std::string> args; | 87 std::vector<std::string> args; |
| 90 | 88 |
| 91 const std::string command_line_file_path( | 89 const std::string command_line_file_path( |
| 92 base::android::ConvertJavaStringToUTF8(env, jcommand_line_file_path)); | 90 base::android::ConvertJavaStringToUTF8(env, jcommand_line_file_path)); |
| 93 if (command_line_file_path.empty()) | 91 if (command_line_file_path.empty()) |
| 94 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); | 92 ParseArgsFromCommandLineFile(kCommandLineFilePath, &args); |
| 95 else | 93 else |
| 96 ParseArgsFromCommandLineFile(command_line_file_path.c_str(), &args); | 94 ParseArgsFromCommandLineFile(command_line_file_path.c_str(), &args); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 sa.sa_sigaction = SignalHandler; | 150 sa.sa_sigaction = SignalHandler; |
| 153 sa.sa_flags = SA_SIGINFO; | 151 sa.sa_flags = SA_SIGINFO; |
| 154 | 152 |
| 155 for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) { | 153 for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) { |
| 156 sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]); | 154 sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]); |
| 157 } | 155 } |
| 158 } | 156 } |
| 159 | 157 |
| 160 } // namespace android | 158 } // namespace android |
| 161 } // namespace testing | 159 } // namespace testing |
| OLD | NEW |