diff options
author | Gloria Wang <gwang@google.com> | 2011-09-30 10:00:58 -0700 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2011-09-30 10:05:33 -0700 |
commit | 627f445a23b6c1188e366c0eec52abc488668bec (patch) | |
tree | 828b100a598b1616a2f00debaa67eb2081bf8863 /media/tests/MediaFrameworkTest | |
parent | 1c6ac4eb5c035ecc18bab2006610f9015be08f34 (diff) | |
download | frameworks_base-627f445a23b6c1188e366c0eec52abc488668bec.zip frameworks_base-627f445a23b6c1188e366c0eec52abc488668bec.tar.gz frameworks_base-627f445a23b6c1188e366c0eec52abc488668bec.tar.bz2 |
Wait for some time before stopping the media recorder.
Fix for bug 5239001.
Change-Id: Ifa18a404e8568cced88a93b8d1a7125875aadb15
Diffstat (limited to 'media/tests/MediaFrameworkTest')
-rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java index 8737595..91100ae 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java @@ -20,6 +20,7 @@ import android.media.MediaRecorder; import android.test.AndroidTestCase; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.Suppress; +import android.util.Log; /** * Unit test class to test the set of valid and invalid states that @@ -27,6 +28,8 @@ import android.test.suitebuilder.annotation.Suppress; */ public class MediaRecorderStopStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest { private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate(); + private static final String TAG = "MediaRecorderStopStateUnitTest"; + private static final int SLEEP_TIME_BEFORE_STOP = 1000; /** * 1. It is valid to call stop() in the following states: @@ -51,6 +54,15 @@ public class MediaRecorderStopStateUnitTest extends AndroidTestCase implements M } public void invokeMethodUnderTest(MediaRecorder recorder) { + // Wait for some time before stopping the media recorder. + // This will fix the assertion caused by stopping it immediatedly + // after it is started + try { + Thread.sleep(SLEEP_TIME_BEFORE_STOP); + } catch(Exception e) { + Log.v(TAG, "sleep was interrupted and terminated prematurely"); + } + recorder.stop(); } |