Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: testing/android/java/src/org/chromium/native_test/ChromiumNativeTestInstrumentationTestRunner.java

Issue 788753002: [Android] Implement gtest and local in platform mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix findbugs + move log parsing up to GtestTestInstance Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/android/unit_tests_apk/AndroidManifest.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 try { 107 try {
108 // Wait for the test to create the FIFO. 108 // Wait for the test to create the FIFO.
109 fifo = new File(getTargetContext().getFilesDir().getAbsolutePath(), "test.fifo"); 109 fifo = new File(getTargetContext().getFilesDir().getAbsolutePath(), "test.fifo");
110 while (!fifo.exists()) { 110 while (!fifo.exists()) {
111 Thread.sleep(1000); 111 Thread.sleep(1000);
112 } 112 }
113 113
114 r = new BufferedReader( 114 r = new BufferedReader(
115 new InputStreamReader(new BufferedInputStream(new FileInputS tream(fifo)))); 115 new InputStreamReader(new BufferedInputStream(new FileInputS tream(fifo))));
116 116
117 StringBuilder resultsStr = new StringBuilder();
118 for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEn tryLogger"); 117 for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEn tryLogger");
119 l = r.readLine()) { 118 l = r.readLine()) {
120 Matcher m = RE_TEST_OUTPUT.matcher(l); 119 Matcher m = RE_TEST_OUTPUT.matcher(l);
121 if (m.matches()) { 120 if (m.matches()) {
122 if (m.group(1).equals("RUN")) { 121 if (m.group(1).equals("RUN")) {
123 results.put(m.group(2), TestResult.UNKNOWN); 122 results.put(m.group(2), TestResult.UNKNOWN);
124 } else if (m.group(1).equals("FAILED")) { 123 } else if (m.group(1).equals("FAILED")) {
125 results.put(m.group(2), TestResult.FAILED); 124 results.put(m.group(2), TestResult.FAILED);
126 } else if (m.group(1).equals("OK")) { 125 } else if (m.group(1).equals("OK")) {
127 results.put(m.group(2), TestResult.PASSED); 126 results.put(m.group(2), TestResult.PASSED);
128 } 127 }
129 } 128 }
130 resultsStr.append(l); 129 mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
131 resultsStr.append("\n"); 130 sendStatus(0, mLogBundle);
132 } 131 }
133 mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, result sStr.toString());
134 sendStatus(0, mLogBundle);
135 } catch (InterruptedException e) { 132 } catch (InterruptedException e) {
136 Log.e(TAG, "Interrupted while waiting for FIFO file creation: " + e. toString()); 133 Log.e(TAG, "Interrupted while waiting for FIFO file creation: " + e. toString());
137 } catch (FileNotFoundException e) { 134 } catch (FileNotFoundException e) {
138 Log.e(TAG, "Couldn't find FIFO file: " + e.toString()); 135 Log.e(TAG, "Couldn't find FIFO file: " + e.toString());
139 } catch (IOException e) { 136 } catch (IOException e) {
140 Log.e(TAG, "Error handling FIFO file: " + e.toString()); 137 Log.e(TAG, "Error handling FIFO file: " + e.toString());
141 } finally { 138 } finally {
142 if (r != null) { 139 if (r != null) {
143 try { 140 try {
144 r.close(); 141 r.close();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 "\nFAILURES!!! Tests run: " + Integer.toString(rawResult s.size()) 184 "\nFAILURES!!! Tests run: " + Integer.toString(rawResult s.size())
188 + ", Failures: " + Integer.toString(testsFailed) + ", Er rors: 0"); 185 + ", Failures: " + Integer.toString(testsFailed) + ", Er rors: 0");
189 } 186 }
190 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, 187 resultsBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT,
191 resultBuilder.toString()); 188 resultBuilder.toString());
192 return resultsBundle; 189 return resultsBundle;
193 } 190 }
194 } 191 }
195 192
196 } 193 }
OLDNEW
« no previous file with comments | « chrome/test/android/unit_tests_apk/AndroidManifest.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698