diff options
author | Guang Zhu <guangzhu@google.com> | 2010-12-06 11:28:49 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-06 11:28:49 -0800 |
commit | afeffb744feea960f5b8a441984badd270207b62 (patch) | |
tree | 5f72d02f361b668ac464f0d1d6499e8a6b27c18a /tests | |
parent | 2ee1856f814c4246f1b56db21693432442a70d94 (diff) | |
parent | 0006952a8dc5a115cceb597ac53ec5bce703fd4f (diff) | |
download | frameworks_base-afeffb744feea960f5b8a441984badd270207b62.zip frameworks_base-afeffb744feea960f5b8a441984badd270207b62.tar.gz frameworks_base-afeffb744feea960f5b8a441984badd270207b62.tar.bz2 |
Merge "change how assets are copied out of apk"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java | 10 | ||||
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java index 132f17a..8aa3c69 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java @@ -20,6 +20,7 @@ import com.android.dumprendertree.TestShellActivity.DumpDataType; import com.android.dumprendertree.forwarder.AdbUtils; import com.android.dumprendertree.forwarder.ForwardService; +import android.content.Context; import android.content.Intent; import android.os.Environment; import android.test.ActivityInstrumentationTestCase2; @@ -471,11 +472,14 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh public void copyResultsAndRunnerAssetsToCache() { try { - String out_dir = getActivity().getApplicationContext().getCacheDir().getPath() + "/"; + Context targetContext = getInstrumentation().getTargetContext(); + File cacheDir = targetContext.getCacheDir(); for( int i=0; i< LAYOUT_TESTS_RESULTS_REFERENCE_FILES.length; i++) { - InputStream in = getActivity().getAssets().open(LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]); - OutputStream out = new FileOutputStream(out_dir + LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]); + InputStream in = targetContext.getAssets().open( + LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]); + OutputStream out = new FileOutputStream(new File(cacheDir, + LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i])); byte[] buf = new byte[2048]; int len; diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java index 9352f39..4982c46 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 dalvik.system.VMRuntime; import android.app.Instrumentation; +import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Debug; @@ -27,6 +28,7 @@ import android.os.Process; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -202,14 +204,14 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel public void copyRunnerAssetsToCache() { try { - String out_dir = getActivity().getApplicationContext() - .getCacheDir().getPath() + "/"; + Context targetContext = getInstrumentation().getTargetContext(); + File cacheDir = targetContext.getCacheDir(); for( int i=0; i< LOAD_TEST_RUNNER_FILES.length; i++) { - InputStream in = getActivity().getAssets().open( + InputStream in = targetContext.getAssets().open( LOAD_TEST_RUNNER_FILES[i]); OutputStream out = new FileOutputStream( - out_dir + LOAD_TEST_RUNNER_FILES[i]); + new File(cacheDir, LOAD_TEST_RUNNER_FILES[i])); byte[] buf = new byte[2048]; int len; |