package run_page_cycler.py into apk and add code for extraction

This commit is contained in:
Guang Zhu
2009-04-22 09:58:25 -07:00
parent 967945ef00
commit 309f464807
3 changed files with 35 additions and 3 deletions

View File

@@ -56,7 +56,7 @@ def main(options, args):
run_load_test_cmd_postfix = " -w com.android.dumprendertree/.LayoutTestsAutoRunner"
# Call LoadTestsAutoTest::runTest.
run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd_postfix
run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runPageCyclerTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd_postfix
(adb_output, adb_error) = subprocess.Popen(run_load_test_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if adb_output.find('INSTRUMENTATION_FAILED') != -1 or \

View File

@@ -470,7 +470,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh
byte[] buf = new byte[2048];
int len;
while ((len = in.read(buf)) > 0 ) {
while ((len = in.read(buf)) >= 0 ) {
out.write(buf, 0, len);
}
out.close();

View File

@@ -31,6 +31,8 @@ import com.android.dumprendertree.TestShellCallback;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShellActivity> {
@@ -38,6 +40,9 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
private final static String LOGTAG = "LoadTest";
private final static String LOAD_TEST_RESULT = "/sdcard/load_test_result.txt";
private boolean mFinished;
static final String LOAD_TEST_RUNNER_FILES[] = {
"run_page_cycler.py"
};
public LoadTestsAutoTest() {
super("com.android.dumprendertree", TestShellActivity.class);
@@ -54,7 +59,7 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
// Invokes running of layout tests
// and waits till it has finished running.
public void runTest() {
public void runPageCyclerTest() {
LayoutTestsAutoRunner runner = (LayoutTestsAutoRunner) getInstrumentation();
if (runner.mTestPath == null) {
@@ -149,4 +154,31 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
}
}
}
public void copyRunnerAssetsToCache() {
try {
String out_dir = getActivity().getApplicationContext()
.getCacheDir().getPath() + "/";
for( int i=0; i< LOAD_TEST_RUNNER_FILES.length; i++) {
InputStream in = getActivity().getAssets().open(
LOAD_TEST_RUNNER_FILES[i]);
OutputStream out = new FileOutputStream(
out_dir + LOAD_TEST_RUNNER_FILES[i]);
byte[] buf = new byte[2048];
int len;
while ((len = in.read(buf)) >= 0 ) {
out.write(buf, 0, len);
}
out.close();
in.close();
}
}catch (IOException e) {
e.printStackTrace();
}
}
}