diff options
author | Yu Shan Emily Lau <yslau@google.com> | 2012-04-04 21:17:04 -0700 |
---|---|---|
committer | Yu Shan Emily Lau <yslau@google.com> | 2012-04-04 21:17:04 -0700 |
commit | a79edb72333ceda76c73166acef139c8668ee829 (patch) | |
tree | 9997b42add8a0bd437206291bb48972ed57f2a2f /media/tests/MediaFrameworkTest/src | |
parent | e252077d254c84b0e5e86123055ff0b9ab51cd04 (diff) | |
download | frameworks_base-a79edb72333ceda76c73166acef139c8668ee829.zip frameworks_base-a79edb72333ceda76c73166acef139c8668ee829.tar.gz frameworks_base-a79edb72333ceda76c73166acef139c8668ee829.tar.bz2 |
Insert the 2 seconds before test start to
workaround the race conditon for requesting
the surface.
Change-Id: Ic8ba358400492860b0d38fc71468ea4bb4d3d7bd
Diffstat (limited to 'media/tests/MediaFrameworkTest/src')
-rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java index c501d3f..7be2707 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java @@ -22,7 +22,7 @@ import com.android.mediaframeworktest.MediaProfileReader; import com.android.mediaframeworktest.functional.CodecTest; import android.content.Context; -import android.test.ActivityInstrumentationTestCase; +import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; @@ -33,25 +33,28 @@ import java.io.File; /** * Junit / Instrumentation test case for the media player api */ -public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> { - private boolean duratoinWithinTolerence = false; - private String TAG = "MediaPlayerApiTest"; - private boolean isWMAEnable = false; - private boolean isWMVEnable = false; +public class MediaPlayerApiTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> { + private boolean duratoinWithinTolerence = false; + private String TAG = "MediaPlayerApiTest"; + private boolean isWMAEnable = false; + private boolean isWMVEnable = false; - Context mContext; + Context mContext; - public MediaPlayerApiTest() { - super("com.android.mediaframeworktest", MediaFrameworkTest.class); - isWMAEnable = MediaProfileReader.getWMAEnable(); - isWMVEnable = MediaProfileReader.getWMVEnable(); - } + public MediaPlayerApiTest() { + super("com.android.mediaframeworktest", MediaFrameworkTest.class); + isWMAEnable = MediaProfileReader.getWMAEnable(); + isWMVEnable = MediaProfileReader.getWMVEnable(); + } protected void setUp() throws Exception { - super.setUp(); - - } - + //Insert a 2 second before launching the test activity. This is + //the workaround for the race condition of requesting the updated surface. + Thread.sleep(2000); + getActivity(); + super.setUp(); + } + public boolean verifyDuration(int duration, int expectedDuration){ if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9)) return false; |