summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2014-10-23 16:57:13 -0700
committerThe Android Automerger <android-build@google.com>2014-10-27 14:12:09 -0700
commitf3e388168a15fc092feab11b8430876730aca644 (patch)
tree6450a23b11dc2b2b809bdd175765b1e01b756498
parentc8f354b3de2a5a7aae19dd884b83c59f9550fb2e (diff)
downloadplatform_cts-f3e388168a15fc092feab11b8430876730aca644.tar.gz
platform_cts-f3e388168a15fc092feab11b8430876730aca644.tar.bz2
platform_cts-f3e388168a15fc092feab11b8430876730aca644.zip
CameraCTS: relax previewFps test constraint
Bug: 17752386 Change-Id: Iacf0a6857aa482b99445825ef0223f8e5e337282
-rw-r--r--tests/tests/hardware/src/android/hardware/cts/CameraTest.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index 3476895b5a3..019bd21f927 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -1859,6 +1859,7 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
initializeMessageLooper(cameraId);
// Test if the parameters exists and minimum fps <= maximum fps.
+ final int INTERVAL_ERROR_THRESHOLD = 10;
int[] defaultFps = new int[2];
Parameters parameters = mCamera.getParameters();
parameters.getPreviewFpsRange(defaultFps);
@@ -1919,6 +1920,13 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
// See if any frame duration violations occurred during preview run
AssertionFailedError e = callback.getDurationException();
if (e != null) throw(e);
+ int numIntervalError = callback.getNumIntervalError();
+ if (numIntervalError > INTERVAL_ERROR_THRESHOLD) {
+ fail(String.format(
+ "Too many preview callback frame intervals out of bounds: " +
+ "Count is %d, limit is %d",
+ numIntervalError, INTERVAL_ERROR_THRESHOLD));
+ }
}
// Test the invalid fps cases.
@@ -1948,6 +1956,7 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
private ArrayList<Long> mFrames = new ArrayList<Long>();
private long firstFrameArrivalTime;
private AssertionFailedError mDurationException = null;
+ private int numIntervalError;
public void reset(double minFps, double maxFps) {
this.mMinFps = minFps;
@@ -1960,6 +1969,7 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
mFrames.clear();
firstFrameArrivalTime = 0;
mDurationException = null;
+ numIntervalError = 0;
}
// This method tests if the actual fps is between minimum and maximum.
@@ -1997,18 +2007,15 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
long lastArrivalTime = mFrames.get(mFrames.size() - 1);
double interval = arrivalTime - lastArrivalTime;
if (VERBOSE) Log.v(TAG, "Frame interval=" + interval);
- try {
- assertTrue("Frame interval (" + interval + "ms) is too " +
- "large. mMaxFrameInterval=" +
- mMaxFrameInterval + "ms",
- interval < mMaxFrameInterval *
- (1.0 + intervalMargin));
- assertTrue("Frame interval (" + interval + "ms) is too " +
- "small. mMinFrameInterval=" +
- mMinFrameInterval + "ms",
- interval > mMinFrameInterval *
- (1.0 - intervalMargin));
+ try {
+ if (interval > mMaxFrameInterval * (1.0 + intervalMargin) ||
+ interval < mMinFrameInterval * (1.0 - intervalMargin)) {
+ Log.i(TAG, "Bad frame interval=" + interval + "ms. Out out range " +
+ mMinFrameInterval * (1.0 - intervalMargin) + "/" +
+ mMaxFrameInterval * (1.0 + intervalMargin));
+ numIntervalError++;
+ }
// Check if the fps is within range.
double fpsMargin = 0.5; // x100 = percent
double avgInterval = (double)(arrivalTime - mFrames.get(0))
@@ -2035,6 +2042,9 @@ public class CameraTest extends ActivityInstrumentationTestCase2<CameraCtsActivi
public AssertionFailedError getDurationException() {
return mDurationException;
}
+ public int getNumIntervalError() {
+ return numIntervalError;
+ }
}
private void assertEquals(Size expected, Size actual) {