Merge "MediaFrameworkTest: Fix storage path" into qt-dev
am: e83c7779c0
Change-Id: I03884595c1aa9edb0be95f80cf9a58adec13301d
This commit is contained in:
@@ -25,7 +25,6 @@ import android.hardware.Camera.PictureCallback;
|
||||
import android.hardware.Camera.PreviewCallback;
|
||||
import android.hardware.Camera.ShutterCallback;
|
||||
import android.os.ConditionVariable;
|
||||
import android.os.Environment;
|
||||
import android.os.Looper;
|
||||
import android.test.ActivityInstrumentationTestCase;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
@@ -159,7 +158,7 @@ public class CameraTest extends ActivityInstrumentationTestCase<MediaFrameworkTe
|
||||
if (rawData != null) {
|
||||
int rawDataLength = rawData.length;
|
||||
File rawoutput = new File(
|
||||
Environment.getExternalStorageDirectory().toString(), "/test.bmp");
|
||||
mContext.getExternalFilesDir(null).getPath(), "/test.bmp");
|
||||
FileOutputStream outstream = new FileOutputStream(rawoutput);
|
||||
outstream.write(rawData);
|
||||
Log.v(TAG, "JpegPictureCallback rawDataLength = " + rawDataLength);
|
||||
|
||||
@@ -22,10 +22,11 @@ import android.hardware.Camera;
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.hardware.Camera.PictureCallback;
|
||||
import android.hardware.Camera.ShutterCallback;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -70,7 +71,8 @@ public class CameraTestHelper {
|
||||
try {
|
||||
Log.v(TAG, "JPEG picture taken");
|
||||
fos = new FileOutputStream(String.format("%s/%s/%s-%d.jpg",
|
||||
Environment.getExternalStorageDirectory(), CAMERA_STRESS_IMAGES_DIRECTORY,
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext()
|
||||
.getExternalFilesDir(null).getPath(), CAMERA_STRESS_IMAGES_DIRECTORY,
|
||||
CAMERA_STRESS_IMAGES_PREFIX, System.currentTimeMillis()));
|
||||
fos.write(data);
|
||||
} catch (FileNotFoundException e) {
|
||||
@@ -95,7 +97,8 @@ public class CameraTestHelper {
|
||||
public void setupCameraTest() {
|
||||
// Create the test images directory if it doesn't exist
|
||||
File stressImagesDirectory = new File(String.format("%s/%s",
|
||||
Environment.getExternalStorageDirectory(), CAMERA_STRESS_IMAGES_DIRECTORY));
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext()
|
||||
.getExternalFilesDir(null).getPath(), CAMERA_STRESS_IMAGES_DIRECTORY));
|
||||
if (!stressImagesDirectory.exists()) {
|
||||
stressImagesDirectory.mkdir();
|
||||
}
|
||||
@@ -129,7 +132,8 @@ public class CameraTestHelper {
|
||||
public void cleanupTestImages() {
|
||||
try {
|
||||
File stressImagesDirectory = new File(String.format("%s/%s",
|
||||
Environment.getExternalStorageDirectory(), CAMERA_STRESS_IMAGES_DIRECTORY));
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext()
|
||||
.getExternalFilesDir(null).getPath(), CAMERA_STRESS_IMAGES_DIRECTORY));
|
||||
File[] stressImages = stressImagesDirectory.listFiles();
|
||||
for (File f : stressImages) {
|
||||
f.delete();
|
||||
|
||||
@@ -54,7 +54,6 @@ import android.media.Image.Plane;
|
||||
import android.media.ImageReader;
|
||||
import android.media.ImageWriter;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@@ -63,6 +62,8 @@ import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
@@ -128,7 +129,8 @@ public class CameraTestUtils extends Assert {
|
||||
private static final Location sTestLocation2 = new Location(LocationManager.NETWORK_PROVIDER);
|
||||
|
||||
protected static final String DEBUG_FILE_NAME_BASE =
|
||||
Environment.getExternalStorageDirectory().getPath();
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext()
|
||||
.getExternalFilesDir(null).getPath();
|
||||
|
||||
static {
|
||||
sTestLocation0.setTime(1199145600L);
|
||||
|
||||
@@ -104,7 +104,6 @@ public class Camera2SwitchPreviewTest extends Camera2SurfaceViewTestCase {
|
||||
private static final double AE_COMPENSATION_ERROR_TOLERANCE = 0.2;
|
||||
// 5 percent error margin for resulting metering regions
|
||||
private static final float METERING_REGION_ERROR_PERCENT_DELTA = 0.05f;
|
||||
private final String VIDEO_FILE_PATH = Environment.getExternalStorageDirectory().getPath();
|
||||
|
||||
private static final boolean DEBUG_DUMP = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final int RECORDING_DURATION_MS = 3000;
|
||||
@@ -137,10 +136,12 @@ public class Camera2SwitchPreviewTest extends Camera2SurfaceViewTestCase {
|
||||
private int mVideoFrameRate;
|
||||
private Size mVideoSize;
|
||||
private long mRecordingStartTime;
|
||||
private String mVideoFilePath;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
mVideoFilePath = mContext.getExternalFilesDir(null).getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -371,9 +372,9 @@ public class Camera2SwitchPreviewTest extends Camera2SurfaceViewTestCase {
|
||||
}
|
||||
|
||||
// Configure preview and recording surfaces.
|
||||
mOutMediaFileName = VIDEO_FILE_PATH + "/test_video.mp4";
|
||||
mOutMediaFileName = mVideoFilePath + "/test_video.mp4";
|
||||
if (DEBUG_DUMP) {
|
||||
mOutMediaFileName = VIDEO_FILE_PATH + "/test_video_" + cameraId + "_"
|
||||
mOutMediaFileName = mVideoFilePath + "/test_video_" + cameraId + "_"
|
||||
+ videoSz.toString() + ".mp4";
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Camera.Parameters;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
@@ -36,6 +35,8 @@ import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
|
||||
/**
|
||||
* Junit / Instrumentation test case for the following camera APIs:
|
||||
* - camera zoom
|
||||
@@ -85,7 +86,8 @@ public class CameraStressTest extends ActivityInstrumentationTestCase2<MediaFram
|
||||
|
||||
mCameraTestHelper = new CameraTestHelper();
|
||||
File stressOutFile = new File(String.format("%s/%s",
|
||||
Environment.getExternalStorageDirectory(), CAMERA_STRESS_OUTPUT));
|
||||
InstrumentationRegistry.getInstrumentation().getTargetContext()
|
||||
.getExternalFilesDir(null).getPath(), CAMERA_STRESS_OUTPUT));
|
||||
mOutput = new BufferedWriter(new FileWriter(stressOutFile, true));
|
||||
mOutput.write(this.getName() + "\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user