summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java37
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java12
-rw-r--r--tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java13
3 files changed, 48 insertions, 14 deletions
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
index a79aead..d1aba43 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/FsUtils.java
@@ -39,9 +39,12 @@ import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -49,6 +52,7 @@ import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@@ -274,4 +278,37 @@ public class FsUtils {
Log.e(LOG_TAG, "Couldn't close stream!", e);
}
}
+
+ public static List<String> loadTestListFromStorage(String path) {
+ List<String> list = new ArrayList<String>();
+ if (path != null && !path.isEmpty()) {
+ try {
+ File file = new File(path);
+ Log.d(LOG_TAG, "test list loaded from " + path);
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ list.add(line);
+ }
+ reader.close();
+ } catch (IOException ioe) {
+ Log.e(LOG_TAG, "failed to load test list", ioe);
+ }
+ }
+ return list;
+ }
+
+ public static void saveTestListToStorage(File file, int start, List<String> testList) {
+ try {
+ BufferedWriter writer = new BufferedWriter(
+ new FileWriter(file));
+ for (String line : testList.subList(start, testList.size())) {
+ writer.write(line + '\n');
+ }
+ writer.flush();
+ writer.close();
+ } catch (IOException e) {
+ Log.e(LOG_TAG, "failed to write test list", e);
+ }
+ }
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
index 7efb03f..ce546ec 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
@@ -21,17 +21,15 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
-import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.PowerManager;
-import android.os.Process;
import android.os.PowerManager.WakeLock;
+import android.os.Process;
import android.os.RemoteException;
import android.util.Log;
import android.view.Window;
@@ -48,10 +46,7 @@ import android.webkit.WebStorage.QuotaUpdater;
import android.webkit.WebView;
import android.webkit.WebViewClient;
-import java.io.File;
import java.lang.Thread.UncaughtExceptionHandler;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -79,7 +74,7 @@ public class LayoutTestsExecutor extends Activity {
private static final String LOG_TAG = "LayoutTestsExecutor";
- public static final String EXTRA_TESTS_LIST = "TestsList";
+ public static final String EXTRA_TESTS_FILE = "TestsList";
public static final String EXTRA_TEST_INDEX = "TestIndex";
private static final int MSG_ACTUAL_RESULT_OBTAINED = 0;
@@ -305,7 +300,7 @@ public class LayoutTestsExecutor extends Activity {
requestWindowFeature(Window.FEATURE_PROGRESS);
Intent intent = getIntent();
- mTestsList = intent.getStringArrayListExtra(EXTRA_TESTS_LIST);
+ mTestsList = FsUtils.loadTestListFromStorage(intent.getStringExtra(EXTRA_TESTS_FILE));
mCurrentTestIndex = intent.getIntExtra(EXTRA_TEST_INDEX, -1);
mTotalTestCount = mCurrentTestIndex + mTestsList.size();
@@ -735,4 +730,5 @@ public class LayoutTestsExecutor extends Activity {
Log.i(LOG_TAG, mCurrentTestRelativePath + ": waitUntilDone() called");
mLayoutTestControllerHandler.sendEmptyMessage(MSG_WAIT_UNTIL_DONE);
}
+
}
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
index 9db4d2b..e374c1b 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
@@ -16,6 +16,8 @@
package com.android.dumprendertree2;
+import com.android.dumprendertree2.scriptsupport.OnEverythingFinishedCallback;
+
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
@@ -28,8 +30,7 @@ import android.view.Window;
import android.webkit.WebView;
import android.widget.Toast;
-import com.android.dumprendertree2.scriptsupport.OnEverythingFinishedCallback;
-
+import java.io.File;
import java.util.ArrayList;
/**
@@ -189,12 +190,12 @@ public class TestsListActivity extends Activity {
intent.setAction(Intent.ACTION_RUN);
if (startFrom < mTotalTestCount) {
- intent.putStringArrayListExtra(LayoutTestsExecutor.EXTRA_TESTS_LIST,
- new ArrayList<String>(mTestsList.subList(startFrom, mTotalTestCount)));
+ File testListFile = new File(getExternalFilesDir(null), "test_list.txt");
+ FsUtils.saveTestListToStorage(testListFile, startFrom, mTestsList);
+ intent.putExtra(LayoutTestsExecutor.EXTRA_TESTS_FILE, testListFile.getAbsolutePath());
intent.putExtra(LayoutTestsExecutor.EXTRA_TEST_INDEX, startFrom);
} else {
- intent.putStringArrayListExtra(LayoutTestsExecutor.EXTRA_TESTS_LIST,
- new ArrayList<String>());
+ intent.putExtra(LayoutTestsExecutor.EXTRA_TESTS_FILE, "");
}
startActivity(intent);