Insert 2 seconds wait in each test case setup.

This is the work around for the surface request race
condition.

Change-Id: Iaf8be12cfe4eb70d0a309ad875f38427181ac4b4
This commit is contained in:
Yu Shan Emily Lau
2012-03-22 18:46:18 -07:00
parent b7b3894a8e
commit 003a756974
3 changed files with 12 additions and 2 deletions

View File

@@ -101,6 +101,9 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
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();
if (MediaFrameworkPerfTestRunner.mGetNativeHeapDump)
MediaTestUtil.getNativeHeapDump(this.getName() + "_before");

View File

@@ -43,13 +43,18 @@ import android.test.InstrumentationTestCase;
/**
* Junit / Instrumentation test case for the media player
*/
public class MediaPlayerStressTest extends InstrumentationTestCase {
public class MediaPlayerStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
private String TAG = "MediaPlayerStressTest";
public MediaPlayerStressTest() {
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
}
protected void setUp() throws Exception {
//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();
}

View File

@@ -88,7 +88,9 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me
if (! sem.tryAcquire(WAIT_TIMEOUT, TimeUnit.MILLISECONDS)) {
fail("Failed to start the looper.");
}
//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();
}