Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit afeffb74 authored by Guang Zhu's avatar Guang Zhu Committed by Android (Google) Code Review
Browse files

Merge "change how assets are copied out of apk"

parents 2ee1856f 0006952a
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.dumprendertree.TestShellActivity.DumpDataType;
import com.android.dumprendertree.forwarder.AdbUtils;
import com.android.dumprendertree.forwarder.AdbUtils;
import com.android.dumprendertree.forwarder.ForwardService;
import com.android.dumprendertree.forwarder.ForwardService;


import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.os.Environment;
import android.os.Environment;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ActivityInstrumentationTestCase2;
@@ -471,11 +472,14 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh


    public void copyResultsAndRunnerAssetsToCache() {
    public void copyResultsAndRunnerAssetsToCache() {
        try {
        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++) {
            for( int i=0; i< LAYOUT_TESTS_RESULTS_REFERENCE_FILES.length; i++) {
                InputStream in = getActivity().getAssets().open(LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]);
                InputStream in = targetContext.getAssets().open(
                OutputStream out = new FileOutputStream(out_dir + LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]);
                        LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]);
                OutputStream out = new FileOutputStream(new File(cacheDir,
                        LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]));


                byte[] buf = new byte[2048];
                byte[] buf = new byte[2048];
                int len;
                int len;
+6 −4
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.dumprendertree;
import dalvik.system.VMRuntime;
import dalvik.system.VMRuntime;


import android.app.Instrumentation;
import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Debug;
import android.os.Debug;
@@ -27,6 +28,7 @@ import android.os.Process;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.util.Log;


import java.io.File;
import java.io.FileOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStream;
@@ -202,14 +204,14 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel


    public void copyRunnerAssetsToCache() {
    public void copyRunnerAssetsToCache() {
        try {
        try {
            String out_dir = getActivity().getApplicationContext()
            Context targetContext = getInstrumentation().getTargetContext();
                .getCacheDir().getPath() + "/";
            File cacheDir = targetContext.getCacheDir();


            for( int i=0; i< LOAD_TEST_RUNNER_FILES.length; i++) {
            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]);
                        LOAD_TEST_RUNNER_FILES[i]);
                OutputStream out = new FileOutputStream(
                OutputStream out = new FileOutputStream(
                        out_dir + LOAD_TEST_RUNNER_FILES[i]);
                        new File(cacheDir, LOAD_TEST_RUNNER_FILES[i]));


                byte[] buf = new byte[2048];
                byte[] buf = new byte[2048];
                int len;
                int len;