summaryrefslogtreecommitdiff
path: root/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2012-03-05 15:31:04 -0800
committerGuang Zhu <guangzhu@google.com>2012-03-05 15:33:17 -0800
commit3ae8c42152d890ab771053fa6b16b038ee44326d (patch)
tree5a4dab5c9ccc09a7763726299b7b2a60d0c6405a /tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
parentd55191d0866550f245907dba9152753744c2935c (diff)
Update to DumpRenderTree test harness
* removed some unused parameters * removed obsolete live website test harness * updated test class so that mean suite time for page cycler is emmitted via instrumentation status Change-Id: Iccb40f70a62a4ac9b8d5bceab9a6a715c611c573
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java')
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
index d883a32670a1..4b86a0b12a90 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
@@ -19,6 +19,7 @@ package com.android.dumprendertree;
import com.android.dumprendertree.forwarder.AdbUtils;
import com.android.dumprendertree.forwarder.ForwardServer;
+import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
@@ -106,8 +107,7 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
freeMem();
// Run tests
- runTestAndWaitUntilDone(activity, runner.mTestPath, runner.mTimeoutInMillis,
- runner.mGetDrawTime, runner.mSaveImagePath);
+ runTestAndWaitUntilDone(activity, runner.mTestPath, runner.mTimeoutInMillis);
getInstrumentation().runOnMainSync(new Runnable() {
@@ -215,9 +215,9 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
}
// A convenient method to be called by another activity.
- private void runTestAndWaitUntilDone(TestShellActivity activity, String url, int timeout,
- boolean getDrawTime, String saveImagePath) {
+ private void runTestAndWaitUntilDone(TestShellActivity activity, String url, int timeout) {
activity.setCallback(new TestShellCallback() {
+ @Override
public void finished() {
synchronized (LoadTestsAutoTest.this) {
mFinished = true;
@@ -225,8 +225,29 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
}
}
+ @Override
public void timedOut(String url) {
}
+
+ @Override
+ public void dumpResult(String webViewDump) {
+ String lines[] = webViewDump.split("\\r?\\n");
+ for (String line : lines) {
+ line = line.trim();
+ // parse for a line like this:
+ // totals: 9620.00 11947.00 10099.75 380.38
+ // and return the 3rd number, which is mean
+ if (line.startsWith("totals:")) {
+ line = line.substring(7).trim(); // strip "totals:"
+ String[] numbers = line.split("\\s+");
+ if (numbers.length == 4) {
+ Bundle b = new Bundle();
+ b.putString("mean", numbers[2]);
+ getInstrumentation().sendStatus(Activity.RESULT_FIRST_USER, b);
+ }
+ }
+ }
+ }
});
mFinished = false;
@@ -236,9 +257,6 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
intent.putExtra(TestShellActivity.TEST_URL, url);
intent.putExtra(TestShellActivity.TIMEOUT_IN_MILLIS, timeout);
intent.putExtra(TestShellActivity.RESULT_FILE, LOAD_TEST_RESULT);
- intent.putExtra(TestShellActivity.GET_DRAW_TIME, getDrawTime);
- if (saveImagePath != null)
- intent.putExtra(TestShellActivity.SAVE_IMAGE, saveImagePath);
activity.startActivity(intent);
// Wait until done.