| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.native_test; | 5 package org.chromium.native_test; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Instrumentation; | 8 import android.app.Instrumentation; |
| 9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| 11 import android.os.Bundle; | 11 import android.os.Bundle; |
| 12 import android.util.Log; | 12 import android.util.Log; |
| 13 | 13 |
| 14 import java.io.BufferedInputStream; | 14 import java.io.BufferedInputStream; |
| 15 import java.io.BufferedReader; | 15 import java.io.BufferedReader; |
| 16 import java.io.File; | 16 import java.io.File; |
| 17 import java.io.FileInputStream; | 17 import java.io.FileInputStream; |
| 18 import java.io.FileNotFoundException; | 18 import java.io.FileNotFoundException; |
| 19 import java.io.IOException; | 19 import java.io.IOException; |
| 20 import java.io.InputStreamReader; | 20 import java.io.InputStreamReader; |
| 21 import java.util.HashMap; | 21 import java.util.HashMap; |
| 22 import java.util.Map; | 22 import java.util.Map; |
| 23 import java.util.regex.Matcher; | 23 import java.util.regex.Matcher; |
| 24 import java.util.regex.Pattern; | 24 import java.util.regex.Pattern; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * An Instrumentation that runs tests based on ChromeNativeTestActivity. | 27 * An Instrumentation that runs tests based on ChromeNativeTestActivity. |
| 28 */ | 28 */ |
| 29 public class ChromiumNativeTestInstrumentationTestRunner extends Instrumentation
{ | 29 public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation { |
| 30 | 30 |
| 31 private static final String TAG = "ChromiumNativeTestInstrumentationTestRunn
er"; | 31 private static final String TAG = "ChromeNativeTestInstrumentationTestRunner
"; |
| 32 private static final Pattern RE_TEST_OUTPUT = Pattern.compile("\\[ *([^ ]*)
*\\] ?([^ ]*) .*"); | 32 private static final Pattern RE_TEST_OUTPUT = Pattern.compile("\\[ *([^ ]*)
*\\] ?([^ ]*) .*"); |
| 33 | 33 |
| 34 private static interface ResultsBundleGenerator { | 34 private static interface ResultsBundleGenerator { |
| 35 public Bundle generate(Map<String, TestResult> rawResults); | 35 public Bundle generate(Map<String, TestResult> rawResults); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private String mCommandLineFile; | 38 private String mCommandLineFile; |
| 39 private String mCommandLineFlags; | 39 private String mCommandLineFlags; |
| 40 private Bundle mLogBundle; | 40 private Bundle mLogBundle; |
| 41 private ResultsBundleGenerator mBundleGenerator; | 41 private ResultsBundleGenerator mBundleGenerator; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 "\nFAILURES!!! Tests run: " + Integer.toString(rawResult
s.size()) | 184 "\nFAILURES!!! Tests run: " + Integer.toString(rawResult
s.size()) |
| 185 + ", Failures: " + Integer.toString(testsFailed) + ", Er
rors: 0"); | 185 + ", Failures: " + Integer.toString(testsFailed) + ", Er
rors: 0"); |
| 186 } | 186 } |
| 187 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, | 187 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, |
| 188 resultBuilder.toString()); | 188 resultBuilder.toString()); |
| 189 return resultsBundle; | 189 return resultsBundle; |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 } | 193 } |
| OLD | NEW |