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

Commit 3a0ad304 authored by Hyungtae Kim's avatar Hyungtae Kim Committed by Android (Google) Code Review
Browse files

Merge "Rename instr argument 'repeat' to 'iterations'"

parents f812e57d 84789bef
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ public class Camera2SurfaceViewTestCase extends
    private static final int WAIT_FOR_SURFACE_CHANGE_TIMEOUT_MS = 1000;

    // Instrumentation arguments
    protected static final String ARG_KEY_REPEAT = "repeat";
    protected static final String ARG_KEY_ITERATIONS = "iterations";
    protected static final String ARG_KEY_WAIT_INTERVAL_MS = "waitIntervalMs";
    protected static final String ARG_KEY_RESULT_TO_FILE = "resultToFile";

@@ -126,8 +126,8 @@ public class Camera2SurfaceViewTestCase extends

    protected WindowManager mWindowManager;

    // Repeat tests a given times. Default to 1.
    protected int mRepeat = 1;
    // Set the number of iterations to run stress testing. Default to 1.
    protected int mIterations = 1;
    // The interval between test iterations used for stress test.
    protected long mTestWaitIntervalMs = 1 * 1000;  // 1 sec
    protected boolean mWriteToFile = true;
@@ -165,10 +165,10 @@ public class Camera2SurfaceViewTestCase extends

        mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);

        mRepeat = getArgumentsAsNumber(ARG_KEY_REPEAT, 1).intValue();
        mIterations = getArgumentsAsNumber(ARG_KEY_ITERATIONS, 1).intValue();
        mTestWaitIntervalMs = getArgumentsAsNumber(ARG_KEY_WAIT_INTERVAL_MS, 1000).longValue();
        mWriteToFile = getArgumentsAsBoolean(ARG_KEY_RESULT_TO_FILE, true);
        Log.i(TAG, "Argument: repeat count=" + mRepeat);
        Log.i(TAG, "Argument: iteration count=" + mIterations);
        Log.i(TAG, "Argument: interval (ms)=" + mTestWaitIntervalMs);
        Log.i(TAG, "Argument: result to file=" + (mWriteToFile ? "true" : "false"));
        mResultPrinter = new CameraTestResultPrinter(getInstrumentation(), mWriteToFile);
@@ -790,8 +790,8 @@ public class Camera2SurfaceViewTestCase extends
        return defaultValue;
    }

    protected int getRepeatCount() {
        return mRepeat;
    protected int getIterationCount() {
        return mIterations;
    }

    protected long getTestWaitIntervalMs() {
+5 −6
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.util.Log;
import android.util.Rational;
import android.util.Size;

import java.util.Arrays;
@@ -47,7 +46,7 @@ import static com.android.mediaframeworktest.helpers.CameraTestUtils.getValueNot
 *
 * adb shell am instrument \
 *    -e class com.android.mediaframeworktest.stress.Camera2CaptureRequestTest#testAeModeAndLock \
 *    -e repeat 10 \
 *    -e iterations 10 \
 *    -e waitIntervalMs 1000 \
 *    -e resultToFile false \
 *    -r -w com.android.mediaframeworktest/.Camera2InstrumentationTestRunner
@@ -100,16 +99,16 @@ public class Camera2CaptureRequestTest extends Camera2SurfaceViewTestCase {
                updatePreviewSurface(maxPreviewSz);

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                    Log.v(TAG, String.format("AE mode and lock: %d/%d", repeat + 1,
                            getRepeatCount()));
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("AE mode and lock: %d/%d", iteration + 1,
                            getIterationCount()));

                    // Test aeMode and lock
                    int[] aeModes = mStaticInfo.getAeAvailableModesChecked();
                    for (int mode : aeModes) {
                        aeModeAndLockTestByMode(mode);
                    }
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, mCameraIds[i]);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1, mCameraIds[i]);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {
+14 −13
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ import static com.android.mediaframeworktest.helpers.CameraTestUtils.getValueNot
 *
 * adb shell am instrument \
 *    -e class com.android.mediaframeworktest.stress.Camera2RecordingTest#testBasicRecording \
 *    -e repeat 10 \
 *    -e iterations 10 \
 *    -e waitIntervalMs 1000 \
 *    -e resultToFile false \
 *    -r -w com.android.mediaframeworktest/.Camera2InstrumentationTestRunner
@@ -142,11 +142,12 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
                initSupportedVideoSize(mCameraIds[i]);

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                    Log.v(TAG, String.format("Recording video: %d/%d", repeat + 1,
                            getRepeatCount()));
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Recording video: %d/%d", iteration + 1,
                            getIterationCount()));
                    basicRecordingTestByCamera(mCamcorderProfileList, useVideoStab);
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, mCameraIds[i]);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1,
                            mCameraIds[i]);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {
@@ -206,9 +207,9 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
                }

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                    Log.v(TAG, String.format("Constrained high speed recording: %d/%d", repeat + 1,
                            getRepeatCount()));
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Constrained high speed recording: %d/%d",
                            iteration + 1, getIterationCount()));

                    StreamConfigurationMap config =
                            mStaticInfo.getValueFromKeyNonNull(
@@ -257,7 +258,7 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
                            validateRecording(size, durationMs);
                        }

                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                    Thread.sleep(getTestWaitIntervalMs());
                    }
                }
