am d5e0f181: am df7c4c62: Merge "cts: media: support no camera device in testSetMaxFileSize"
* commit 'd5e0f1812692406be0add5388c71e72d896c3c9b':
cts: media: support no camera device in testSetMaxFileSize
diff --git a/tests/src/android/webkit/cts/WebViewStubActivity.java b/tests/src/android/webkit/cts/WebViewStubActivity.java
index fcf260f..6a51bbe 100644
--- a/tests/src/android/webkit/cts/WebViewStubActivity.java
+++ b/tests/src/android/webkit/cts/WebViewStubActivity.java
@@ -20,6 +20,8 @@
import android.app.Activity;
import android.os.Bundle;
+import android.view.ViewGroup;
+import android.view.ViewParent;
import android.webkit.WebView;
public class WebViewStubActivity extends Activity {
@@ -38,6 +40,10 @@
@Override
public void onDestroy() {
+ ViewParent parent = mWebView.getParent();
+ if (parent instanceof ViewGroup) {
+ ((ViewGroup) parent).removeView(mWebView);
+ }
mWebView.destroy();
super.onDestroy();
}
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 4700d85..077c9f3 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -69,30 +69,31 @@
// This should allow for some variation in decoders, while still detecting
// phase and delay errors, channel swap, etc.
public void testDecodeMp3Lame() throws Exception {
- decode(R.raw.sinesweepmp3lame, 804.f);
+ decode(R.raw.sinesweepmp3lame, 804.f, true);
}
public void testDecodeMp3Smpb() throws Exception {
- decode(R.raw.sinesweepmp3smpb, 413.f);
+ decode(R.raw.sinesweepmp3smpb, 413.f, true);
}
public void testDecodeM4a() throws Exception {
- decode(R.raw.sinesweepm4a, 124.f);
+ decode(R.raw.sinesweepm4a, 124.f, true);
}
public void testDecodeOgg() throws Exception {
- decode(R.raw.sinesweepogg, 168.f);
+ decode(R.raw.sinesweepogg, 168.f, false);
}
public void testDecodeWav() throws Exception {
- decode(R.raw.sinesweepwav, 0.0f);
+ decode(R.raw.sinesweepwav, 0.0f, true);
}
public void testDecodeFlac() throws Exception {
- decode(R.raw.sinesweepflac, 0.0f);
+ decode(R.raw.sinesweepflac, 0.0f, true);
}
/**
* @param testinput the file to decode
* @param maxerror the maximum allowed root mean squared error
+ * @param testReconfigure whether to also test reconfiguring the codec
* @throws IOException
*/
- private void decode(int testinput, float maxerror) throws IOException {
+ private void decode(int testinput, float maxerror, boolean reconfigure) throws IOException {
short [] decoded = decodeToMemory(testinput, false);
@@ -111,10 +112,12 @@
double rmse = Math.sqrt(avgErrorSquared);
assertTrue("decoding error too big: " + rmse, rmse <= maxerror);
- short [] decoded2 = decodeToMemory(testinput, true);
- assertEquals("count different with reconfigure", decoded.length, decoded2.length);
- for (int i = 0; i < decoded.length; i++) {
- assertEquals("samples don't match", decoded[i], decoded2[i]);
+ if (reconfigure) {
+ short [] decoded2 = decodeToMemory(testinput, true);
+ assertEquals("count different with reconfigure", decoded.length, decoded2.length);
+ for (int i = 0; i < decoded.length; i++) {
+ assertEquals("samples don't match", decoded[i], decoded2[i]);
+ }
}
}