summaryrefslogtreecommitdiffstats
path: root/testing/android
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 09:48:08 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 09:48:08 +0000
commit4b59931a5902901fefc64c2b56abf458a6870fe7 (patch)
tree38d3a7d66520f26526d123e958e6cad08c436670 /testing/android
parent6132fdcd2e8a9d09c6c0faf6deb3629e89f69d4e (diff)
downloadchromium_src-4b59931a5902901fefc64c2b56abf458a6870fe7.zip
chromium_src-4b59931a5902901fefc64c2b56abf458a6870fe7.tar.gz
chromium_src-4b59931a5902901fefc64c2b56abf458a6870fe7.tar.bz2
APK-based unittests
Rather than chromium's LOG(ERROR) uses directly __android_log_write for the gtest printer. Cleans up the log and make it simpler to spot real errors. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10579040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/android')
-rw-r--r--testing/android/native_test_launcher.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc
index b9e78d2..1bf9cc7 100644
--- a/testing/android/native_test_launcher.cc
+++ b/testing/android/native_test_launcher.cc
@@ -35,6 +35,10 @@ extern int main(int argc, char** argv);
namespace {
+void log_write(int level, const char* msg) {
+ __android_log_write(level, "chromium", msg);
+}
+
// The list of signals which are considered to be crashes.
const int kExceptionSignals[] = {
SIGSEGV, SIGABRT, SIGFPE, SIGILL, SIGBUS, -1
@@ -46,7 +50,7 @@ struct sigaction g_old_sa[NSIG];
void SignalHandler(int sig, siginfo_t *info, void *reserved)
{
// Output the crash marker.
- __android_log_write(ANDROID_LOG_ERROR, "chromium", "[ CRASHED ]");
+ log_write(ANDROID_LOG_ERROR, "[ CRASHED ]");
g_old_sa[sig].sa_sigaction(sig, info, reserved);
}
@@ -125,13 +129,13 @@ void AndroidLogPrinter::OnTestProgramStart(
const ::testing::UnitTest& unit_test) {
std::string msg = StringPrintf("[ START ] %d",
unit_test.test_to_run_count());
- LOG(ERROR) << msg;
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
}
void AndroidLogPrinter::OnTestStart(const ::testing::TestInfo& test_info) {
std::string msg = StringPrintf("[ RUN ] %s.%s",
test_info.test_case_name(), test_info.name());
- LOG(ERROR) << msg;
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
}
void AndroidLogPrinter::OnTestPartResult(
@@ -142,21 +146,21 @@ void AndroidLogPrinter::OnTestPartResult(
test_part_result.file_name(),
test_part_result.line_number(),
test_part_result.summary());
- LOG(ERROR) << msg;
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
}
void AndroidLogPrinter::OnTestEnd(const ::testing::TestInfo& test_info) {
std::string msg = StringPrintf("%s %s.%s",
test_info.result()->Failed() ? "[ FAILED ]" : "[ OK ]",
test_info.test_case_name(), test_info.name());
- LOG(ERROR) << msg;
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
}
void AndroidLogPrinter::OnTestProgramEnd(
const ::testing::UnitTest& unit_test) {
std::string msg = StringPrintf("[ END ] %d",
unit_test.successful_test_count());
- LOG(ERROR) << msg;
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
}
} // namespace