@@ -481,11 +482,11 @@ public class Camera2RecordingTest extends Camera2SurfaceViewTestCase {
                    initSupportedVideoSize(id);

                    // Test iteration starts...
                    for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                        Log.v(TAG, String.format("Video snapshot: %d/%d", repeat + 1,
                                getRepeatCount()));
                    for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                        Log.v(TAG, String.format("Video snapshot: %d/%d", iteration + 1,
                                getIterationCount()));
                        videoSnapshotTestByCamera(burstTest);
                        getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                        getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                        Thread.sleep(getTestWaitIntervalMs());
                    }
                } finally {
+15 −15
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ import static com.android.mediaframeworktest.helpers.CameraTestUtils.verifyJpegK
 * adb shell am instrument \
 *    -e class \
 *    com.android.mediaframeworktest.stress.Camera2StillCaptureTest#Camera2ReprocessCaptureTest \
 *    -e repeat 1 \
 *    -e iterations 1 \
 *    -e waitIntervalMs 1000 \
 *    -e resultToFile false \
 *    -r -w com.android.mediaframeworktest/.Camera2InstrumentationTestRunner
@@ -110,12 +110,12 @@ public class Camera2ReprocessCaptureTest extends Camera2SurfaceViewTestCase {
            }

            // Test iteration starts...
            for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                Log.v(TAG, String.format("Reprocessing YUV to JPEG: %d/%d", repeat + 1,
                        getRepeatCount()));
            for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                Log.v(TAG, String.format("Reprocessing YUV to JPEG: %d/%d", iteration + 1,
                        getIterationCount()));
                // YUV_420_888 -> JPEG must be supported.
                testBasicReprocessing(id, ImageFormat.YUV_420_888, ImageFormat.JPEG);
                getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                Thread.sleep(getTestWaitIntervalMs());
            }
        }
@@ -131,12 +131,12 @@ public class Camera2ReprocessCaptureTest extends Camera2SurfaceViewTestCase {
            }

            // Test iteration starts...
            for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                Log.v(TAG, String.format("Reprocessing OPAQUE to JPEG: %d/%d", repeat + 1,
                        getRepeatCount()));
            for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                Log.v(TAG, String.format("Reprocessing OPAQUE to JPEG: %d/%d", iteration + 1,
                        getIterationCount()));
                // OPAQUE -> JPEG must be supported.
                testBasicReprocessing(id, ImageFormat.PRIVATE, ImageFormat.JPEG);
                getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                Thread.sleep(getTestWaitIntervalMs());
            }

@@ -157,12 +157,12 @@ public class Camera2ReprocessCaptureTest extends Camera2SurfaceViewTestCase {
                openDevice(id);

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Reprocessing size format with preview: %d/%d",
                            repeat + 1, getRepeatCount()));
                            iteration + 1, getIterationCount()));
                    testReprocessingAllCombinations(id, mOrderedPreviewSizes.get(0),
                            CaptureTestCase.SINGLE_SHOT);
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {
@@ -185,16 +185,16 @@ public class Camera2ReprocessCaptureTest extends Camera2SurfaceViewTestCase {
                openDevice(id);

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Reprocessing mixed burst with or without preview: "
                            + "%d/%d", repeat + 1, getRepeatCount()));
                            + "%d/%d", iteration + 1, getIterationCount()));
                    // no preview
                    testReprocessingAllCombinations(id, /*previewSize*/null,
                            CaptureTestCase.MIXED_BURST);
                    // with preview
                    testReprocessingAllCombinations(id, mOrderedPreviewSizes.get(0),
                            CaptureTestCase.MIXED_BURST);
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {
+10 −9
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ import static com.android.mediaframeworktest.helpers.CameraTestUtils.makeImageRe
 *
 * adb shell am instrument \
 *    -e class com.android.mediaframeworktest.stress.Camera2StillCaptureTest#testTakePicture \
 *    -e repeat 200 \
 *    -e iterations 200 \
 *    -e waitIntervalMs 1000 \
 *    -e resultToFile false \
 *    -r -w com.android.mediaframeworktest/.Camera2InstrumentationTestRunner
@@ -108,12 +108,12 @@ public class Camera2StillCaptureTest extends Camera2SurfaceViewTestCase {
                }

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                    Log.v(TAG, String.format("Taking pictures: %d/%d", repeat + 1,
                            getRepeatCount()));
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Taking pictures: %d/%d", iteration + 1,
                            getIterationCount()));
                    takePictureTestByCamera(/*aeRegions*/null, /*awbRegions*/null,
                            /*afRegions*/null);
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, id);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1, id);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {
@@ -144,11 +144,12 @@ public class Camera2StillCaptureTest extends Camera2SurfaceViewTestCase {
                }

                // Test iteration starts...
                for (int repeat = 0; repeat < getRepeatCount(); ++repeat) {
                    Log.v(TAG, String.format("Taking full RAW pictures: %d/%d", repeat + 1,
                            getRepeatCount()));
                for (int iteration = 0; iteration < getIterationCount(); ++iteration) {
                    Log.v(TAG, String.format("Taking full RAW pictures: %d/%d", iteration + 1,
                            getIterationCount()));
                    fullRawCaptureTestByCamera();
                    getResultPrinter().printStatus(getRepeatCount(), repeat + 1, mCameraIds[i]);
                    getResultPrinter().printStatus(getIterationCount(), iteration + 1,
                            mCameraIds[i]);
                    Thread.sleep(getTestWaitIntervalMs());
                }
            } finally {