Skip to content

Commit 8fa2339

Browse files
Yu Shan Emily LauAndroid (Google) Code Review
authored andcommitted
Merge "Insert the 2 seconds before test start to workaround the race conditon for requesting the surface."
2 parents cde8aae + a79edb7 commit 8fa2339

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediaplayback/MediaPlayerApiTest.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.android.mediaframeworktest.functional.CodecTest;
2323

2424
import android.content.Context;
25-
import android.test.ActivityInstrumentationTestCase;
25+
import android.test.ActivityInstrumentationTestCase2;
2626
import android.util.Log;
2727
import android.test.suitebuilder.annotation.LargeTest;
2828
import android.test.suitebuilder.annotation.MediumTest;
@@ -33,25 +33,28 @@
3333
/**
3434
* Junit / Instrumentation test case for the media player api
3535
*/
36-
public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
37-
private boolean duratoinWithinTolerence = false;
38-
private String TAG = "MediaPlayerApiTest";
39-
private boolean isWMAEnable = false;
40-
private boolean isWMVEnable = false;
36+
public class MediaPlayerApiTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
37+
private boolean duratoinWithinTolerence = false;
38+
private String TAG = "MediaPlayerApiTest";
39+
private boolean isWMAEnable = false;
40+
private boolean isWMVEnable = false;
4141

42-
Context mContext;
42+
Context mContext;
4343

44-
public MediaPlayerApiTest() {
45-
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
46-
isWMAEnable = MediaProfileReader.getWMAEnable();
47-
isWMVEnable = MediaProfileReader.getWMVEnable();
48-
}
44+
public MediaPlayerApiTest() {
45+
super("com.android.mediaframeworktest", MediaFrameworkTest.class);
46+
isWMAEnable = MediaProfileReader.getWMAEnable();
47+
isWMVEnable = MediaProfileReader.getWMVEnable();
48+
}
4949

5050
protected void setUp() throws Exception {
51-
super.setUp();
52-
53-
}
54-
51+
//Insert a 2 second before launching the test activity. This is
52+
//the workaround for the race condition of requesting the updated surface.
53+
Thread.sleep(2000);
54+
getActivity();
55+
super.setUp();
56+
}
57+
5558
public boolean verifyDuration(int duration, int expectedDuration){
5659
if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9))
5760
return false;

0 commit comments

Comments
 (0)